Skip to content

Commit

Permalink
add backwards compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
forrestfwilliams committed Aug 21, 2024
1 parent d68ed11 commit d2e0b9e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ 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`.
* The `insar_isce_burst_job` so that it takes a `reference` and `secondary` scene as input, not `granule1` and `granule2`. Backward compatibility in `submit_insar_isce_burst_job` is maintained for now.

## [7.0.1]

Expand Down
27 changes: 25 additions & 2 deletions src/hyp3_sdk/hyp3.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,8 +424,11 @@ def prepare_insar_job(cls,
return job_dict

def submit_insar_isce_burst_job(self,
reference: Union[str, Iterable[str]],
secondary: Union[str, Iterable[str]],
*args,
reference: Union[str, Iterable[str]] = None,
secondary: Union[str, Iterable[str]] = None,
granule1: Optional[str] = None,
granule2: Optional[str] = None,
name: Optional[str] = None,
apply_water_mask: bool = False,
looks: Literal['20x4', '10x2', '5x1'] = '20x4') -> Batch:
Expand All @@ -434,6 +437,8 @@ def submit_insar_isce_burst_job(self,
Args:
reference: The reference granule (older scene) to use
secondary: The secondary granule (younger scene) to use
granule1: Depreceated argument superseeded by reference
granule2: Depreceated argument superseeded by secondary
name: A name for the job
apply_water_mask: Sets pixels over coastal waters and large inland waterbodies
as invalid for phase unwrapping
Expand All @@ -444,6 +449,24 @@ def submit_insar_isce_burst_job(self,
"""
arguments = locals().copy()
arguments.pop('self')
arguments.pop('args')

if len(args) == 2:
warnings.warn("Positional arguments for submit_insar_isce_burst_job are now mapped to 'reference' and 'secondary'.", DeprecationWarning)
arguments['reference'] = args[0]
arguments['secondary'] = args[1]

if arguments['granule1']:
warnings.warn("Keyword argument 'granule1' is deprecated. Use 'reference' instead.", DeprecationWarning)
arguments['reference'] = arguments['granule1']

if arguments['granule2']:
warnings.warn("Keyword argument 'granule2' is deprecated. Use 'secondary' instead.", DeprecationWarning)
arguments['secondary'] = arguments['granule1']

arguments.pop('granule1')
arguments.pop('granule2')

job_dict = self.prepare_insar_isce_burst_job(**arguments)
return self.submit_prepared_jobs(prepared_jobs=job_dict)

Expand Down

0 comments on commit d2e0b9e

Please sign in to comment.