Skip to content

Commit 1354ec1

Browse files
ehavazliyunjunz
andauthored
Add NISAR loading and auxiliary stack support (#1487)
* Add ionosphere stack file to prep_aria arguments * bug fix for loading ARIA generated ionosphere stack * Add NISAR auxiliary stacks and improve prep_nisar grid handling * Add early validation for NISAR inputs in load_data * Refactor prep_nisar stack dispatch and interpolation setup * Remove duplicate return statement in prep_nisar.py Removed redundant return statement from the function. * populate bperp from NISAR perpendicularBaseline * import osr explicitly for raster EPSG parsing * Stop globbing DEM input for NISAR load_data * Use native GUNW mask as primary mask * support frequency selection and optional layers * fix Codacy issues in prep_nisar * fix remaining Codacy issues * fix prep_nisar docstring style * use common NISAR mask across all GUNW inputs. Read mask bits --------- Co-authored-by: Zhang Yunjun <yunjunz@outlook.com>
1 parent f02ee97 commit 1354ec1

4 files changed

Lines changed: 1258 additions & 282 deletions

File tree

src/mintpy/cli/prep_nisar.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,15 @@ def create_parser(subparsers=None):
4949
help="path to the mask (default: %(default)s).",
5050
)
5151

52+
parser.add_argument(
53+
"-freq",
54+
"--frequency",
55+
dest="frequency",
56+
choices=["auto", "A", "B"],
57+
default="auto",
58+
help="NISAR frequency to load: auto defaults to A (default: %(default)s).",
59+
)
60+
5261
parser.add_argument(
5362
"-o",
5463
"--out-dir",

src/mintpy/defaults/smallbaselineApp.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ mintpy.load.processor = auto #[isce, aria, hyp3, gmtsar, snap, gamma, roi
3030
mintpy.load.autoPath = auto #[yes / no], auto for no, use pre-defined auto path
3131
mintpy.load.updateMode = auto #[yes / no], auto for yes, skip re-loading if HDF5 files are complete
3232
mintpy.load.compression = auto #[gzip / lzf / none / default], auto for default (none/lzf for stack/geometry).
33+
mintpy.load.frequency = auto #[auto / A / B], auto for A, NISAR only
3334
##---------for ISCE only:
3435
mintpy.load.metaFile = auto #[path of common metadata file for the stack], i.e.: ./reference/IW1.xml, ./referenceShelve/data.dat
3536
mintpy.load.baselineDir = auto #[path of the baseline dir], i.e.: ./baselines

src/mintpy/load_data.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -636,11 +636,28 @@ def prepare_metadata(iDict):
636636
dem_file = iDict['mintpy.load.demFile']
637637
gunw_files = iDict['mintpy.load.unwFile']
638638
water_mask = iDict['mintpy.load.waterMaskFile']
639+
frequency = iDict.get('mintpy.load.frequency', 'auto')
640+
641+
if str(dem_file).lower() in ['auto', 'none', 'no', '']:
642+
raise ValueError(
643+
'mintpy.load.demFile is required for processor=nisar. '
644+
'Please set it to a real DEM path in the template.'
645+
)
646+
dem_file = os.path.expanduser(str(dem_file))
647+
if not os.path.isfile(dem_file):
648+
raise FileNotFoundError(
649+
f'No DEM file found for mintpy.load.demFile: {dem_file}'
650+
)
651+
652+
if len(glob.glob(str(gunw_files))) == 0:
653+
raise FileNotFoundError(
654+
f'No input GUNW files found for mintpy.load.unwFile: {gunw_files}'
655+
)
639656

640657
# run prep_*.py
641-
iargs = ['-i', gunw_files, '-d', dem_file]
658+
iargs = ['-i', gunw_files, '-d', dem_file, '--frequency', frequency]
642659

643-
if os.path.exists(water_mask):
660+
if str(water_mask).lower() not in ['auto', 'none', 'no', ''] and os.path.exists(water_mask):
644661
iargs = iargs + ['--mask', water_mask]
645662

646663
if iDict['mintpy.subset.yx']:

0 commit comments

Comments
 (0)