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

jth changes for multi burst #243

Merged
merged 3 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ The HyP3-ISCE2 plugin provides a set of workflows (accessible directly in Python
- `insar_stripmap`: A workflow for creating ALOS-1 geocoded unwrapped interferogram using ISCE2's Stripmap processing workflow
- `insar_tops`: A workflow for creating full-SLC Sentinel-1 geocoded unwrapped interferogram using ISCE2's TOPS processing workflow
- `insar_tops_burst`: A workflow for creating burst-based Sentinel-1 geocoded unwrapped interferogram using ISCE2's TOPS processing workflow
- `insar_tops_multi_burst`: A workflow for creating multi-burst Sentinel-1 geocoded unwrapped interferogram using ISCE2's TOPS processing workflow
---

To run a workflow, simply run `python -m hyp3_isce2 ++process [WORKFLOW_NAME] [WORKFLOW_ARGS]`. For example, to run the `insar_tops_burst` workflow:
Expand All @@ -27,7 +26,7 @@ python -m hyp3_isce2 ++process insar_tops_burst \
and, for multiple burst pairs:

```
python -m hyp3_isce2 ++process insar_tops_multi_burst \
python -m hyp3_isce2 ++process insar_tops_burst \
--reference S1_136231_IW2_20200604T022312_VV_7C85-BURST S1_136232_IW2_20200604T022315_VV_7C85-BURST \
--secondary S1_136231_IW2_20200616T022313_VV_5D11-BURST S1_136232_IW2_20200616T022316_VV_5D11-BURST \
--looks 20x4 \
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ Documentation = "https://hyp3-docs.asf.alaska.edu"

[project.scripts]
insar_tops_burst = "hyp3_isce2.insar_tops_burst:main"
insar_tops_multi_burst = "hyp3_isce2.insar_tops_multi_burst:main"
insar_tops = "hyp3_isce2.insar_tops:main"
insar_stripmap = "hyp3_isce2.insar_stripmap:main"
merge_tops_bursts = "hyp3_isce2.merge_tops_bursts:main"
Expand Down
14 changes: 4 additions & 10 deletions src/hyp3_isce2/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def write(self, out_path: Path):

def check_older_granule_is_reference(reference: Union[str, Iterable], secondary: Union[str, Iterable]) -> None:
"""Checks that the reference granule(s) are older than the secondary granule(s).
This is a conventention which ensures that positive interferogram values represent motion away from the satellite.
This is a convention which ensures that positive interferogram values represent motion away from the satellite.

Args:
reference: Reference granule(s)
Expand All @@ -142,12 +142,12 @@ def check_older_granule_is_reference(reference: Union[str, Iterable], secondary:
if isinstance(secondary, str):
secondary = [secondary]

ref_dates = list(set([g[14:29] for g in reference]))
sec_dates = list(set([g[14:29] for g in secondary]))
ref_dates = list(set([g.split('_')[3] for g in reference]))
sec_dates = list(set([g.split('_')[3] for g in secondary]))
Comment on lines -145 to +146
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a style preference.

if len(ref_dates) > 1 or len(sec_dates) > 1:
raise ValueError('Reference granules must be from one date and secondary granules must be from one date.')

if not ref_dates[0] < sec_dates[0]:
if ref_dates[0] >= sec_dates[0]:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also just a style preference.

raise ValueError('Reference granules must be older than secondary granules.')


Expand Down Expand Up @@ -202,12 +202,6 @@ def make_browse_image(input_tif: str, output_png: str) -> None:
)


def oldest_granule_first(g1, g2):
if g1[14:29] <= g2[14:29]:
return g1, g2
return g2, g1


def load_isce2_image(in_path) -> tuple[isceobj.Image, np.ndarray]:
"""Read an ISCE2 image file and return the image object and array.

Expand Down
7 changes: 0 additions & 7 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,6 @@ def test_gdal_config_manager():
assert gdal.GetConfigOption('OPTION4') == 'VALUE4'


def test_oldest_granule_first():
oldest = 'S1_249434_IW1_20230511T170732_VV_07DE-BURST'
latest = 'S1_249434_IW1_20230523T170733_VV_8850-BURST'
assert utils.oldest_granule_first(oldest, latest) == (oldest, latest)
assert utils.oldest_granule_first(latest, oldest) == (oldest, latest)


def test_make_browse_image():
input_tif = 'tests/data/test_geotiff.tif'
output_png = 'tests/data/test_browse_image2.png'
Expand Down