Skip to content

Add nodata/fill-value handling to ndvi, ndwi, evi - #10

Open
ysims wants to merge 1 commit into
mainfrom
feature/indices-nodata-handling
Open

Add nodata/fill-value handling to ndvi, ndwi, evi#10
ysims wants to merge 1 commit into
mainfrom
feature/indices-nodata-handling

Conversation

@ysims

@ysims ysims commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Add an optional nodata kwarg to each index function so numeric fill sentinels (e.g. -9999) are treated as missing the same way literal None values already are. When not passed explicitly, nodata is resolved from scene.metadata["nodata"], supporting either a single global sentinel or a dict[band_name, value] per-band mapping.

Implementation masks sentinel-matching pixels to None before handing off to the existing _map_binary/_map_ternary helpers, so the None-is-missing logic is reused rather than duplicated. Matching is exact equality by design (documented in each docstring), which is the predictable choice for typical integer-style sentinels. Fully additive: with no nodata kwarg and no scene.metadata["nodata"], behaviour is unchanged from before.

Add an optional nodata kwarg to each index function so numeric fill
sentinels (e.g. -9999) are treated as missing the same way literal
None values already are. When not passed explicitly, nodata is
resolved from scene.metadata["nodata"], supporting either a single
global sentinel or a dict[band_name, value] per-band mapping.

Implementation masks sentinel-matching pixels to None before handing
off to the existing _map_binary/_map_ternary helpers, so the
None-is-missing logic is reused rather than duplicated. Matching is
exact equality by design (documented in each docstring), which is the
predictable choice for typical integer-style sentinels. Fully additive:
with no nodata kwarg and no scene.metadata["nodata"], behaviour is
unchanged from before.
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