Go to the documentation of this file.
4 A class for determining the OBPG type of a file.
8 __author__ =
'melliott'
17 """usage: %prog [options] FILE_NAME [FILE_NAME ...]
19 The following file types are recognized:
20 Instruments: CZCS, GOCI, HICO, Landsat OLI, MODIS Aqua,
21 MODIS Terra, OCM2, OCTS, SeaWiFS, VIIRSN, VIIRSJ1
22 Processing Levels: L0 (MODIS only), L1A, L1B, L2, L3 binned,
28 Uses optparse to get the command line options & arguments.
30 cl_parser.add_option(
'-t',
'--times', action=
'store_true',
31 dest=
'times', default=
False,
32 help=
'output start and end times for the file(s)')
33 (opts, args) = cl_parser.parse_args()
38 Main function to drive the program when invoked as a program.
41 ver_msg =
' '.join([
'%prog', __version__])
42 cl_parser = optparse.OptionParser(usage=use_msg, version=ver_msg)
49 (obpg_file_type, instrument) = file_typer.get_file_type()
51 if obpg_file_type ==
'unknown':
52 if instrument !=
'unknown':
53 output =
'{0}: {1}: unknown'.format(
54 os.path.basename(fname), instrument)
56 output =
'{0}: unknown: unknown'.format(
57 os.path.basename(fname))
59 if instrument !=
'unknown':
60 output =
'{0}: {1}: {2}'.format(os.path.basename(fname),
61 instrument, obpg_file_type)
63 output =
'{0}: unknown: {1}'.format(
64 os.path.basename(fname), obpg_file_type)
66 if obpg_file_type !=
'unknown' and instrument !=
'unknown':
67 start_time, end_time = file_typer.get_file_times()
68 output +=
': {0} : {1}'.format(start_time, end_time)
70 output +=
': unable to determine file start and end times'
73 print(
'\nError! No file specified for type identification.\n')
74 cl_parser.print_help()
77 if __name__ ==
'__main__':
def process_command_line(cl_parser)