Guard _apply_vertical_shift against non-finite coords and add vertical CRS tests#1453
Merged
brendancol merged 2 commits intomainfrom May 4, 2026
Merged
Conversation
…RS tests Inverse-projecting output coords for the geoid lookup can produce inf or NaN at projection singularities (poles, antimeridian). Those values flow into _interp_geoid_point, where the longitude wrap loop spins forever on inf. Mask non-finite coords with NaN before the JIT batch and drop those pixels from the valid-shift mask so NaN from the geoid does not contaminate the output. Add a TestVerticalShift class covering EGM96<->ellipsoidal round-trip, EGM96 to EGM2008 (skipped if grid not available), no-op when both vertical CRSes match or only one side is set, the projected-CRS inverse-projection branch, and a polar-stereographic regression test for the hang. Closes #1451
Contributor
Author
|
@copilot resolve the merge conflicts in this pull request |
…e test conflicts Co-authored-by: brendancol <433221+brendancol@users.noreply.github.com>
Contributor
Merged |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_interp_geoid_2d. Inverse-projecting output grid coords for the geoid lookup can emitinfor NaN at projection singularities. Those values reach_interp_geoid_point, where the longitude wrap loop spins forever oninf. The fix replaces non-finite coords with NaN and drops the matching pixels from the valid-shift mask so NaN from the geoid does not contaminate the output.TestVerticalShiftcovering EGM96 to ellipsoidal and back, EGM96 to EGM2008 (skipped if the grid is not available), no-op when both vertical CRSes match or only one side is set, the projected-CRS inverse-projection branch, and a polar-stereographic regression test for the hang.Closes #1451
Test plan
pytest xrspatial/tests/test_reproject.py::TestVerticalShift -vpasses (7/7)pytest xrspatial/tests/test_reproject.py -xpasses (143/143)