Go to the documentation of this file.
15 Runs l1bgen_modis for a single Level 1A granule
16 A MODIS Aqua or Terra Level 1B granule is produced from a L1A file.
18 This script is a wrapper for MODIS L1A to L1B processing:
20 -calls the modis_timestamp binary to determine platform & start time
21 -constructs the PCF file
22 -calls the l1bgen_modisa or l1bgen_modist binary
23 -checks exit status from the L1B processing and cleans up if no error
64 print(
"Reading parameter file: %s" % self.
parfile)
66 param_proc.parseParFile(prog=
'l1bgen')
67 phash = param_proc.params[
'l1bgen']
68 for param
in (
list(phash.keys())):
70 self[param] = phash[param]
75 ftype, sensor = file_typer.get_file_type()
76 stime, etime = file_typer.get_file_times()
84 if not os.path.exists(self.
geofile):
87 if not os.path.exists(self.
geofile):
89 if not os.path.exists(self.
geofile):
90 geofile_parts = self.
filename.split(
'.')[:-1]
91 geofile_parts.append(
'GEO')
92 self.
geofile =
'.'.join(geofile_parts)
95 print(
"Assuming GEOFILE is %s" % self.
geofile)
99 self.__dict__[index] = item
102 return self.__dict__[index]
108 if not os.path.exists(self.
filename):
109 print(
"ERROR: File", self.
filename,
"does not exist.")
112 if not os.path.exists(self.
geofile):
113 print(
"ERROR: File", self.
geofile,
"does not exist.")
116 def _clean_files(self):
118 Removes any unwanted files from the L1A -> L1B processing.
121 ProcUtils.remove(self.
okm)
123 ProcUtils.remove(self.
hkm)
125 ProcUtils.remove(self.
qkm)
127 ProcUtils.remove(self.
obc)
129 if self.
log is False:
131 base = os.path.basename(self.
okm)
132 ProcUtils.remove(os.path.join(self.
dirs[
'run'],
133 '.'.join([
'LogReport', base])))
134 ProcUtils.remove(os.path.join(self.
dirs[
'run'],
135 '.'.join([
'LogStatus', base])))
136 ProcUtils.remove(os.path.join(self.
dirs[
'run'],
137 '.'.join([
'LogUser', base])))
141 Run l1bgen_modis (MOD_PR02)
145 print(
"Processing MODIS L1A file to L1B...")
146 l1bgen = os.path.join(self.
dirs[
'bin'],
147 ''.join([
'l1bgen_', self.
sensor]))
148 status = subprocess.run(l1bgen, shell=
False).returncode
150 print(l1bgen,
"exit status:",
str(status))
153 ProcUtils.remove(os.path.join(self.
dirs[
'run'],
"GetAttr.temp"))
154 ProcUtils.remove(os.path.join(self.
dirs[
'run'],
"ShmMem"))
155 for l1bfile
in (self.
okm, self.
hkm, self.
qkm, self.
obc):
156 if os.path.dirname(l1bfile) != self.
dirs[
'run']:
157 origfile = os.path.join(self.
dirs[
'run'],
158 os.path.basename(l1bfile))
159 if os.path.exists(origfile):
160 shutil.move(origfile, l1bfile)
161 ProcUtils.remove(
'.'.join([origfile,
'met']))
163 ProcUtils.remove(
'.'.join([l1bfile,
'met']))
168 print(
"MODIS L1B processing complete.")
171 print(
"ERROR: MODIS L1B processing failed.")
172 print(
"Please examine the LogStatus and LogUser files for more information.")
def __init__(self, inp_file=None, parfile=None, geofile=None, okm=None, hkm=None, qkm=None, obc=None, lutver=None, lutdir=None, delfiles=0, log=False, verbose=False)
list(APPEND LIBS ${PGSTK_LIBRARIES}) add_executable(atteph_info_modis atteph_info_modis.c) target_link_libraries(atteph_info_modis $
def __getitem__(self, index)
def __setitem__(self, index, item)
def get_output_name(data_files, target_program, clopts)