Skip to content

feat(queries): warn on likely-flipped/out-of-range bounding-box coordinates (fixes #66) - #121

Closed
philphauler wants to merge 22 commits into
nasa:mainfrom
philphauler:fix-66-bbox-coord-warning
Closed

feat(queries): warn on likely-flipped/out-of-range bounding-box coordinates (fixes #66)#121
philphauler wants to merge 22 commits into
nasa:mainfrom
philphauler:fix-66-bbox-coord-warning

Conversation

@philphauler

Copy link
Copy Markdown

Summary

Fixes #66 — GranuleQuery.bounding_box(...) silently stored
coordinates with no validation, so a flipped/swapped box (e.g. longitude given
where latitude should be) would build a polygon that wraps the wrong way around
the Earth instead of erroring. This is the exact silent failure earthaccess
users hit (earthaccess-dev/earthaccess#746).

The method now emits a UserWarning (matching �sf_search's behaviour — warn,
don't break) when coordinates look wrong, while still storing the box so existing
callers keep working:

  • longitude outside [-180, 180] -> warn
  • latitude outside [-90, 90] -> warn
  • lower-left east/north of upper-right (inverted box) -> warn

Why these bounds (NOESIS-derived invariant)

The valid domain is the WGS84 invariant lon in [-180, 180], lat in [-90, 90],
with lower_left <= upper_right on each axis. Fed as a numeric sequence to
NOESIS/KODON, this resolves to the exact domain law; a value outside its own
axis' range is overwhelmingly a swapped coordinate, not a real point.

Verification

  • New regression test est_bounding_box_warns_on_likely_flipped_coordinates:
    out-of-domain lon, out-of-domain lat, and inverted box each warn; a valid box
    warns nothing and stores 1.0,2.0,3.0,4.0.
  • Full pytest tests/test_granule.py -k bounding_box: 3 passed, 0 regressed.

AI assistance disclosure

The valid-domain invariant was derived with AI assistance (NOESIS/KODON exact
sequence derivation); the implementation and tests were verified locally via the
repo's pytest suite. No code was produced without test proof.

frankinspace and others added 22 commits September 13, 2024 10:02
Issues/37 Add function for returning an iterator instead of sequence
…asa#91)

* Added function for returning an iterator instead of a sequence. Updated unit tests

* fix botched merge

* Update CHANGELOG.md

Co-authored-by: Chuck Daniels <chuck@developmentseed.org>

---------

Co-authored-by: Chuck Daniels <chuck@developmentseed.org>
Bumps [abatilo/actions-poetry](https://github.com/abatilo/actions-poetry) from 3 to 4.
- [Release notes](https://github.com/abatilo/actions-poetry/releases)
- [Changelog](https://github.com/abatilo/actions-poetry/blob/master/.releaserc)
- [Commits](abatilo/actions-poetry@v3...v4)

---
updated-dependencies:
- dependency-name: abatilo/actions-poetry
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [requests](https://github.com/psf/requests) from 2.32.3 to 2.32.4.
- [Release notes](https://github.com/psf/requests/releases)
- [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md)
- [Commits](psf/requests@v2.32.3...v2.32.4)

---
updated-dependencies:
- dependency-name: requests
  dependency-version: 2.32.4
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 5 to 6.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](actions/setup-python@v5...v6)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3 to 4.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](github/codeql-action@v3...v4)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: '4'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v4...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [actions/cache](https://github.com/actions/cache) from 4 to 5.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](actions/cache@v4...v5)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [idna](https://github.com/kjd/idna) from 3.8 to 3.15.
- [Release notes](https://github.com/kjd/idna/releases)
- [Changelog](https://github.com/kjd/idna/blob/master/HISTORY.md)
- [Commits](kjd/idna@v3.8...v3.15)

---
updated-dependencies:
- dependency-name: idna
  dependency-version: '3.15'
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
- Update platform() method in GranuleCollectionBaseQuery to accept Union[str, Sequence[str]]
- Backward compatible: single string works as before
- Multiple platforms passed as list for proper URL formatting (platform[]=...)
- Add tests for single, multiple, and empty platform cases in both CollectionQuery and GranuleQuery
- Update CHANGELOG.md with new feature

Closes nasa#80

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Suhas <suhaslord@users.noreply.github.com>
Bumps [actions/checkout](https://github.com/actions/checkout) from 6 to 7.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v6...v7)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Chuck Daniels <chuck@developmentseed.org>
Bumps [actions/cache](https://github.com/actions/cache) from 5 to 6.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](actions/cache@v5...v6)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 6 to 7.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](actions/setup-python@v6...v7)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@philphauler

Copy link
Copy Markdown
Author

Closing in favor of #105, which implements coordinate-order validation + UserWarnings for #66. Avoiding duplicate review burden.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants