Skip to content

Mask NaN nodata in NumPy point queries - #319

Open
antonsoo wants to merge 2 commits into
perrygeo:masterfrom
antonsoo:fix/nan-nodata-point-queries
Open

antonsoo wants to merge 2 commits into
perrygeo:masterfrom
antonsoo:fix/nan-nodata-point-queries

Conversation

@antonsoo

@antonsoo antonsoo commented Oct 24, 2026 •

Copy link
Copy Markdown

Use isnan when a NumPy raster's nodata value is NaN. Equality never marks these cells as missing, so nearest queries return NaN instead of None, and bilinear queries can return NaN for a valid sample beside a missing cell.

The regression covers both interpolation modes and points outside the raster. A replay of the bundled DEM through arrays, read-only memory maps and GeoTIFFs matches an independent pixel-space reference after the fix; working point queries and polygon summaries remain unchanged. The installed wheel gives the same results.

All 128 tests pass with the older dependency profile. With current Affine/Shapely, two existing deprecation warnings require filtering; the unrestricted baseline has the same failures. Ruff checks and formatting pass for the changed files.

Large Python integer nodata values retain equality masking; regressions cover 2**64 and 10**20 in both interpolation modes.

@antonsoo

Copy link
Copy Markdown
Author

I found a compatibility regression while auditing this change: NaN detection rejected large Python integer nodata values. The updated commit preserves equality masking for those values and adds regressions for 2**64 and 10**20. Both interpolation modes now match the recorded DEM reference; all 128 tests pass with the previously noted dependency-warning filters.

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.

1 participant