diff --git a/src/hyp3_sdk/hyp3.py b/src/hyp3_sdk/hyp3.py index 299c212..b4f3ed2 100644 --- a/src/hyp3_sdk/hyp3.py +++ b/src/hyp3_sdk/hyp3.py @@ -501,12 +501,14 @@ def prepare_insar_isce_burst_job( job_dict['name'] = name return job_dict - def submit_aria_s1_gunw_job(self, granule1: str, granule2: str, frame_id: int, name: str | None = None) -> Batch: + def submit_aria_s1_gunw_job( + self, reference: list[str], secondary: list[str], frame_id: int, name: str | None = None + ) -> Batch: """Submit an ARIA S1 GUNW job. Args: - granule1: The first granule (scene) to use - granule2: The second granule (scene) to use + reference: The name of the Sentinel-1 SLC granules to use as reference scenes for InSAR processing + secondary: The name of the Sentinel-1 SLC granules to use as secondary scenes for InSAR processing frame_id: Subset GUNW products to this frame name: A name for the job (optional) @@ -519,12 +521,14 @@ def submit_aria_s1_gunw_job(self, granule1: str, granule2: str, frame_id: int, n return self.submit_prepared_jobs(prepared_jobs=job_dict) @classmethod - def prepare_aria_s1_gunw_job(cls, granule1: str, granule2: str, frame_id: int, name: str | None = None) -> dict: + def prepare_aria_s1_gunw_job( + cls, reference: list[str], secondary: list[str], frame_id: int, name: str | None = None + ) -> dict: """Prepare an ARIA S1 GUNW job. Args: - granule1: The first granule (scene) to use - granule2: The second granule (scene) to use + reference: The name of the Sentinel-1 SLC granules to use as reference scenes for InSAR processing + secondary: The name of the Sentinel-1 SLC granules to use as secondary scenes for InSAR processing frame_id: Subset GUNW products to this frame name: A name for the job @@ -532,11 +536,11 @@ def prepare_aria_s1_gunw_job(cls, granule1: str, granule2: str, frame_id: int, n A dictionary containing the prepared ARIA S1 GUNW job """ job_parameters = locals().copy() - for key in ['cls', 'granule1', 'granule2', 'frame_id', 'name']: + for key in ['cls', 'reference', 'secondary', 'frame_id', 'name']: job_parameters.pop(key) job_dict = { - 'job_parameters': {'granules': [granule1, granule2], 'frame_id': frame_id, **job_parameters}, + 'job_parameters': {'reference': reference, 'secondary': secondary, 'frame_id': frame_id, **job_parameters}, 'job_type': 'ARIA_S1_GUNW', } if name is not None: diff --git a/tests/test_hyp3.py b/tests/test_hyp3.py index c40cdde..14226d6 100644 --- a/tests/test_hyp3.py +++ b/tests/test_hyp3.py @@ -322,20 +322,27 @@ def test_prepare_insar_isce_burst_job(): def test_prepare_aria_s1_gunw_job(): - assert HyP3.prepare_aria_s1_gunw_job(granule1='my_granule1', granule2='my_granule2', frame_id=100) == { + assert HyP3.prepare_aria_s1_gunw_job( + reference=['ref_granule1', 'ref_granule2'], secondary=['sec_granule1', 'sec_granule2'], frame_id=100 + ) == { 'job_type': 'ARIA_S1_GUNW', 'job_parameters': { - 'granules': ['my_granule1', 'my_granule2'], + 'reference': ['ref_granule1', 'ref_granule2'], + 'secondary': ['sec_granule1', 'sec_granule2'], 'frame_id': 100, }, } assert HyP3.prepare_aria_s1_gunw_job( - granule1='my_granule1', granule2='my_granule2', frame_id=100, name='my_name' + reference=['ref_granule1', 'ref_granule2'], + secondary=['sec_granule1', 'sec_granule2'], + frame_id=100, + name='my_name', ) == { 'job_type': 'ARIA_S1_GUNW', 'name': 'my_name', 'job_parameters': { - 'granules': ['my_granule1', 'my_granule2'], + 'reference': ['ref_granule1', 'ref_granule2'], + 'secondary': ['sec_granule1', 'sec_granule2'], 'frame_id': 100, }, } @@ -395,11 +402,13 @@ def test_submit_insar_isce_burst_job(get_mock_hyp3, get_mock_job): @responses.activate def test_submit_aria_s1_gunw_job(get_mock_hyp3, get_mock_job): - job = get_mock_job('ARIA_S1_GUNW', job_parameters={'granules': ['g1', 'g2'], 'frame_id': 100}) + job = get_mock_job( + 'ARIA_S1_GUNW', job_parameters={'reference': ['g1', 'g2'], 'secondary': ['g1', 'g2'], 'frame_id': 100} + ) api_response = {'jobs': [job.to_dict()]} api = get_mock_hyp3() responses.add(responses.POST, urljoin(api.url, '/jobs'), json=api_response) - batch = api.submit_aria_s1_gunw_job('g1', 'g2', 100) + batch = api.submit_aria_s1_gunw_job(['g1', 'g2'], ['g1', 'g2'], 100) assert batch.jobs[0] == job