Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add prep nisar #4

Open
wants to merge 39 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
89c1611
add prep nisar
Jun 29, 2023
e054eff
Use arbitrary bounding box in lat/lon
Jun 29, 2023
a2ba92a
Use speed of light from mintpy constants
mirzaees Jun 29, 2023
dae973f
remove extra line
mirzaees Jun 29, 2023
b9910dc
Use earth radius from mintpy constants
mirzaees Jun 29, 2023
2a765a6
import constants from mintpy
mirzaees Jun 29, 2023
530ca9d
account for half a pixel difference in origin of the coordinates
Jun 30, 2023
33e017c
correct x-first to be the upper left pixel
Jul 1, 2023
7476d0f
pyupgrade: v3.7.0 → v3.8.0 (#1039)
pre-commit-ci[bot] Jul 4, 2023
ccff336
add prep_nisar to setup and __main__
yunjunz Jul 5, 2023
cb52331
Update __main__.py
yunjunz Jul 5, 2023
2115549
fix bug in gdal -> mintpy corner coordinate convention (#1034)
sssangha Jul 5, 2023
a1db4bf
pyupgrade: v3.8.0 → v3.9.0 (#1043)
pre-commit-ci[bot] Jul 11, 2023
f1fc2e9
readfile: generalize gamma LUT file ext + ~pi value handling
yunjunz Jun 20, 2023
97fcad7
bugfix in geocode.py --bbox option for gamma products
yunjunz Jun 21, 2023
3a646ae
pyupgrade: v3.9.0 → v3.10.1 (#1051)
pre-commit-ci[bot] Aug 1, 2023
fec802b
hdfeos5: calc/write latitude/longitude if missing in geometry file (#…
yunjunz Aug 1, 2023
308024a
convert coord btw. UTM and lat/lon (#1052)
yunjunz Aug 1, 2023
6cd22a7
fix the UTM_ZONE confusion (#1053)
yunjunz Aug 3, 2023
5d330ad
isce_utils: add filter_goldstein() (#1058)
yunjunz Aug 6, 2023
1c8e7a1
tsview --figsize-img & relaxed subset tmpl reading (#1059)
yunjunz Aug 6, 2023
b74fffc
`load2hdf5 --compression` & `view --faultline-min-dist` (#1062)
yunjunz Aug 7, 2023
2af3905
read_attribute: translate DATA_TYPE ci2 to float32 for roipac (#1064)
yunjunz Aug 8, 2023
0cd227b
tropo_pyaps3: bugfix for hyp3 product (#1061)
yunjunz Aug 8, 2023
6605a95
seq. closure phase: bring back spatial referencing for ARIA products …
yunjunz Aug 9, 2023
23b87d9
dep/doc: add tab completion via `argcomplete` (#1065)
yunjunz Aug 9, 2023
559b8d7
fix zero step size bug in unwrap_error_phase_closure (#1067)
yunjunz Aug 9, 2023
29d901d
`isce_utils.extract_multilook_number()`: search XML and VRT files (#1…
yunjunz Aug 9, 2023
62b369d
dep: add shapely (#1069)
yunjunz Aug 10, 2023
4f09c58
tsview: improved auto figsize for geocoded TS file (#1071)
yunjunz Aug 15, 2023
11a9020
`read_gdal`: switch back to gdal kwargs to leverage its subsetting ca…
scottstanie Aug 19, 2023
f068ec5
`view.prep_slice()`: support quoted lists of characters as inputs (#1…
yunjunz Aug 23, 2023
136e67e
`mintpy.geocode.laloStep`: support single value input (#1075)
yunjunz Aug 23, 2023
b800d64
`subset`: support hdf5 <--> binary (#1076)
yunjunz Aug 23, 2023
1493c9a
`prep_hyp3`: support burst-wide interferograms from hyp3-isce2 (#1074)
cirrusasf Aug 25, 2023
09daaac
Correct example command line
mirzaees Aug 28, 2023
7ff149b
Run `fix_typos.sh` on repo to catch spelling errors (#1082)
scottstanie Aug 30, 2023
183819d
Merge branch 'main' into prep_script_for_NISAR
yunjunz Aug 31, 2023
018ddbd
pre-commit suggestions
yunjunz Aug 31, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions src/mintpy/cli/prep_nisar.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#!/usr/bin/env python
############################################################
# Program is part of MintPy #
# Copyright (c) 2013, Zhang Yunjun, Heresh Fattahi #
# Author: Sara Mirzaee #
############################################################

import sys
import argparse

from mintpy.utils import arg_utils

############################################################
EXAMPLE = """example:
python3 ./prep_nisar.py -i 'interferograms/stitched/*.h5' -d 'dem.tiff'
"""

def _create_parser():
parser = argparse.ArgumentParser(
description="Prepare NISAR products for MintPy",
formatter_class=argparse.RawTextHelpFormatter,
epilog=EXAMPLE,
)

parser.add_argument(
"-i",
"--input-file-glob",
dest='input_glob',
type=str,
default="./interferograms/NISAR*.h5",
help="path pattern of NISAR interferograms (default: %(default)s).",
)

parser.add_argument(
"-d",
"--dem-file",
dest="dem_file",
type=str,
default="./dem.tif",
help="path to the DEM (default: %(default)s).",
)

parser.add_argument(
"-o",
"--out-dir",
dest="out_dir",
type=str,
default="./mintpy",
help="output directory (default: %(default)s).",
)

parser.add_argument(
'--force',
dest='update_mode',
action='store_false',
help='Force to overwrite all .rsc metadata files.'
)

parser = arg_utils.add_subset_argument(parser, geo=True)

return parser


def cmd_line_parse(iargs=None):
"""Create the command line parser."""
parser = _create_parser()
inps = parser.parse_args(args=iargs)

return inps

####################################################################################
def main(iargs=None):
# parse
inps = cmd_line_parse(iargs)

# import
from mintpy.prep_nisar import load_nisar

# run
load_nisar(inps)


####################################################################################
if __name__=="__main__":
main(sys.argv[1:])
5 changes: 5 additions & 0 deletions src/mintpy/defaults/auto_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,18 @@
mintpy.load.waterMaskFile = ../mask/watermask.msk
'''

AUTO_PATH_NISAR = '''##----------Default file path of NISAR products
mintpy.load.unwFile = ../interferograms/*.h5
mintpy.load.demFile = ../dem.tiff
'''

AUTO_PATH_DICT = {
'isce_tops' : AUTO_PATH_ISCE_TOPS,
'isce_stripmap' : AUTO_PATH_ISCE_STRIPMAP,
'roipac' : AUTO_PATH_ROIPAC,
'gamma' : AUTO_PATH_GAMMA,
'aria' : AUTO_PATH_ARIA,
'nisar' : AUTO_PATH_NISAR,
}

prefix = 'mintpy.load.'
Expand Down
2 changes: 1 addition & 1 deletion src/mintpy/defaults/smallbaselineApp.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ mintpy.compute.config = auto #[none / slurm / pbs / lsf ], auto for none (sam
## no - save 0% disk usage, fast [default]
## lzf - save ~57% disk usage, relative slow
## gzip - save ~62% disk usage, very slow [not recommend]
mintpy.load.processor = auto #[isce, aria, hyp3, gmtsar, snap, gamma, roipac], auto for isce
mintpy.load.processor = auto #[isce, aria, hyp3, gmtsar, snap, gamma, roipac, nisar], auto for isce
mintpy.load.autoPath = auto #[yes / no], auto for no, use pre-defined auto path
mintpy.load.updateMode = auto #[yes / no], auto for yes, skip re-loading if HDF5 files are complete
mintpy.load.compression = auto #[gzip / lzf / no], auto for no.
Expand Down
17 changes: 14 additions & 3 deletions src/mintpy/load_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from mintpy.utils import ptime, readfile, utils as ut

#################################################################
PROCESSOR_LIST = ['isce', 'aria', 'hyp3', 'gmtsar', 'snap', 'gamma', 'roipac', 'cosicorr']
PROCESSOR_LIST = ['isce', 'aria', 'hyp3', 'gmtsar', 'snap', 'gamma', 'roipac', 'cosicorr', 'nisar']

# primary observation dataset names
OBS_DSET_NAMES = ['unwrapPhase', 'rangeOffset', 'azimuthOffset']
Expand Down Expand Up @@ -601,7 +601,6 @@ def run_or_skip(outFile, inObj, box, updateMode=True, xstep=1, ystep=1, geom_obj

def prepare_metadata(iDict):
"""Prepare metadata via prep_{processor}.py scripts."""

processor = iDict['processor']
script_name = f'prep_{processor}.py'
print('-'*50)
Expand Down Expand Up @@ -631,6 +630,18 @@ def prepare_metadata(iDict):
ut.print_command_line(script_name, iargs)
# run
prep_module.main(iargs)
elif processor == 'nisar':
dem_file = iDict['mintpy.load.demFile']
gunw_files = iDict['mintpy.load.unwFile']

# run prep_*.py
iargs = ['-i', gunw_files, '-d', dem_file, '-o', '../mintpy']
ut.print_command_line(script_name, iargs)
try:
prep_module.main(iargs)
except:
warnings.warn('prep_nisar.py failed. Assuming its result exists and continue...')


elif processor == 'isce':
from mintpy.utils import isce_utils, s1_utils
Expand Down Expand Up @@ -785,7 +796,7 @@ def load_data(inps):
extraDict = get_extra_metadata(iDict)

# skip data writing for aria as it is included in prep_aria
if iDict['processor'] == 'aria':
if iDict['processor'] in ['aria', 'nisar']:
return

## 2. search & write data files
Expand Down
Loading