Skip to content

Commit

Permalink
isce_utils.extract_multilook_number(): search XML and VRT files (#1068
Browse files Browse the repository at this point in the history
)

+ `utils.isce_utils.extract_multilook_number()`: improve robustness against the occasionally missing *.full.xml files for hgt/lat/lon/los during the isce2/topsStack processing by:
   - add shadowMask to the potential data file list
   - search both *.full.xml and *.full.vrt file

+ version: add version 1.5.2 tag
  • Loading branch information
yunjunz authored Aug 9, 2023
1 parent 559b8d7 commit 29d901d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
31 changes: 20 additions & 11 deletions src/mintpy/utils/isce_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,21 +455,30 @@ def load_track(trackDir, dateStr):

##################################### geometry #######################################
def extract_multilook_number(geom_dir, meta=dict(), fext_list=['.rdr','.geo','.rdr.full','.geo.full']):
for fbase in ['hgt','lat','lon','los']:
for fbase in ['hgt','lat','lon','los','shadowMask']:
fbase = os.path.join(geom_dir, fbase)

# get the file name of the geometry file of interest
for fext in fext_list:
fnames = glob.glob(fbase+fext)
if len(fnames) > 0:
break

if len(fnames) > 0:
fullXmlFile = f'{fnames[0]}.full.xml'
if os.path.isfile(fullXmlFile):
fullXmlDict = readfile.read_isce_xml(fullXmlFile)
xmlDict = readfile.read_attribute(fnames[0])
meta['ALOOKS'] = int(int(fullXmlDict['LENGTH']) / int(xmlDict['LENGTH']))
meta['RLOOKS'] = int(int(fullXmlDict['WIDTH']) / int(xmlDict['WIDTH']))
break
fname = fnames[0]

# get the file name of the full resolution metadata file
full_meta_files = [f'{fname}.full.xml', f'{fname}.full.vrt']
full_meta_files = [x for x in full_meta_files if os.path.isfile(x)]
if len(full_meta_files) > 0:
full_meta_file = full_meta_files[0]

# calc A/RLOOKS
if full_meta_file.endswith('.xml'):
full_dict = readfile.read_isce_xml(full_meta_file)
else:
full_dict = readfile.read_gdal_vrt(full_meta_file)
mli_dict = readfile.read_attribute(fname)
meta['ALOOKS'] = int(int(full_dict['LENGTH']) / int(mli_dict['LENGTH']))
meta['RLOOKS'] = int(int(full_dict['WIDTH']) / int(mli_dict['WIDTH']))
break

# default value
for key in ['ALOOKS', 'RLOOKS']:
Expand Down
1 change: 1 addition & 0 deletions src/mintpy/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
###########################################################################
Tag = collections.namedtuple('Tag', 'version date')
release_history = (
Tag('1.5.2', '2023-08-09'),
Tag('1.5.1', '2023-01-03'),
Tag('1.5.0', '2022-11-18'),
Tag('1.4.1', '2022-08-15'),
Expand Down

0 comments on commit 29d901d

Please sign in to comment.