3 Wrapper program to produce MODIS GEO files.
6 from shlex
import quote
16 Driver function for the program.
21 parser = argparse.ArgumentParser(prog=
"modis_GEO")
22 parser.add_argument(
'--version', action=
'version', version=
'%(prog)s ' + version)
23 parser.add_argument(
"filename", nargs=
'?',
24 help=
"Input L1A file", metavar=
"L1AFILE")
25 parser.add_argument(
"-p",
"--parfile",
26 help=
"Parameter file containing program inputs", metavar=
"PARFILE")
27 parser.add_argument(
"-o",
"--output",
28 help=
"Output GEO filename - defaults to '(A|T)YYYYDDDHHMMSS.GEO'", metavar=
"GEOFILE")
29 parser.add_argument(
"--att1",
30 help=
"Input attitude filename 1 (chronological)", metavar=
"ATT1")
31 parser.add_argument(
"--att2",
32 help=
"Input attitude filename 2 (chronological)", metavar=
"ATT2")
33 parser.add_argument(
"--att3",
34 help=
"Input attitude filename 3 (chronological)", metavar=
"ATT3")
35 parser.add_argument(
"--eph1",
36 help=
"Input ephemeris filename 1 (chronological)", metavar=
"EPH1")
37 parser.add_argument(
"--eph2",
38 help=
"Input ephemeris filename 2 (chronological)", metavar=
"EPH2")
39 parser.add_argument(
"--eph3",
40 help=
"Input ephemeris filename 3 (chronological)", metavar=
"EPH3")
41 ancdb_help_text =
"Use a custom filename for ancillary database. If " \
42 "full path not given, ANCDB is assumed to exist "\
43 "(or will be created) under " + \
44 anc_utils.DEFAULT_ANC_DIR_TEXT +
"/log/. If " + \
45 anc_utils.DEFAULT_ANC_DIR_TEXT +
"/log/ does not " \
46 "exist, ANCDB is assumed (or will be created) " \
47 "under the current working directory"
48 parser.add_argument(
"--ancdb",
49 help=ancdb_help_text, metavar=
"ANCDB",default=
'ancillary_data.db')
50 parser.add_argument(
"--ancdir",
51 help=
"Use a custom directory tree for ancillary files", metavar=
"ANCDIR")
52 parser.add_argument(
"-c",
"--curdir", action=
"store_true",
53 default=
False, help=
"Download ancillary files directly into current working directory")
54 parser.add_argument(
"-r",
"--refreshDB", action=
"store_true", default=
False,
55 help=
"Remove existing database records and re-query for ancillary files")
56 parser.add_argument(
"-f",
"--force-download", action=
"store_true", dest=
'force', default=
False,
57 help=
"Force download of ancillary files, even if found on hard disk")
58 parser.add_argument(
"--disable-download", action=
"store_false", default=
True,
59 help=
"Disable download of ancillary files not found on hard disk")
60 parser.add_argument(
"--timeout", type=float, default=10.0, metavar=
"TIMEOUT",
61 help=
"set the network timeout in seconds")
62 parser.add_argument(
"--threshold", type=float, default=95.0,
63 help=
"percentage of geo-populated pixels required to pass geocheck validation test",
65 parser.add_argument(
"-d",
"--enable-dem", action=
"store_true", default=
False,
66 help=
"Enable MODIS terrain elevation correction")
67 parser.add_argument(
"-v",
"--verbose", action=
"count",
68 default=0, help=
"print status messages")
69 parser.add_argument(
"--log", action=
"store_true",
70 default=
False, help=
"Save processing log file(s)")
73 args = parser.parse_args()
75 if args.parfile
is None and args.filename
is None:
81 parfile = quote(args.parfile)
85 outputfile = quote(args.output)
88 m = modisGEO.modis_geo(filename=quote(args.filename),
97 terrain=args.enable_dem,
98 geothresh=args.threshold,
102 refreshDB=args.refreshDB,
104 download=args.disable_download,
106 verbose=args.verbose,
107 timeout=args.timeout)
116 print (
"Failed to identify/retrieve attitude/ephemeris required to geolocate %s; exiting." % args.filename)
122 if __name__ ==
"__main__":