Go to the documentation of this file.
10 if __name__ ==
"__main__":
17 %(prog)s -m modisa|aqua|modist|terra -s YYYYDDDHHMMSS -e YYYYDDDHHMMSS
19 NOTE: Currently NO2 climatological data is used for OBPG operational
20 processing, so to match OBPG distributed data products, the default
21 behaviour disables NO2 searching.
23 This program queries an OBPG server and optionally downloads the optimal
24 ancillary data files for modis_GEO processing. If an input file
25 is specified the start and end times are determined automatically, otherwise
26 a start time must be provided by the user.
28 A text file (with the extension '.atteph') is created containing parameters
29 that can be directly used for optimal optimal modis_GEO processing
32 0 - all is well in the world
33 1 - predicted attitude selected
34 2 - predicted ephemeris selected
36 8 - no ephemeris found
38 12 - no att/eph files currently exist corresponding to the start
39 time and therefore no .atteph parameter text file was created
40 99 - an error was encountered; no .atteph parameter text file was created
43 parser = argparse.ArgumentParser(prog=
"modis_atteph",usage=usage)
44 parser.add_argument(
'--version', action=
'version', version=
'%(prog)s ' + version)
45 parser.add_argument(
"filename", nargs=
'?',
46 help=
"Input L1 file", metavar=
"L1FILE")
47 parser.add_argument(
"-s",
"--start",
48 help=
"Granule start time (YYYYDDDHHMMSS)",
50 parser.add_argument(
"-e",
"--stop",
51 help=
"Granule stop time (YYYYDDDHHMMSS)", metavar=
"STOP")
53 ancdb_help_text =
"Use a custom file for ancillary database. If full " \
54 "path not given, ANCDB is assumed to exist (or " \
55 "will be created) under " + ga.DEFAULT_ANC_DIR_TEXT + \
56 "/log/. If " + ga.DEFAULT_ANC_DIR_TEXT +
"/log/ does " \
57 "not exist, ANCDB is assumed (or will be created) " \
58 " under the current working directory"
60 ancdb_help_text =
"Use a custom filename for ancillary database. If " \
61 "full path not given, ANCDB is assumed to exist "\
62 "(or will be created) under " + \
63 ga.DEFAULT_ANC_DIR_TEXT +
"/log/. If " + \
64 ga.DEFAULT_ANC_DIR_TEXT +
"/log/ does not " \
65 "exist, ANCDB is assumed (or will be created) " \
66 "under the current working directory"
67 parser.add_argument(
"--ancdb", default=
'ancillary_data.db',help=ancdb_help_text, metavar=
"ANCDB")
68 parser.add_argument(
"--ancdir",
69 help=
"Use a custom directory tree for ancillary files", metavar=
"ANCDIR")
70 parser.add_argument(
"-c",
"--curdir", action=
"store_true",
71 default=
False, help=
"Download ancillary files directly into current working directory")
72 parser.add_argument(
"-r",
"--refreshDB", action=
"store_true", default=
False,
73 help=
"Remove existing database records and re-query for ancillary files")
74 parser.add_argument(
"--disable-download", action=
"store_false", dest=
"download",default=
True,
75 help=
"Disable download of ancillary files not found on hard disk")
76 parser.add_argument(
"--timeout", type=float, default=10.0, metavar=
"TIMEOUT",
77 help=
"set the network timeout in seconds")
78 parser.add_argument(
"-m",
"--mission", help=
"MODIS mission - A(qua) or T(erra)", metavar=
"MISSION")
80 parser.add_argument(
"-v",
"--verbose", action=
"count",
81 default=0, help=
"print status messages")
82 parser.add_argument(
"--noprint", action=
"store_false", default=
True,
83 help=
"Suppress printing the resulting list of files to the screen")
84 parser.add_argument(
"-f",
"--force-download", action=
"store_true", dest=
'force', default=
False,
85 help=
"Force download of ancillary files, even if found on hard disk")
87 args = parser.parse_args()
88 if args.filename
is None and (args.mission
and args.start
is None):
93 m = ga.getanc(filename=args.filename,
100 download=args.download,
101 refreshDB=args.refreshDB,
103 verbose=args.verbose,
104 timeout=args.timeout)
108 if m.sensor
is None and os.path.exists(args.filename):
110 if args.filename
and m.finddb():
112 elif args.start
and m.finddb():
118 m.locate(forcedl=args.force)
122 sys.exit(m.db_status)
def check_sensor(inp_file)