-
Notifications
You must be signed in to change notification settings - Fork 304
Opera ztd #1486
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
Open
dbekaert
wants to merge
15
commits into
insarlab:main
Choose a base branch
from
dbekaert:opera-ztd
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Opera ztd #1486
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
eec8882
add basic entries to enable OPERA tropo support for parsing in MintPy
dbekaert dc0bcdb
first attempt on tropo_opera.py
dbekaert 0283efa
add opera functions to enable its method for tropo correction
dbekaert 16411d2
Update src/mintpy/tropo_opera.py
dbekaert c059ae8
Added subsetting instead of full file download. This speeds up drasti…
dbekaert 99acda4
fix: address review feedback (isort, memory scaling, docstring, CLI t…
dbekaert cfef017
fix: pyupgrade f-string parens + add asf_search to requirements
dbekaert 9a3cbc4
add fsspec[http] to requirements for OPERA remote subsetting
dbekaert 592494e
fsspec requires python=3.10+
yunjunz 49ea842
Implement geometry grid reprojection support for UTM TS
sssangha e6feefb
fix: remove duplicate readfile import and trailing whitespace
dbekaert d069e64
fix: sort imports (isort) in calc_zenith_delay_from_opera_file
dbekaert e3da805
Refactor calc_zenith_delay_from_opera_file parameters
sssangha b12bc2c
Fix formatting in tropo_opera.py
sssangha bba8153
Refactor code for improved readability and structure
sssangha File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,11 @@ | ||
| pip | ||
| argcomplete | ||
| asf_search>=12.0.0 | ||
| cartopy | ||
| cvxopt | ||
| dask>=1.0 | ||
| dask-jobqueue>=0.3 | ||
| fsspec[http] | ||
| h5py | ||
| joblib | ||
| lxml | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,110 @@ | ||
| #!/usr/bin/env python3 | ||
| ############################################################ | ||
| # Program is part of MintPy # | ||
| # Copyright (c) 2013, Zhang Yunjun, Heresh Fattahi # | ||
| # Author: David Bekaert, March 2026 # | ||
| ############################################################ | ||
|
|
||
|
|
||
| import os | ||
| import sys | ||
|
|
||
| from mintpy.utils.arg_utils import create_argument_parser | ||
|
|
||
| ############################################################################ | ||
| REFERENCE = """references: | ||
| Bekaert, D. et al., OPERA L4 Tropospheric Zenith Delay products | ||
| derived from ECMWF HRES model (https://www.earthdata.nasa.gov/data/catalog/asf-opera-l4-tropo-zenith-v1-1). | ||
| """ | ||
|
|
||
| DIR_DEMO = """--dir ./OPERA | ||
| Path to the directory for downloading and storing OPERA tropospheric delay | ||
| products. Files are automatically downloaded from ASF on demand. | ||
| """ | ||
|
|
||
| EXAMPLE = """example: | ||
| tropo_opera.py -f timeseries.h5 -g inputs/geometryRadar.h5 --dir ./OPERA | ||
| tropo_opera.py -f geo/geo_timeseries.h5 -g geo/geo_geometryRadar.h5 --dir ./OPERA | ||
| """ | ||
|
|
||
|
|
||
| def create_parser(subparsers=None): | ||
| synopsis = 'Tropospheric correction using OPERA Zenith Tropospheric Delays from ECMWF HRES data (https://www.earthdata.nasa.gov/data/catalog/asf-opera-l4-tropo-zenith-v1-1)' | ||
| epilog = REFERENCE + '\n' + DIR_DEMO + '\n' + EXAMPLE | ||
| name = __name__.split('.')[-1] | ||
| parser = create_argument_parser( | ||
| name, synopsis=synopsis, description=synopsis, epilog=epilog, subparsers=subparsers) | ||
| parser.add_argument('-f', '--file', dest='dis_file', required=True, | ||
| help='timeseries HDF5 file, i.e. timeseries.h5') | ||
| parser.add_argument('-g', '--geom', dest='geom_file', required=True, | ||
| help='geometry file.') | ||
| parser.add_argument('--dir','--opera-dir', dest='opera_dir', default='./OPERA', | ||
| help='directory to store downloaded OPERA delays data (default: %(default)s).') | ||
| parser.add_argument('-o', dest='cor_dis_file', | ||
| help='Output file name for tropospheric corrected timeseries.') | ||
|
|
||
| return parser | ||
|
|
||
|
|
||
| def cmd_line_parse(iargs=None): | ||
| """Command line parser.""" | ||
| # parse | ||
| parser = create_parser() | ||
| inps = parser.parse_args(args=iargs) | ||
|
|
||
| # import | ||
| from mintpy.utils import readfile | ||
|
|
||
| # check: --opera-dir (use absolute path) | ||
| inps.opera_dir = os.path.abspath(inps.opera_dir) | ||
| print('Use OPERA products at directory:', inps.opera_dir) | ||
|
|
||
| # check: exsitence of input files | ||
| for fname in [inps.dis_file, inps.geom_file]: | ||
| if fname and not os.path.isfile(fname): | ||
| raise FileNotFoundError(f'input file not exist: {fname}') | ||
|
|
||
| # check: processors & coordinates of input files | ||
| atr1 = readfile.read_attribute(inps.dis_file) | ||
| atr2 = readfile.read_attribute(inps.geom_file) | ||
| coord1 = 'geo' if 'Y_FIRST' in atr1.keys() else 'radar' | ||
| coord2 = 'geo' if 'Y_FIRST' in atr2.keys() else 'radar' | ||
| proc = atr1.get('PROCESSOR', 'isce') | ||
|
|
||
| # check: radar-coord product from gamma and roipac is not supported | ||
| if coord1 == 'radar' and proc in ['gamma', 'roipac']: | ||
| msg = f'Radar-coded file from {proc} is NOT supported!' | ||
| msg += '\n Try to geocode the time-series and geometry files and re-run with them instead.' | ||
| raise ValueError(msg) | ||
|
|
||
| # check: coordinate system must be consistent btw. displacement and geometry files | ||
| if coord1 != coord2: | ||
| n = max(len(os.path.basename(i)) for i in [inps.dis_file, inps.geom_file]) | ||
| msg = 'Input time-series and geometry file are NOT in the same coordinate!' | ||
| msg += f'\n file {os.path.basename(inps.dis_file):<{n}} coordinate: {coord1}' | ||
| msg += f'\n file {os.path.basename(inps.geom_file):<{n}} coordinate: {coord2}' | ||
| raise ValueError(msg) | ||
|
|
||
| # default: output tropo and corrected displacement file names | ||
| inps.tropo_file = os.path.join(os.path.dirname(inps.geom_file), 'OPERA.h5') | ||
| if not inps.cor_dis_file: | ||
| inps.cor_dis_file = inps.dis_file.split('.')[0] + '_OPERA.h5' | ||
|
|
||
| return inps | ||
|
|
||
|
|
||
| ############################################################################ | ||
| def main(iargs=None): | ||
| # parse | ||
| inps = cmd_line_parse(iargs) | ||
|
|
||
| # import | ||
| from mintpy.tropo_opera import run_tropo_opera | ||
|
|
||
| # run | ||
| run_tropo_opera(inps) | ||
|
|
||
|
|
||
| ############################################################################ | ||
| if __name__ == '__main__': | ||
| main(sys.argv[1:]) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.