Tool: sort_packets

Description

This tool sorts a stream of CCSDS packets. The stream is assumed to only contain one APID, if not, unpredictable reasults will occur. Packets are sorted in their "natural order" - i.e. in the manner appropriate to their type as determined by a SwiftTypedPacketReader.

The sort is stable, meaning that the original order is preserved when two packets are "the same".

This tool can optionally "unique" the packet stream -i.e. delete all but the last of a string of identical packets. Note that this is different from common "uniquing" practice, because we consider the last packet in the input stream to be more valid. This way an earlier version of a packet will be replaced by a later revised version.

Option Summary

OptionArgument TypeDefault Value
-apid_list String apids.list
-infile String -
-outfile String -
-trash String  
-unique Boolean true

Only the initial unique characters of each option are significant. Each option must be followed by an argument of the given type. Boolean "true" and "false" are indicated with "y" and "n" respectively. A boolean option without a value is assumed to be "true". For filename arguments, "-" means either stdin or stdout as appropriate. Each option is described in detail below.

Parameters

apid_list String (default = apids.list)
The name of a configuration file for the SwiftTypedPacketReader which lists the packet types for various APIDs.

infile String (default = -)
The input file name.

outfile String (default = -)
The output file name. The output file should not be the same as the input file.

trash String (default =  )
The name of a file to which packets deleted by uniquing will be appended. If this is an empty string, deleted packets will be discarded. This parameter is ignored if the "unique" parameter is false.

unique Boolean (default = true)
Should the packets be "uniqued" after sorting?.