Skip to content

Commit dca05e0

Browse files
authored
Add a dolphin geocode CLI tool to deocode radar-coordinate results (#684)
* Add a radar geocoding module + cli * Add tests, and add isce2 detection * Add docs on geocoding to a How To guide
1 parent 3490079 commit dca05e0

File tree

8 files changed

+1225
-4
lines changed

8 files changed

+1225
-4
lines changed

docs/faq.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
## Frequently Asked Questions
2+
3+
### 1. What's the sign convention of the line-of-sight data?
4+
5+
**Summary**:
6+
7+
- In the `timeseries/` folder, positive means motion *toward* the sensor, and negative means motion *away* from the sensor.
8+
- In the `interferograms/` folder, the sign is flipped and positive phase means motion *away* from the sensor.
9+
10+
`dolphin` follows similar sign conventions to other InSAR software such as isce2 and MintPy.
11+
Inteferograms in `dolphin` are formed as `reference_slc * conj(secondary_slc)`. The phase of the complex values in the `interferograms/` folder indicates an increase in the line-of-sight (LOS) direction from the sensor, while a negative value indicates a decrease (motion towards the sensor).
12+
13+
After unwrapping, the sign convention is flipped and converted to meters (if the `wavelength` parameter is set) for the outputs in the `timeseries` folder.
14+
Assuming the `wavelength` parameter is set, the unwrapped phase is multiplied by $-4\pi / \lambda$, so positive values in the timeseries rasters indicate motion *toward* the sensor, and negative values indicate motion *away* from the sensor. Thus, when combining two LOS rasters from ascending and descending geometries, postive values in both indicate that uplift is occurring.
15+
16+
Note that `dolphin` is able to process coregistered SLCs from arbitrary processing software, and does not always attempt to guess what sensor the SLCs are derived from. If the `wavelength` (within the `input_options` group) is not set in during configuration, the outputs in the `timeseries` folder will remain in radians, but keep the same sign convention (positive = motion toward the sensor).
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# How to geocode dolphin results (ISCE2 / ISCE3)
2+
3+
After running dolphin on radar-geometry data processed with ISCE2 or ISCE3, the
4+
outputs (interferograms, unwrapped phase, time series, velocity) are still in
5+
swath/radar coordinates. The `dolphin geocode` command transforms them to
6+
geographic coordinates using per-pixel latitude/longitude arrays from ISCE's
7+
geometry products.
8+
9+
It auto-detects the geolocation file naming convention:
10+
11+
| Processor | Geometry directory | Lat file | Lon file |
12+
| ------------------- | ------------------------ | --------- | --------- |
13+
| ISCE3 / dolphin | `geometry/` | `y.tif` | `x.tif` |
14+
| ISCE2 topsStack | `merged/geom_reference/` | `lat.rdr` | `lon.rdr` |
15+
| ISCE2 stripmapStack | `geom_reference/` | `lat.rdr` | `lon.rdr` |
16+
17+
## Bulk geocode a dolphin work directory
18+
19+
The simplest way to geocode all outputs at once. This discovers rasters in
20+
`timeseries/`, `unwrapped/`, etc. and writes geocoded results to
21+
`<dolphin-dir>/geocoded/`, mirroring the directory structure.
22+
23+
```bash
24+
dolphin geocode \
25+
-d ./dolphin_output \
26+
-g ./geometry \
27+
-c dolphin_config.yaml
28+
```
29+
30+
The `-c` flag reads `output_options.strides` from your config so the
31+
geolocation arrays (which are at full resolution) are properly subsampled to
32+
match your multilooked outputs.
33+
34+
## ISCE2 topsStack example
35+
36+
```bash
37+
dolphin geocode \
38+
-d ./dolphin_output \
39+
-g ./merged/geom_reference \
40+
-c dolphin_config.yaml
41+
```
42+
43+
## ISCE2 stripmapStack example
44+
45+
```bash
46+
dolphin geocode \
47+
-d ./dolphin_output \
48+
-g ./geom_reference \
49+
-c dolphin_config.yaml
50+
```
51+
52+
## Geocode specific files
53+
54+
You can also pass individual files instead of a whole directory:
55+
56+
```bash
57+
# Single file
58+
dolphin geocode -i velocity.tif -g geometry/
59+
60+
# Multiple files to an output directory
61+
dolphin geocode \
62+
-i timeseries/velocity.tif \
63+
-i unwrapped/20220101_20220201.unw.tif \
64+
-g geometry/ \
65+
-o geocoded/
66+
```
67+
68+
## Reproject to UTM with a specific pixel spacing
69+
70+
```bash
71+
dolphin geocode \
72+
-d ./dolphin_output \
73+
-g ./geometry \
74+
-c dolphin_config.yaml \
75+
--srs 32610 \
76+
-s 30
77+
```
78+
79+
This reprojects to UTM zone 10N (EPSG:32610) with 30-meter pixel spacing.
80+
81+
## Apply a mask during geocoding
82+
83+
Pass a binary mask (0 = invalid, nonzero = valid) to mark pixels as nodata in
84+
the geocoded output. The mask can be at the strided resolution or at full
85+
resolution (it will be subsampled automatically if strides are set).
86+
87+
```bash
88+
dolphin geocode \
89+
-i velocity.tif \
90+
-g geometry/ \
91+
-c dolphin_config.yaml \
92+
--mask water_mask.tif
93+
```
94+
95+
## Include additional products
96+
97+
By default, bulk mode geocodes time series and unwrapped interferograms. Use
98+
flags to include more:
99+
100+
```bash
101+
dolphin geocode \
102+
-d ./dolphin_output \
103+
-g ./geometry \
104+
--include-interferograms \
105+
--include-auxiliary
106+
```
107+
108+
| Flag | What it adds |
109+
| -------------------------- | ------------------------------------------------------------------ |
110+
| `--include-unwrapped` | Unwrapped interferograms (on by default) |
111+
| `--include-interferograms` | Wrapped interferograms, similarity, temporal/multilooked coherence |
112+
| `--include-auxiliary` | CRLB, amplitude dispersion |
113+
114+
## Parallel processing
115+
116+
Geocoding is parallelized across files. Control the number of workers with `-j`:
117+
118+
```bash
119+
dolphin geocode -d ./dolphin_output -g ./geometry -j 4
120+
```

docs/how-to-guides.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# How-to Guides
2+
3+
- [How to geocode dolphin results (ISCE2 / ISCE3)](./how-to-geocode-radar-results.md)

docs/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
1. [Getting started](./getting-started.md)
99
1. [Overview of processing modules](./overview.md)
1010
1. [Tutorials](tutorials.md)
11+
1. [How-To Guides](how-to-guides.md)
12+
1. [FAQ](faq.md)
1113
1. [Code Reference](reference/summary.md)
1214
1. [Changelog](changelog.md)
13-
<!-- 1. [How-To Guides](how-to-guides.md) -->
14-
<!-- 1. [Background theory](background-theory.md) -->

mkdocs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ nav:
6161
# - Tutorials:
6262
# - Notebook page: notebooks/walkthrough-basic.ipynb
6363
# # - Notebook page2: notebooks/walkthrough-basic.html
64-
# - how-to-guides.md
64+
- how-to-guides.md
65+
- faq.md
6566
# https://mkdocstrings.github.io/recipes/#generate-a-literate-navigation-file
6667
# trailing slash: that mkdocs-literate-nav knows a summary.md file is in that folder.
6768
- developer-setup.md
6869
- Code Reference: reference/
69-
# - background-theory.md

src/dolphin/cli.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ def main() -> int:
1717
import tyro
1818

1919
from dolphin.filtering import filter_rasters
20+
from dolphin.geocode import run as run_geocode
2021
from dolphin.timeseries import run as run_timeseries
2122
from dolphin.unwrap import run as run_unwrap
2223
from dolphin.workflows._cli_config import ConfigCli
@@ -28,6 +29,7 @@ def main() -> int:
2829
"unwrap": run_unwrap,
2930
"timeseries": run_timeseries,
3031
"filter": filter_rasters,
32+
"geocode": run_geocode,
3133
},
3234
prog=__package__,
3335
)

0 commit comments

Comments
 (0)