Skip to content

Commit 72d5459

Browse files
authored
add NISAR support to ARIA-download (#480)
* add NISAR support to ARIA-download, update readme and requirement files.
1 parent 4b0c101 commit 72d5459

File tree

4 files changed

+59
-48
lines changed

4 files changed

+59
-48
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
[![Language](https://img.shields.io/badge/python-3.9%2B-blue.svg)](https://www.python.org/)
33
[![License](https://img.shields.io/badge/License-Apache_2.0-green.svg)](https://github.com/aria-tools/ARIA-tools/blob/master/LICENSE)
44

5-
ARIA-tools is an open-source package in Python which contains tools to manipulate standard InSAR products from Sentinel-1 (ARIA GUNW-S1) and NISAR (NISAR_L2_PR_GUNW). This software is open source under the terms of the [Apache 2.0 License](LICENSE). Its development was funded under the ROSES awards from the NASA Sea-level Change Team (NSLCT) program, the Earth Surface and Interior (ESI) program, and under the NISAR Science Team (NISAR-ST) program.
5+
ARIA-tools is an open-source package in Python which contains tools to manipulate standard InSAR products from Sentinel-1 (ARIA GUNW-S1) and NISAR (NISAR_L2_GUNW). This software is open source under the terms of the [Apache 2.0 License](LICENSE). Its development was funded under the ROSES awards from the NASA Sea-level Change Team (NSLCT) program, the Earth Surface and Interior (ESI) program, and under the NISAR Science Team (NISAR-ST) program.
66

77

88
> [!IMPORTANT]
@@ -13,7 +13,7 @@ ARIA-tools is an open-source package in Python which contains tools to manipulat
1313

1414
ARIA tools includes support for:
1515
- ARIA Geocoded Unwrapped Interferogram from Sentinel-1 (GUNW-S1) can be downloaded for free from the [ASF DAAC vertex page](https://search.asf.alaska.edu/#/?dataset=SENTINEL-1%20INTERFEROGRAM%20(BETA)) selecting "ARIA S1 GUNW" under "datasets". Users can also request free on-demand products through the [ASF on-demand system](https://hyp3-docs.asf.alaska.edu/guides/gunw_product_guide/). These products are added to the standard product archive. A log-on using the NASA Earthdata credentials is required to order new or download data from the archive. [Product Specification Document](https://hyp3-docs.asf.alaska.edu/guides/gunw_product_guide/#product-packaging).
16-
- NISAR Gecoded Unwrapped Interferogram products (NISAR_L2_PR_GUNW) can be downloaded for free from the [ASF DAAC vertex page](https://search.asf.alaska.edu/#/?dataset=NISAR&prodConfig=PR&sciProducts=GUNW) selecting "NISAR" under "datasets" and selecting "GUNW" under the filter criteria. [Product Specification document](https://nisar-docs.asf.alaska.edu/gunw/).
16+
- NISAR Gecoded Unwrapped Interferogram products (NISAR_L2_GUNW) can be downloaded for free from the [ASF DAAC vertex page](https://search.asf.alaska.edu/#/?dataset=NISAR&prodConfig=PR&sciProducts=GUNW) selecting "NISAR" under "datasets" and selecting "GUNW" under the filter criteria. [Product Specification document](https://nisar-docs.asf.alaska.edu/gunw/).
1717

1818

1919
The ARIA-tools package includes functionality to crop/merge data and meta-data layers for multiple standard products, extraction of data and meta-data layers from these products, and the set-up and the preparation for time-series.
@@ -62,7 +62,7 @@ Below we list the key dependencies for ARIA-tools. See environment.yml for compl
6262
* [SciPy](https://www.scipy.org/)
6363
* [netcdf4](http://unidata.github.io/netcdf4-python/netCDF4/index.html)
6464
* [requests](https://2.python-requests.org/en/master/)
65-
* [asf_search](https://github.com/asfadmin/Discovery-asf_search) >=10.0.4
65+
* [asf_search](https://github.com/asfadmin/Discovery-asf_search) >=12.0.1
6666
```
6767

6868
### Optional Python Jupyter dependencies
@@ -194,16 +194,16 @@ The ARIA-tools scripts are highly modulized in Python and therefore allows for b
194194

195195

196196
### Commandline download of GUNW Products
197-
ARIA GUNW-S1 products can be downloaded through the commandline using the *ariaDownload.py* program, which wraps around the ASF DAAC api.
197+
ARIA GUNW-S1/NISAR_L2_GUNW products can be downloaded through the commandline using the *ariaDownload.py* program, which wraps around the ASF DAAC api.
198198

199199
### Manipulating GUNW Products
200-
ARIA GUNW-S1/NISAR_L2_PR_GUNW products can be manipulated (cropped, stitched, extracted) using the *ariaExtract.py* program.
200+
ARIA GUNW-S1/NISAR_L2_GUNW products can be manipulated (cropped, stitched, extracted) using the *ariaExtract.py* program.
201201

202202
### Baseline and quality control plots for GUNW Products
203203
ARIA GUNW-S1 quality and baseline plots for spatial-temporal contiguous interferograms can be made using the *ariaPlot.py* program.
204204

205205
### Time-series set-up of GUNW Products
206-
ARIA GUNW-S1/NISAR_L2_PR_GUNW time-series set-up with spatial-temporal contiguous unwrapped interferograms and coherence can be done using the *ariaTSsetup.py* program.
206+
ARIA GUNW-S1/NISAR_L2_GUNW time-series set-up with spatial-temporal contiguous unwrapped interferograms and coherence can be done using the *ariaTSsetup.py* program.
207207

208208
> [!NOTE]
209209
> We support extraction of correction layers (e.g. Troposphere, Ionosphere, Solid Earth Tides) as well as geometry information (e.g. incidence angle, look angle, baselines, etc) embeded within the GUNW products

environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ channels:
99
dependencies:
1010
- affine
1111
- arm_pyart
12-
- asf_search>=10.0.4
12+
- asf_search>=12.0.1
1313
- dask
1414
- dem_stitcher>=2.5.8
1515
- gdal>=3.7.0

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
affine
22
arm_pyart
3-
asf_search>=10.0.4
3+
asf_search>=12.0.1
44
dask
55
dem_stitcher>=2.5.8
66
gdal>=3.7.0

tools/bin/ariaDownload.py

Lines changed: 51 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,31 @@ def createParser():
3838
parser = argparse.ArgumentParser(
3939
description='Command line interface to download Sentinel-1/NISAR '
4040
'GUNW products from the ASF DAAC. \nDownloading them '
41-
'requires a NASA Earthdata URS user login and requires '
42-
'users to add "GRFN Door (PROD)" and "ASF Datapool '
43-
'Products" to their URS approved applications. Access '
44-
'to NISAR products requires an Earthdata Bearer token '
45-
'from: https://urs.earthdata.nasa.gov/documentation/'
46-
'for_users/user_token',
47-
epilog='Examples of use:\n'
48-
'\t ariaDownload.py --track 004 --output count\n'
49-
'\t ariaDownload.py --bbox "36.75 37.225 -76.655 -75.928"\n'
50-
'\t ariaDownload.py -t 004,077 --start 20190101 -o count'
51-
'\t ariaDownload.py --mission NISAR -o count',
41+
'requires a NASA Earthdata URS user login',
42+
epilog='Examples of use:\n\n'
43+
'\t # Count Sentinel-1 products available for track 004\n'
44+
'\t ariaDownload.py --track 004 --output count\n\n'
45+
'\t # Download Sentinel-1 products within specified '
46+
'bounding box\n'
47+
'\t ariaDownload.py --bbox "36.75 37.225 -76.655 '
48+
'-75.928"\n\n'
49+
'\t # Count Sentinel-1 products for tracks 004 & 077 '
50+
'since Jan 2019\n'
51+
'\t ariaDownload.py --mission S1 -t 004,077 '
52+
'--start 20190101 -o count\n\n'
53+
'\t # Count all available NISAR products\n'
54+
'\t ariaDownload.py --mission NISAR -o count\n\n'
55+
'\t # Download globally available descending NISAR '
56+
'products\n'
57+
'\t ariaDownload.py --mission NISAR -d d '
58+
'-b "-90 90 -180 180"\n\n'
59+
'\t # Count all available NISAR products for track 172\n'
60+
'\t ariaDownload.py --mission NISAR -t 172 -o count\n\n'
61+
'\t # Download specific NISAR interferogram '
62+
'and query the globe for it\n'
63+
'\t ariaDownload.py --mission NISAR '
64+
'-b "-90 90 -180 180" -i 20251122_20251204\n',
65+
5266
formatter_class=argparse.RawDescriptionHelpFormatter)
5367

5468
parser.add_argument(
@@ -58,33 +72,29 @@ def createParser():
5872
'aria*.py')
5973
parser.add_argument(
6074
'-t', '--track', default=None, type=str,
61-
help='track to download; single number (including leading zeros) or '
75+
help='track to download; single number or '
6276
'comma separated')
6377
parser.add_argument(
64-
'-b', '--bbox', default=None, type=str,
78+
'-b', '--bbox', default="-90 90 -180 180", type=str,
6579
help='Lat/Lon Bounding SNWE, or GDAL-readable file containing '
66-
'POLYGON geometry.')
80+
'POLYGON geometry. Default is set to global scale')
6781
parser.add_argument(
6882
'-w', '--workdir', dest='wd', default='./products', type=str,
6983
help='Specify directory to deposit all outputs. Default is "products" '
7084
'in local directory where script is launched.')
7185
parser.add_argument(
7286
'-s', '--start', default='20100101', type=str,
7387
help='Start date as YYYYMMDD; If none provided, starts at beginning '
74-
'of beta NISAR GUNW record (2010).')
88+
'of 2010.')
7589
parser.add_argument(
7690
'-e', '--end', default='21000101', type=str,
7791
help='End date as YYYYMMDD. If none provided, ends today.')
7892
parser.add_argument(
7993
'-u', '--user', default=None, type=str,
80-
help='NASA Earthdata URS user login. Users must add "GRFN Door '
81-
'(PROD)" and "ASF Datapool Products" to their URS approved '
82-
'applications.')
94+
help='NASA Earthdata URS user login.')
8395
parser.add_argument(
8496
'-p', '--pass', dest='passw', default=None, type=str,
85-
help='NASA Earthdata URS user password. Users must add "GRFN Door '
86-
'(PROD)" and "ASF Datapool Products" to their URS approved '
87-
'applications.')
97+
help='NASA Earthdata URS user password.')
8898
parser.add_argument(
8999
'--mission', default='S1', type=str.upper, choices=('S1', 'NISAR'),
90100
help='Sentinel-1 (S1) or NISAR. Default is S1')
@@ -105,15 +115,16 @@ def createParser():
105115
parser.add_argument(
106116
'-i', '--ifg', default=None, type=str,
107117
help='Retrieve one interferogram by its start/end date, specified as '
108-
'YYYYMMDD_YYYYMMDD (order independent)')
118+
'YYYYMMDD_YYYYMMDD (order independent).')
109119
parser.add_argument(
110120
'-d', '--direction', dest='flightdir', default=None, type=str,
111121
help='Flight direction, options: ascending, a, descending, d')
112122
parser.add_argument(
113123
'--version', default=None,
114124
help='Specify version as str, e.g. 2_0_4 or all prods. All products '
115125
'are downloaded by default. If version is specified, only '
116-
'products which match that version are downloaded.')
126+
'products which match that version are downloaded. '
127+
'Not supported for NISAR currently.')
117128
parser.add_argument(
118129
'-v', '--verbose', action='store_true',
119130
help='Print products to be downloaded to stdout')
@@ -175,7 +186,7 @@ def get_url_ifg(scenes):
175186
else:
176187
f = s['fileID'].split('-')
177188
pairname = f[6]
178-
ifgs.append(pairname)
189+
ifgs.append(pairname)
179190

180191
# determine if NISAR GUNW
181192
is_nisar_file = False
@@ -231,7 +242,12 @@ def __call__(self):
231242
urls, ifgs, is_nisar_file = get_url_ifg(scenes)
232243

233244
# Subset everything by version
234-
urls = url_versions(urls, self.args.version, self.args.wd)
245+
if is_nisar_file and self.args.version is not None:
246+
raise Exception(
247+
'Version support not included for NISAR, remove the critera'
248+
)
249+
else:
250+
urls = url_versions(urls, self.args.version, self.args.wd)
235251
scenes = [scene for scene, url in zip(scenes, urls) if url in urls]
236252
ifgs = [ifg for ifg, url in zip(ifgs, urls) if url in urls]
237253

@@ -242,14 +258,15 @@ def __call__(self):
242258
ifgs,
243259
is_nisar_file
244260
)
261+
245262

246263
if self.args.output == "Count":
247264
LOGGER.info("Found -- %d -- products", len(scenes))
248265
elif self.args.output == "Url":
249266
self.write_urls(urls)
250267
elif self.args.output == "Download":
251268
self.download_scenes(scenes)
252-
269+
253270
if self.args.verbose:
254271
for scene in scenes:
255272
LOGGER.info(scene.geojson()["properties"]["sceneName"])
@@ -288,27 +305,22 @@ def query_asf(self):
288305
end=end,
289306
)
290307
elif self.args.mission.upper() == "NISAR":
291-
session = asf_search.ASFSession()
292-
session.auth_with_token(getpass.getpass("EDL Token:"))
293-
LOGGER.info("Token accepted.")
294-
295-
search_opts = asf_search.ASFSearchOptions(
296-
shortName="NISAR_L2_GUNW_BETA_V1",
308+
return asf_search.geo_search(
309+
collections=["C2850261892-ASF"],
310+
dataset=asf_search.constants.NISAR,
311+
processingLevel=asf_search.constants.GUNW,
312+
relativeOrbit=tracks,
313+
flightDirection=flight_direction,
297314
intersectsWith=bbox_wkt,
298315
start=start,
299316
end=end,
300-
session=session,
301317
)
302-
scenes = asf_search.search(opts=search_opts, maxResults=250)
303-
304-
LOGGER.info("Found %d NISAR GUNW Betas.", len(scenes))
305-
return scenes
306318

307319
def filter_scenes(self, scenes, urls, ifgs, is_nisar_file):
308320
filtered_scenes, filtered_urls, filtered_ifgs = [], [], []
321+
309322
for scene, url, ifg in zip(scenes, urls, ifgs):
310323
eni, sti = self.parse_dates(ifg, is_nisar_file)
311-
312324
if self.args.ifg:
313325
if self.match_single_ifg(sti, eni):
314326
filtered_scenes.append(scene)
@@ -318,7 +330,6 @@ def filter_scenes(self, scenes, urls, ifgs, is_nisar_file):
318330
filtered_scenes.append(scene)
319331
filtered_urls.append(url)
320332
filtered_ifgs.append(ifg)
321-
322333
return filtered_scenes, filtered_urls, filtered_ifgs
323334

324335
def parse_dates(self, ifg, is_nisar_file):
@@ -442,7 +453,7 @@ def main():
442453
args.start = datetime.datetime.strptime(args.start, '%Y%m%d')
443454
args.end = datetime.datetime.strptime(args.end, '%Y%m%d')
444455

445-
if not args.track and not args.bbox and args.mission.upper() != 'NISAR':
456+
if not args.track and not args.bbox:
446457
raise Exception('Must specify either a bbox or track')
447458
Downloader(args)()
448459

0 commit comments

Comments
 (0)