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

v0.3.1 #159

Closed
wants to merge 74 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
ccbfa7b
dem 30 meters and draft of custom layers
cmarshak Mar 27, 2023
6346f85
select band number from isce2 outputs
cmarshak Mar 27, 2023
a3f7905
fix args for resolution
cmarshak Mar 27, 2023
50749ab
fix typo
cmarshak Mar 27, 2023
3bd3dc9
fix localize dem
cmarshak Mar 27, 2023
53d5023
fix geocode rasterio profile for 30 m
cmarshak Mar 27, 2023
f56a5a8
changelog
cmarshak Mar 28, 2023
74207b4
correct version
cmarshak Mar 28, 2023
1cf984d
fix argparse typo; argggg
cmarshak Mar 28, 2023
4711e82
add unfiltered coherence
cmarshak Mar 29, 2023
a237c11
more comments
cmarshak Mar 29, 2023
04cd8c2
include pixel offsets, units for layers, and better comments
cmarshak Mar 30, 2023
7df9cb7
include entry point for dense offsets and unfiltered coherence
cmarshak Mar 30, 2023
cd12691
ensure json determines possible layers that can be added
cmarshak Mar 30, 2023
1009e2d
remove print dataset and add spacing in join statement
cmarshak Mar 30, 2023
b133ee8
include pixel offsets in science/grids/data
cmarshak Mar 30, 2023
f7ed9e3
swap azimuth and then range
cmarshak Mar 30, 2023
a3628f8
fix standard name
cmarshak Mar 30, 2023
3001162
fix ampcor wind size
cmarshak Mar 30, 2023
247f717
merge dev
cmarshak Nov 8, 2023
d92a6f1
merge again
cmarshak Nov 8, 2023
e1c6f2f
Merge branch 'dev' into custom-event
cmarshak Nov 8, 2023
e6a434d
changelog
cmarshak Nov 8, 2023
b6510c8
Merge branch 'custom-event' of github.com:ACCESS-Cloud-Based-InSAR/Do…
cmarshak Nov 8, 2023
5cb0b18
changelog more
cmarshak Nov 8, 2023
20df9ac
fix duplicate assignments
cmarshak Nov 8, 2023
db89945
authors, dense_offsets, params
cmarshak Nov 8, 2023
15f5a58
fix json
cmarshak Nov 8, 2023
d0d21b9
add pydantic
cmarshak Nov 9, 2023
bca6847
lint
cmarshak Nov 9, 2023
79f05ce
lint import order
cmarshak Nov 9, 2023
f820bd5
fix packaging lint
cmarshak Nov 9, 2023
7ca9f8a
fix __init__ lint
cmarshak Nov 9, 2023
4695682
changelog and dense offsets packaging
cmarshak Nov 9, 2023
2bc19c2
fix res default and serialize input params
cmarshak Nov 9, 2023
59b586f
copy args dict
cmarshak Nov 9, 2023
5715462
remove breakpoint
cmarshak Nov 9, 2023
925e2d6
fix var name
cmarshak Nov 9, 2023
34f2e2d
fix goldstein filter power default
cmarshak Nov 9, 2023
b19ea58
ensure new layers are written; fix zip bug
cmarshak Nov 14, 2023
9f4279c
comment out esd turn off with iono
cmarshak Nov 14, 2023
01e4f8c
include mean metadata
cmarshak Nov 14, 2023
3907778
lint
cmarshak Nov 14, 2023
cb47289
remove esd and ionosphere control flow
cmarshak Nov 15, 2023
6498904
fix packaging metadata for 2d layers
cmarshak Nov 15, 2023
a00941f
merge dev with orbit updates
cmarshak Nov 16, 2023
ac60f76
update version
cmarshak Nov 16, 2023
77c2fb7
add back the esa credentials in parser;
cmarshak Nov 16, 2023
8e0fb6c
Merge branch 'dev' into custom-event
cmarshak Nov 16, 2023
246a15e
localize params and cmd line str
cmarshak Nov 16, 2023
6c4ee3b
update readme with standard params
cmarshak Nov 17, 2023
8589d54
update sample run
cmarshak Nov 17, 2023
7d1f189
remove wrapped phase and add comments to argparse
cmarshak Nov 17, 2023
d5ebb57
readme.md
cmarshak Nov 17, 2023
cdbf6ba
Merge branch 'dev' into custom-event
cmarshak Nov 17, 2023
484709f
update json 2d layers
cmarshak Nov 17, 2023
0583a8a
update localize-data
cmarshak Nov 17, 2023
5ef33a5
fix errant cell
cmarshak Nov 17, 2023
3233976
remove wrapped phase from params
cmarshak Nov 20, 2023
4b8054e
update packaging
cmarshak Nov 21, 2023
62179c0
lint
cmarshak Nov 21, 2023
144793d
serialize 2d layers and attrs
cmarshak Nov 21, 2023
c851c61
one comment for serialization
cmarshak Nov 21, 2023
6b0f754
fix packaging call
cmarshak Nov 21, 2023
8dce8ab
reorder main for clarity of variable inti
cmarshak Nov 21, 2023
fffddb9
fix language
cmarshak Nov 21, 2023
1d460a6
fix filter bug
cmarshak Nov 21, 2023
771782b
default arg for iono
cmarshak Nov 21, 2023
6c33e42
validate args
cmarshak Nov 21, 2023
c45888b
remove iono template
cmarshak Nov 21, 2023
c3ae958
Merge pull request #122 from ACCESS-Cloud-Based-InSAR/custom-event
cmarshak Nov 29, 2023
8c4181e
Update README.md
cmarshak Jan 9, 2024
472c51a
upgrade to hyp3lib 3
forrestfwilliams Jan 16, 2024
349c0f0
Merge pull request #160 from ACCESS-Cloud-Based-InSAR/hyp3lib
cmarshak Jan 16, 2024
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
28 changes: 27 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,32 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [PEP 440](https://www.python.org/dev/peps/pep-0440/)
and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.3.2]

