Skip to content

reproject: reject NaN/Inf in scalar inputs#1436

Merged
brendancol merged 1 commit intomainfrom
issue-1435
May 4, 2026
Merged

reproject: reject NaN/Inf in scalar inputs#1436
brendancol merged 1 commit intomainfrom
issue-1435

Conversation

@brendancol
Copy link
Copy Markdown
Contributor

Closes #1435.

Summary

  • itrf_transform() rejects non-finite epoch and empty src / tgt strings.
  • geoid_height() rejects non-finite lon / lat (covers all four convert helpers transitively) and bounds lat to [-90, 90].
  • _detect_nodata() rejects nodata=+/-Inf (NaN still allowed).

Each case previously silently produced wrong output (NaN/garbage in coords, plausible-looking-but-wrong geoid undulation, or downstream np.isnan mask failures).

Test plan

  • 16 new tests in TestItrfFiniteness, TestGeoidFiniteness, TestNodataFiniteness.
  • Full reproject suite — 112 passed.
  • CI run on full suite.

- itrf_transform(): require finite epoch and non-empty src/tgt strings.
  NaN epoch silently produced all-NaN output; Inf overflowed to garbage.
- geoid_height(): require finite lon/lat and lat in [-90, 90].
  NaN/Inf lon/lat wrapped via int() + modulo into bogus indices, returning
  plausible-looking-but-wrong N values.  All four convert helpers
  (ellipsoidal/orthometric/depth) inherit this fix.
- _detect_nodata(): reject Inf (NaN remains the canonical sentinel).
  Inf nodata broke downstream np.isnan masks.

16 new tests in TestItrfFiniteness, TestGeoidFiniteness, TestNodataFiniteness.
@github-actions github-actions Bot added the performance PR touches performance-sensitive code label May 3, 2026
brendancol added a commit that referenced this pull request May 3, 2026
Records the 11 PRs filed this round:
- hydro: HIGH flow_direction_mfd memory guard (PR #1424); MEDIUM
  bundles for _validate_raster on secondary args (#1426), scalar
  param validation (#1428), and cellsize validation (#1430).
- reproject: MEDIUM bundles for _validate_raster (#1432), grid/bounds/
  precision validation (#1434), and NaN/Inf rejection (#1436).
- flood: mannings_n DataArray validation (#1438).
- pathfinding: waypoint cap + _validate_raster (#1440).
- polygonize: _validate_raster (#1442).
- terrain: scratch memory guard + scalar validation (#1444).
@brendancol brendancol merged commit 5e6dda5 into main May 4, 2026
10 of 11 checks passed
@brendancol brendancol deleted the issue-1435 branch May 4, 2026 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance PR touches performance-sensitive code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

reproject: NaN/Inf in scalar inputs propagates silently

1 participant