Skip to content

Commit

Permalink
Merge pull request #2012 from ASFHyP3/develop
Browse files Browse the repository at this point in the history
Release v5.0.2
  • Loading branch information
jtherrmann authored Jan 12, 2024
2 parents 67e07ba + 06afa4a commit c3ac9c6
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [5.0.2]
### Added
- A validation check for `INSAR_ISCE_BURST` that will fail if a granule crosses the antimeridian.

## [5.0.1]
### Fixed
- Upgrade the `openapi-core`, `openapi-spec-validator`, and `jsonschema` packages to their latest versions. This is now possible thanks to the pre-release of [openapi-core v0.19.0a1](https://github.com/python-openapi/openapi-core/releases/tag/0.19.0a1), which fixes <https://github.com/python-openapi/openapi-core/issues/662>. Resolves <https://github.com/ASFHyP3/hyp3/issues/1193>.
Expand Down
11 changes: 11 additions & 0 deletions apps/api/src/hyp3_api/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,17 @@ def check_valid_polarizations(granule_metadata):
raise GranuleValidationError(f'Only VV and HH polarizations are currently supported, got: {ref_polarization}')


def check_not_antimeridian(granule_metadata):
for granule in granule_metadata:
bbox = granule['polygon'].bounds
if abs(bbox[0] - bbox[2]) > 180.0 and bbox[0] * bbox[2] < 0.0:
msg = (
f'Granule {granule["name"]} crosses the antimeridian.',
' Processing across the antimeridian is not currently supported',
)
raise GranuleValidationError(msg)


def format_points(point_string):
converted_to_float = [float(x) for x in point_string.split(' ')]
points = [list(t) for t in zip(converted_to_float[1::2], converted_to_float[::2])]
Expand Down
1 change: 1 addition & 0 deletions job_spec/INSAR_ISCE_BURST.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ INSAR_ISCE_BURST:
- check_dem_coverage
- check_valid_polarizations
- check_same_burst_ids
- check_not_antimeridian
tasks:
- name: ''
image: ghcr.io/asfhyp3/hyp3-isce2
Expand Down
15 changes: 15 additions & 0 deletions tests/test_api/test_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,21 @@ def rectangle(north, south, east, west):
return Polygon([[west, north], [east, north], [east, south], [west, south]])


def test_not_antimeridian():
# Wyoming
good_rect = rectangle(45, 41, -104, -111)

# Aleutian Islands over antimeridian; should fail
bad_rect = rectangle(51.7, 51.3, 179.7, -179.3)

good_granules = [{'polygon': good_rect, 'name': 'good'}, {'polygon': good_rect, 'name': 'good'}]
validation.check_not_antimeridian(good_granules)

bad_granules = [{'polygon': good_rect, 'name': 'good'}, {'polygon': bad_rect, 'name': 'bad'}]
with raises(validation.GranuleValidationError, match=r'.*crosses the antimeridian.*'):
validation.check_not_antimeridian(bad_granules)


def test_has_sufficient_coverage():
# Wyoming
poly = rectangle(45, 41, -104, -111)
Expand Down

0 comments on commit c3ac9c6

Please sign in to comment.