Skip to content

Return zero counts when a zone selects no pixels - #322

Open
Sinkleberg wants to merge 1 commit into
perrygeo:masterfrom
Sinkleberg:codex/empty-rasterization-counts
Open

Sinkleberg wants to merge 1 commit into
perrygeo:masterfrom
Sinkleberg:codex/empty-rasterization-counts

Conversation

@Sinkleberg

Copy link
Copy Markdown

A polygon can fall between pixel centers and select no pixels. This returns zero for its nodata and NaN counts and avoids the NumPy warning. Cells that are actually selected still count, including nodata cells.

Closes #243. Tested with arrays and a real GeoTIFF. On Windows, 129 tests passed on Python 3.13 and 126 passed on 3.14 with three Fiona skips. Those runs used Affine 2.4 and Shapely 2.1. The latest versions already fail the baseline suite on deprecation warnings.

Prepared with Codex.

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.

nodata when geometry has empty rasterization

1 participant