diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c21841..6621ff0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ 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). +## [8.0.0] + +### Changed +* The `insar_isce_burst_job` so that it takes a `reference` and `secondary` scene as input, not `granule1` and `granule2`. + ## [7.0.1] ### Removed diff --git a/src/hyp3_sdk/hyp3.py b/src/hyp3_sdk/hyp3.py index 4f653cc..33422c5 100644 --- a/src/hyp3_sdk/hyp3.py +++ b/src/hyp3_sdk/hyp3.py @@ -4,7 +4,7 @@ from datetime import datetime, timezone from functools import singledispatchmethod from getpass import getpass -from typing import List, Literal, Optional, Union +from typing import Iterable, List, Literal, Optional, Union from urllib.parse import urljoin from warnings import warn @@ -424,16 +424,16 @@ def prepare_insar_job(cls, return job_dict def submit_insar_isce_burst_job(self, - granule1: str, - granule2: str, + reference: Union[str, Iterable[str]], + secondary: Union[str, Iterable[str]], name: Optional[str] = None, apply_water_mask: bool = False, looks: Literal['20x4', '10x2', '5x1'] = '20x4') -> Batch: """Submit an InSAR ISCE burst job. Args: - granule1: The first granule (scene) to use - granule2: The second granule (scene) to use + reference: The reference granule (older scene) to use + secondary: The secondary granule (younger scene) to use name: A name for the job apply_water_mask: Sets pixels over coastal waters and large inland waterbodies as invalid for phase unwrapping @@ -449,16 +449,16 @@ def submit_insar_isce_burst_job(self, @classmethod def prepare_insar_isce_burst_job(cls, - granule1: str, - granule2: str, + reference: Union[str, Iterable[str]], + secondary: Union[str, Iterable[str]], name: Optional[str] = None, apply_water_mask: bool = False, looks: Literal['20x4', '10x2', '5x1'] = '20x4') -> dict: """Prepare an InSAR ISCE burst job. Args: - granule1: The first granule (scene) to use - granule2: The second granule (scene) to use + reference: The reference granule (older scene) to use + secondary: The secondary granule (younger scene) to use name: A name for the job apply_water_mask: Sets pixels over coastal waters and large inland waterbodies as invalid for phase unwrapping @@ -468,11 +468,17 @@ def prepare_insar_isce_burst_job(cls, A dictionary containing the prepared InSAR ISCE burst job """ job_parameters = locals().copy() - for key in ['cls', 'granule1', 'granule2', 'name']: + for key in ['cls', 'reference', 'secondary', 'name']: job_parameters.pop(key) + if isinstance(reference, str): + reference = [reference] + + if isinstance(secondary, str): + secondary = [secondary] + job_dict = { - 'job_parameters': {'granules': [granule1, granule2], **job_parameters}, + 'job_parameters': {'reference': reference, 'secondary': secondary, **job_parameters}, 'job_type': 'INSAR_ISCE_BURST', } if name is not None: diff --git a/tests/test_hyp3.py b/tests/test_hyp3.py index 25086f8..4bfed2f 100644 --- a/tests/test_hyp3.py +++ b/tests/test_hyp3.py @@ -281,23 +281,30 @@ def test_prepare_insar_job(): def test_prepare_insar_isce_burst_job(): - assert HyP3.prepare_insar_isce_burst_job(granule1='my_granule1', granule2='my_granule2') == { + assert HyP3.prepare_insar_isce_burst_job(reference='ref_granule1', secondary='sec_granule2') == { 'job_type': 'INSAR_ISCE_BURST', 'job_parameters': { - 'granules': ['my_granule1', 'my_granule2'], + 'reference': ['ref_granule1'], + 'secondary': ['sec_granule2'], 'apply_water_mask': False, 'looks': '20x4', - } + }, } - assert HyP3.prepare_insar_isce_burst_job(granule1='my_granule1', granule2='my_granule2', name='my_name', - apply_water_mask=True, looks='10x2') == { + assert HyP3.prepare_insar_isce_burst_job( + reference=['ref_granule1', 'ref_granule2'], + secondary=['sec_granule1', 'sec_granule2'], + name='my_name', + apply_water_mask=True, + looks='10x2', + ) == { 'job_type': 'INSAR_ISCE_BURST', 'name': 'my_name', 'job_parameters': { - 'granules': ['my_granule1', 'my_granule2'], + 'reference': ['ref_granule1', 'ref_granule2'], + 'secondary': ['sec_granule1', 'sec_granule2'], 'apply_water_mask': True, 'looks': '10x2', - } + }, }