5 from shlex
import quote
12 if __name__ ==
"__main__":
18 parser = argparse.ArgumentParser(prog=
"modis_L1A_extract")
19 parser.add_argument(
'--version', action=
'version', version=
'%(prog)s ' + version)
21 parser.add_argument(
"filename", nargs=
'?',
22 help=
"Input L1A file to extract", metavar=
"L1AFILE")
23 parser.add_argument(
"-p",
"--parfile",
24 help=
"Parameter file containing program inputs", metavar=
"PARFILE")
25 parser.add_argument(
"-o",
"--output",
26 help=
"Output L1A extract filename - defaults to L1AFILE.sub", metavar=
"EXTRACTFILE")
27 parser.add_argument(
"-g",
"--geofile",
28 help=
"INPUT GEOFILE filename - defaults to basename of L1AFILE +'.GEO'", metavar=
"GEOFILE")
29 parser.add_argument(
"-n",
"--north", type=float,
30 help=
"Northernmost desired latitude", metavar=
"NORTH")
31 parser.add_argument(
"-s",
"--south", type=float,
32 help=
"Southernmost desired latitude", metavar=
"SOUTH")
33 parser.add_argument(
"-w",
"--west", type=float,
34 help=
"Westernmost desired longitude", metavar=
"WEST")
35 parser.add_argument(
"-e",
"--east", type=float,
36 help=
"Easternmost desired longitude", metavar=
"EAST")
37 parser.add_argument(
"--extract_geo",
38 help=
"extract geolocation filename", metavar=
"EXGEO")
39 parser.add_argument(
"--att1",
40 help=
"Input attitude filename 1 (chronological)", metavar=
"ATT1")
41 parser.add_argument(
"--att2",
42 help=
"Input attitude filename 2 (chronological)", metavar=
"ATT2")
43 parser.add_argument(
"--att3",
44 help=
"Input attitude filename 3 (chronological)", metavar=
"ATT3")
45 parser.add_argument(
"--eph1",
46 help=
"Input ephemeris filename 1 (chronological)", metavar=
"EPH1")
47 parser.add_argument(
"--eph2",
48 help=
"Input ephemeris filename 2 (chronological)", metavar=
"EPH2")
49 parser.add_argument(
"--eph3",
50 help=
"Input ephemeris filename 3 (chronological)", metavar=
"EPH3")
51 ancdb_help_text =
"Use a custom filename for ancillary database. If " \
52 "full path not given, ANCDB is assumed to exist "\
53 "(or will be created) under " + \
54 anc_utils.DEFAULT_ANC_DIR_TEXT +
"/log/. If " + \
55 anc_utils.DEFAULT_ANC_DIR_TEXT +
"/log/ does not " \
56 "exist, ANCDB is assumed (or will be created) " \
57 "under the current working directory"
58 parser.add_argument(
"--ancdb", default=
'ancillary_data.db',help=ancdb_help_text, metavar=
"ANCDB")
59 parser.add_argument(
"--ancdir",
60 help=
"Use a custom directory tree for ancillary files", metavar=
"ANCDIR")
61 parser.add_argument(
"-v",
"--verbose", action=
"store_true",
62 default=
False, help=
"print status messages")
63 parser.add_argument(
"--log", action=
"store_true",
64 default=
False, help=
"Save processing log file(s)")
66 args = parser.parse_args()
68 if args.parfile
is None and args.filename
is None:
74 parfile = quote(args.parfile)
78 geofile = quote(args.geofile)
80 ofile =
"%s.sub" % args.filename
82 ofile = quote(args.output)
84 m = ex.extract(filename=quote(args.filename),
101 g = ga.modis_geo(filename=ofile,
102 geofile=args.extract_geo,
112 verbose=args.verbose)