Go to the documentation of this file.
6 from l0info_utils
import read_cfe_header, print_utils_version
7 from l0info_hkt
import l0info_hkt
8 from l0info_oci
import l0info_oci
9 from l0info_harp
import l0info_harp
10 from l0info_spex
import l0info_spex
13 __version__ =
'1.7.3 (2023-08-10)'
15 __instids__ = [
'hkt',
'oci',
'harp',
'spex']
20 fh = open(args.input_file, mode=
'rb')
22 print(
"%s not found." % args.input_file)
30 print(
"Opened PACE data file: %s" % args.input_file)
32 bDSB =
False if args.noCFEheader
else True
43 if fh.tell() == os.fstat(fh.fileno()).st_size:
44 print(
'No packets in file.')
50 strInst = __instids__[dtype]
55 strInst = args.instrument.lower()
62 print(
"Writing output file: %s" % args.output)
63 output = open(args.output,
'w')
66 print(
"datatype=%s\n"%strInst.upper())
68 crc_check = args.crc_check
69 if strInst!=
'oci' and crc_check:
70 print(
"Warning: CRC check is only availible for OCI Science data")
73 if output: output.write(
"datatype=HKT\n")
76 elif strInst ==
'oci':
78 rcode =
l0info_oci(args,fh,output,bDSB,crc_check)
80 elif strInst ==
'harp':
81 if output: output.write(
"datatype=HARP\n")
84 elif strInst ==
'spex':
89 print(
'Invalid file or data type from CFE header. Or specify from [hkt,oci,harp,spex].')
100 print(
"l0info_pace", __version__)
101 parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter,description=\
102 'Reads OCI L0 HKT/science data and reports start/stop times',epilog=
"""
104 0 : All is well in the world
105 1 : Dunno, something horrible occurred
106 101 : File open error
107 102 : Invalid file or instrument from CFE header
108 103 : Problem reading packet information
109 104 : Invalid packet [header/datatype/length]
110 110 : No [Science] packets found
112 120 : Problem reading time from ancillary packet
113 131 : OCI Checksum failure
114 13X : OCI science data error
116 parser.add_argument(
'--version', action=
'version', version=
'%(prog)s ' + __version__)
117 parser.add_argument(
'input_file', type=str, help=
'path to the input L0 file')
118 parser.add_argument(
'--output', type=str, help=
'path to the optional output text file')
119 parser.add_argument(
'--verbose',
'-v', action=
'store_true')
120 parser.add_argument(
'--noCFEheader', action=
'store_true', help=
"data without CFE header")
121 parser.add_argument(
'--instrument', type=str, help=
'hkt,oci,harp or spex')
122 parser.add_argument(
'--crc_check', nargs=
'?', const=1, type=bool,default=
False, help=
'validate crc checksum')
123 args = parser.parse_args()
129 if __name__ ==
'__main__':
def read_cfe_header(filehandle, bVerbose=False)
void print(std::ostream &stream, const char *format)
def print_utils_version()