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.6.2_2023-01-23'
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
39 if fh.tell() == os.fstat(fh.fileno()).st_size:
40 print(
'No packets in file.')
46 strInst = __instids__[dtype]
51 strInst = args.instrument.lower()
58 print(
"Writing output file: %s" % args.output)
59 output = open(args.output,
'w')
62 print(
"datatype=%s\n"%strInst.upper())
66 if output: output.write(
"datatype=HKT\n")
69 elif strInst ==
'oci':
73 elif strInst ==
'harp':
74 if output: output.write(
"datatype=HARP\n")
77 elif strInst ==
'spex':
82 print(
'Invalid file or data type from CFE header. Or specify from [hkt,oci,harp,spex].')
93 print(
"Running l0info_pace (version: %s) \n" % __version__)
94 parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter,description=\
95 'Reads OCI L0 HKT/science data and reports start/stop times',epilog=
"""
97 0 : All is well in the world
98 1 : Dunno, something horrible occurred
100 102 : Invalid file or instrument from CFE header
101 103 : Problem reading packet information
102 104 : Invalid packet [header/datatype/length]
103 110 : No [Science] packets found
105 120 : Problem reading time from ancillary packet
106 13X : OCI science data error
108 parser.add_argument(
'--version', action=
'version', version=
'%(prog)s ' + __version__)
109 parser.add_argument(
'input_file', type=str, help=
'path to the input L0 file')
110 parser.add_argument(
'--output', type=str, help=
'path to the optional output text file')
111 parser.add_argument(
'--verbose',
'-v', action=
'store_true')
112 parser.add_argument(
'--noCFEheader', action=
'store_true', help=
"data without CFE header")
113 parser.add_argument(
'--instrument', type=str, help=
'hkt,oci,harp or spex')
115 args = parser.parse_args()
121 if __name__ ==
'__main__':
def read_cfe_header(filehandle, bVerbose=False)
def print_utils_version()