Skip to content

Commit 29d901d

Browse files
authored
isce_utils.extract_multilook_number(): search XML and VRT files (#1068)
+ `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
1 parent 559b8d7 commit 29d901d

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

src/mintpy/utils/isce_utils.py

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -455,21 +455,30 @@ def load_track(trackDir, dateStr):
455455

456456
##################################### geometry #######################################
457457
def extract_multilook_number(geom_dir, meta=dict(), fext_list=['.rdr','.geo','.rdr.full','.geo.full']):
458-
for fbase in ['hgt','lat','lon','los']:
458+
for fbase in ['hgt','lat','lon','los','shadowMask']:
459459
fbase = os.path.join(geom_dir, fbase)
460+
461+
# get the file name of the geometry file of interest
460462
for fext in fext_list:
461463
fnames = glob.glob(fbase+fext)
462464
if len(fnames) > 0:
463-
break
464-
465-
if len(fnames) > 0:
466-
fullXmlFile = f'{fnames[0]}.full.xml'
467-
if os.path.isfile(fullXmlFile):
468-
fullXmlDict = readfile.read_isce_xml(fullXmlFile)
469-
xmlDict = readfile.read_attribute(fnames[0])
470-
meta['ALOOKS'] = int(int(fullXmlDict['LENGTH']) / int(xmlDict['LENGTH']))
471-
meta['RLOOKS'] = int(int(fullXmlDict['WIDTH']) / int(xmlDict['WIDTH']))
472-
break
465+
fname = fnames[0]
466+
467+
# get the file name of the full resolution metadata file
468+
full_meta_files = [f'{fname}.full.xml', f'{fname}.full.vrt']
469+
full_meta_files = [x for x in full_meta_files if os.path.isfile(x)]
470+
if len(full_meta_files) > 0:
471+
full_meta_file = full_meta_files[0]
472+
473+
# calc A/RLOOKS
474+
if full_meta_file.endswith('.xml'):
475+
full_dict = readfile.read_isce_xml(full_meta_file)
476+
else:
477+
full_dict = readfile.read_gdal_vrt(full_meta_file)
478+
mli_dict = readfile.read_attribute(fname)
479+
meta['ALOOKS'] = int(int(full_dict['LENGTH']) / int(mli_dict['LENGTH']))
480+
meta['RLOOKS'] = int(int(full_dict['WIDTH']) / int(mli_dict['WIDTH']))
481+
break
473482

474483
# default value
475484
for key in ['ALOOKS', 'RLOOKS']:

src/mintpy/version.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
###########################################################################
99
Tag = collections.namedtuple('Tag', 'version date')
1010
release_history = (
11+
Tag('1.5.2', '2023-08-09'),
1112
Tag('1.5.1', '2023-01-03'),
1213
Tag('1.5.0', '2022-11-18'),
1314
Tag('1.4.1', '2022-08-15'),

0 commit comments

Comments
 (0)