### Changed
* Upgraded to `hyp3lib=>3,<4` from `>=2,<3`

## [0.3.1]

### Added
* Provides CLI options for:
- output resolution: 30 meters or 90 meters (the latter is default and the standardized GUNW resolution)
- unfiltered coherence layer (True/False)
- Goldstein filtering power - power that phase is raised to in patch FFT - default .5 (can be any number >= 0)
- Dense offsets layers (True/false)
* Codifies (in documentation and in plugin) what is meant by "standard" GUNW with respect to exposed parameters including:
- 90 m resolution
- .5 value in the Goldstein filter for InSAR phase
- No ESD or dense offsets
- Additional layers: ionosophere, SET, and unfiltered coherence.
- uses pydantic to record relevant topsapp parameters for "standard" GUNW
* Records parameters in the product including the CLI command to regenerate said product
* If parameters are not standard uses prefix `S1-GUNW_CUSTOM-...`
* Pydantic dependency for parameter accounting

### Changed
* The CLI now *requires* `frame_id` (use `frame_id = -1` for old API and what is now considered a "non"-standard product)

## [0.3.0]

### Added
Expand Down Expand Up @@ -81,7 +107,6 @@ and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

* Fixes write of start/stop sensing times due to changes in ASF Search v5.0.0 (see #79)


## [0.2.0]

### Added
Expand All @@ -95,6 +120,7 @@ and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
### Fixed
* Uses dem-stitcher>=v2.3.0, which by default, fills in `glo-30` tiles that are missing over Armenia and Azerbaijan with the available `glo-90` tiles (upsampled).
* Uses dem-stitcher>=v2.3.1 to fix URLs for `glo-30` and `srtm_v3`

## [0.1.2]

### Fixed
Expand Down
130 changes: 76 additions & 54 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DockerizedTopsApp (aka ISCE2 TopsApp Hyp3-Plugin)

This repository represents a dockerized science processor for generating an ARIA Sentinel-1 [Geocoded Unwrapped Interferogram](https://aria.jpl.nasa.gov/products/standard-displacement-products.html) (GUNW) product from a collection of valid Sentinel-1 IW-mode Single Look Complex (SLC) IDs across a date pair using [ISCE2](https://github.com/isce-framework/isce2). The GUNW is a NISAR beta-product. The initial development of the GUNW was done under the Getting Ready for NISAR initiative and a collection of related ARIA-funded projects. This work has continued under the Project Enabling Cloud-Based InSAR Science for an Exploding NASA InSAR Data Archive (ACCESS19-0023) funded under the ACCESS program.
This repository represents a dockerized science processor for generating an ARIA Sentinel-1 [Geocoded Unwrapped Interferogram](https://asf.alaska.edu/data-sets/derived-data-sets/sentinel-1-interferograms/) (ARIA-S1-GUNW) product from a collection of valid Sentinel-1 IW-mode Single Look Complex (SLC) IDs across a date pair using [ISCE2](https://github.com/isce-framework/isce2). The ARIA-S1-GUNW (or simply a GUNW) is an official NASA product. The initial development of the GUNW was done under the Getting Ready for NISAR initiative and a collection of related ARIA-funded projects. This work has continued under the Project Enabling Cloud-Based InSAR Science for an Exploding NASA InSAR Data Archive (ACCESS19-0023) funded under the ACCESS program. A description of the product can be found here: https://aria.jpl.nasa.gov/products/standard-displacement-products.html

This processor plugs into the [HyP3](https://hyp3-docs.asf.alaska.edu/v2-transition/) platform and therefore can spawn processing at scale from an API. All of the necessary datasets required for processing are determined from the input SLC IDS and then downloaded from public APIs. Thus, this repository accomplishes two goals:

Expand Down Expand Up @@ -37,68 +37,92 @@ We note all the input datasets are publicly available using a NASA Earthdata acc
```
The first `username`/`password` pair are the appropriate Earthdata Login credentials that are used to access NASA data. The second pair are your credentials for the [Copernicus Data Space Ecosystem](https://dataspace.copernicus.eu). This file is necessary for downloading the Sentinel-1 files, and auxiliary data. Additionally, the [`requests`](https://docs.python-requests.org/en/latest/) library automatically uses credentials stored in the `~/.netrc` for authentification when none are supplied.

## Generate a GUNW
## Generate an ARIA-S1-GUNW

Make sure you have `~/.netrc`. Run the following command:
Make sure you have `~/.netrc` as described above. Run the following command:

```
isce2_topsapp --reference-scenes S1B_IW_SLC__1SDV_20210723T014947_20210723T015014_027915_0354B4_B3A9 \
--secondary-scenes S1B_IW_SLC__1SDV_20210711T014922_20210711T014949_027740_034F80_859D \
S1B_IW_SLC__1SDV_20210711T014947_20210711T015013_027740_034F80_D404 \
S1B_IW_SLC__1SDV_20210711T015011_20210711T015038_027740_034F80_376C
isce2_topsapp --reference-scenes S1A_IW_SLC__1SDV_20220212T222803_20220212T222830_041886_04FCA3_2B3E \
S1A_IW_SLC__1SDV_20220212T222828_20220212T222855_041886_04FCA3_A3E2 \
--secondary-scenes S1A_IW_SLC__1SDV_20220131T222803_20220131T222830_041711_04F690_8F5F \
S1A_IW_SLC__1SDV_20220131T222828_20220131T222855_041711_04F690_28D7 \
--frame-id 25502
```
Add `> topsapp_img.out 2> topsapp_img.err` to avoid unnecessary output to your terminal and record the stdout and stderr as files.
This is reflected in the [`sample_run.sh`](sample_run.sh).

To be even more explicity, you can use [`tee`](https://en.wikipedia.org/wiki/Tee_(command)) to record output to both including `> >(tee -a topsapp_img.out) 2> >(tee -a topsapp_img.err >&2)`.

## Customizations
## What makes an ARIA-S1-GUNW Product *standard*?

### Estimating Ionospheric Phase Delay and ESD
Each ARIA-S1-GUNW at the ASF that ensures that down-stream analysis by [ARIA-Tools](https://github.com/aria-tools/ARIA-tools) and [Mintpy](https://github.com/insarlab/MintPy) is done consistently and reproducibly. There are a number of exposed parameters in this plugin that we require to be set in a certain manner for a product to be considered "standard". We now discuss the standard parameters with respect to this plugin.

This example shows how to obtain a layer with ionsopheric phase delay. The SLCs are over the Arabian peninusula where the ionosphere can be seen:
Since v3+, in addition to reference and secondary scenes, a `frame-id` must be supplied for a *standard* product to be generated. This effectively restricts processing and the resulting product to be within this frame (technically, all bursts within the frame are included in the standard product). The geojson of spatially-fixed frames with their ids can be downloaded [here](https://github.com/ACCESS-Cloud-Based-InSAR/DockerizedTopsApp/blob/dev/isce2_topsapp/data/s1_frames_latitude_aligned.geojson.zip). These are derived from ESA's burst [map](https://sar-mpc.eu/test-data-sets/). More information about finding SLC pairs and their corresponding pairs can be found [here](https://github.com/ACCESS-Cloud-Based-InSAR/s1-frame-enumerator) and the generation of our spatially fixed-frames is discussed [here](https://github.com/ACCESS-Cloud-Based-InSAR/s1-frame-generation).

```
isce2_topsapp --reference-scenes S1B_IW_SLC__1SDV_20171117T145926_20171117T145953_008323_00EBAB_AFB8 \
--secondary-scenes S1A_IW_SLC__1SDV_20171111T150004_20171111T150032_019219_0208AF_EE89 \
--estimate-ionosphere-delay True \
--esd-coherence-threshold .5 \
> topsapp_img.out 2> topsapp_img.err
```
Not including `--esd-coherence-threshold` means no ESD correction will be applied. The ESD threshold refers to a coherence value and therefore must be in $[0, 1]$.
All standard products have the following layers:
+ Data Layers (0.00083333333 deg or ~90 m at the equator)
+ Unwrapped phase
+ Coherence
+ Connected compenents
+ Unfiltered coherence - *new* in version 3❗
+ InSAR amplitude
+ Correction Layers
+ Ionosphere (0.00916 deg or ~1 km at the equator) - *new* in version 3❗
+ Solid earth tide (.1 deg or ~11 km at the equator) - *new* in version 3❗
+ Tropo correction layers if HRRR available (see [RAiDER](https://github.com/dbekaert/RAiDER)) - new in version 3❗
+ Geometry Layers (.1 deg or ~11 km)
+ Incidence angle
+ Azimuth angle
+ Parallel baseline
+ Perpendicular baseline
+ Lat/lon grids

### Apply Solid Earth Tide Correction
Again, tropo corrections are controlled via a separate step-function so is not included above. The repository is [here](https://github.com/dbekaert/RAiDER). Turning off certain layers or adding available layers using the CLI arguments are permissible but will produce *custom* products (indicated with a prefix `S1-GUNW_CUSTOM...`). The parameters are often simply exposing certain topsApp parameters discussed [here](https://github.com/isce-framework/isce2/blob/main/applications/topsApp.py). Our template for topsapp that is utilized for ISCE is found [here](https://github.com/ACCESS-Cloud-Based-InSAR/DockerizedTopsApp/blob/dev/isce2_topsapp/templates/topsapp_template.xml).

```
isce2_topsapp --reference-scenes S1B_IW_SLC__1SDV_20210723T014947_20210723T015014_027915_0354B4_B3A9 \
--secondary-scenes S1B_IW_SLC__1SDV_20210711T014922_20210711T014949_027740_034F80_859D \
S1B_IW_SLC__1SDV_20210711T014947_20210711T015013_027740_034F80_D404 \
S1B_IW_SLC__1SDV_20210711T015011_20210711T015038_027740_034F80_376C \
--compute-solid-earth-tide True \
> topsapp_img_set.out 2> topsapp_img_set.err
```
The command line string and relevant plugin version used to generate every product is included in the product itself and can be used to reproduce a product. These are attributes in the top level netcdf group.

We note that the ionosphere correction layer is the (hard) work of [Marin Govorcin](https://github.com/mgovorcin) and David Bekaert, which utilizes ISCE2 in a creative fashion. Users should refer to [this file](https://github.com/ACCESS-Cloud-Based-InSAR/DockerizedTopsApp/blob/dev/isce2_topsapp/iono_proc.py) for the process.

### Using "fixed frames" (experimental)
Below indicates all available arguments for product generation and parameters required for *standard product* generation (again, for a given pairing and frame, one must use the enumeration of pairs described [here](https://github.com/ACCESS-Cloud-Based-InSAR/s1-frame-enumerator)). Use `isce2_topsapp --help` for more information of available arguments.

Sentinel-1 Frames are not constant over passes. We generate fixed frames [here](https://github.com/ACCESS-Cloud-Based-InSAR/s1-frame-generation) and enumerate interferograms using this [repo](https://github.com/ACCESS-Cloud-Based-InSAR/s1-frame-enumerator). This is highly experimental. We then ensure ISCE processes only over the frame. The key is overlap. We provide some examples of the additional options (you will need to run this in *two* separate directories because ISCE2 outputs are organized with respect to the working directory of the processing). For one frame over CA:
```
isce2_topsapp --reference-scenes S1A_IW_SLC__1SDV_20230125T135954_20230125T140021_046941_05A132_D35C \
S1A_IW_SLC__1SDV_20230125T140019_20230125T140046_046941_05A132_82DF \
--secondary-scenes S1A_IW_SLC__1SDV_20221220T135956_20221220T140023_046416_058F77_B248 \
S1A_IW_SLC__1SDV_20221220T140020_20221220T140047_046416_058F77_5213 \
--frame-id 22438 \
> topsapp_img_f22438.out 2> topsapp_img_f22438.err
isce2_topsapp --reference-scenes S1A_IW_SLC__1SDV_20220212T222803_20220212T222830_041886_04FCA3_2B3E \
S1A_IW_SLC__1SDV_20220212T222828_20220212T222855_041886_04FCA3_A3E2 \
--secondary-scenes S1A_IW_SLC__1SDV_20220131T222803_20220131T222830_041711_04F690_8F5F \
S1A_IW_SLC__1SDV_20220131T222828_20220131T222855_041711_04F690_28D7 \
--frame-id 25502 # latitude aligned ARIA spatially fixed frame\
--estimate-ionosphere-delay True # ionosphere correction layers\
--esd-coherence-threshold -1. # if -1, ESD is not used; else should be a value in (0, 1)\
--compute_solid_earth_tide True \
--goldstein-filter-power 0.5 # the power of the patch FFT filter used in the Goldstein filter\
--output-resolution 90 # either 30 or 90 meters\
--unfiltered-coherence True # this adds an unfiltered coherence layer\
--dense-offsets False # adds layers that compute patch wise correlation measurement done in range and azimuth which are helpful after significant surface changes\
```
and an overlapping frame:
or as a json:
```
isce2_topsapp --reference-scenes S1A_IW_SLC__1SDV_20230125T140019_20230125T140046_046941_05A132_82DF \
S1A_IW_SLC__1SDV_20230125T140044_20230125T140111_046941_05A132_59E7 \
--secondary-scenes S1A_IW_SLC__1SDV_20221220T140020_20221220T140047_046416_058F77_5213 \
S1A_IW_SLC__1SDV_20221220T140045_20221220T140112_046416_058F77_7692 \
--frame-id 22439 \
> topsapp_img_f22439.out 2> topsapp_img_f22439.err
{
"reference_scenes": [
"S1A_IW_SLC__1SDV_20220212T222803_20220212T222830_041886_04FCA3_2B3E",
"S1A_IW_SLC__1SDV_20220212T222828_20220212T222855_041886_04FCA3_A3E2"
],
"secondary_scenes": [
"S1A_IW_SLC__1SDV_20220131T222803_20220131T222830_041711_04F690_8F5F",
"S1A_IW_SLC__1SDV_20220131T222828_20220131T222855_041711_04F690_28D7"
],
"frame_id": 25502,
"estimate_ionosphere_delay": true,
"compute_solid_earth_tide": true,
"output_resolution": 90,
"unfiltered_coherence": true,
"goldstein_filter_power": 0.5,
"dense_offsets": false,
"wrapped_phase_layer": false,
"esd_coherence_threshold": -1.0
}
```


# Running with Docker (locally or on a server)

1. When running locally with root privileges (i.e. at your local workstation), build the docker image using:
Expand All @@ -113,14 +137,11 @@ isce2_topsapp --reference-scenes S1A_IW_SLC__1SDV_20230125T140019_20230125T14004
3. Create a directory to mount the data files so you can inspect them outside of your docker container. Call it `topsapp_data`. Navigate to it. Copy the `sample_run.sh` in this directory, modifying it to add your Earthdata username and password e.g.

```
isce2_topsapp --username <username> \
--password <password> \
--esa-username <esa-username> \
--esa-password <esa-password> \
--reference-scenes S1B_IW_SLC__1SDV_20210723T014947_20210723T015014_027915_0354B4_B3A9 \
--secondary-scenes S1B_IW_SLC__1SDV_20210711T014922_20210711T014949_027740_034F80_859D \
S1B_IW_SLC__1SDV_20210711T014947_20210711T015013_027740_034F80_D404 \
S1B_IW_SLC__1SDV_20210711T015011_20210711T015038_027740_034F80_376C \
isce2_topsapp --reference-scenes S1A_IW_SLC__1SDV_20220212T222803_20220212T222830_041886_04FCA3_2B3E \
S1A_IW_SLC__1SDV_20220212T222828_20220212T222855_041886_04FCA3_A3E2 \
--secondary-scenes S1A_IW_SLC__1SDV_20220131T222803_20220131T222830_041711_04F690_8F5F \
S1A_IW_SLC__1SDV_20220131T222828_20220131T222855_041711_04F690_28D7 \
--frame-id 25502 \
> topsapp_img.out 2> topsapp_img.err
```

Expand All @@ -140,10 +161,11 @@ Create a new directory (for all the intermediate files) and navigate to it.

```
docker run -ti -v $PWD:/home/ops/topsapp_data topsapp_img \
--reference-scenes S1B_IW_SLC__1SDV_20210723T014947_20210723T015014_027915_0354B4_B3A9 \
--secondary-scenes S1B_IW_SLC__1SDV_20210711T014922_20210711T014949_027740_034F80_859D \
S1B_IW_SLC__1SDV_20210711T014947_20210711T015013_027740_034F80_D404 \
S1B_IW_SLC__1SDV_20210711T015011_20210711T015038_027740_034F80_376C \
--reference-scenes S1A_IW_SLC__1SDV_20220212T222803_20220212T222830_041886_04FCA3_2B3E \
S1A_IW_SLC__1SDV_20220212T222828_20220212T222855_041886_04FCA3_A3E2 \
--secondary-scenes S1A_IW_SLC__1SDV_20220131T222803_20220131T222830_041711_04F690_8F5F \
S1A_IW_SLC__1SDV_20220131T222828_20220131T222855_041711_04F690_28D7 \
--frame-id 25502 \
--username <username>
--password <password>
--esa-username <esa-username> \
Expand Down
Loading
Loading