Skip to content

Add NDWI and MNDWI water indices#959

Merged
brendancol merged 3 commits into
masterfrom
issue-948
Mar 4, 2026
Merged

Add NDWI and MNDWI water indices#959
brendancol merged 3 commits into
masterfrom
issue-948

Conversation

@brendancol
Copy link
Copy Markdown
Contributor

@brendancol brendancol commented Mar 4, 2026

Summary

  • Adds ndwi(green, nir) and mndwi(green, swir) to xrspatial/multispectral.py for mapping surface water
  • Both reuse the existing _normalized_ratio_* backend functions, so NumPy, Dask, CuPy, and Dask+CuPy work with no new kernel code
  • Adds .xrs accessor methods (DataArray and Dataset) for both functions
  • Tests against hand-computed reference values on all four backends, plus uint dtype edge cases
  • API reference entries in docs/source/reference/multispectral.rst
  • Two new rows in the README feature matrix
  • User guide notebook 17_Water_Indices.ipynb

Test plan

  • pytest xrspatial/tests/test_multispectral.py -- 111 pass (12 new)
  • pytest xrspatial/tests/test_accessor.py -- 21 pass
  • Visual check of notebook output

Closes #948

Add ndwi() and mndwi() to the multispectral module for mapping
surface water bodies. Both reuse the existing normalized-ratio
backend functions, so all four backends (NumPy, Dask, CuPy,
Dask+CuPy) work out of the box. Includes DataArray/Dataset
accessor methods and tests against reference values.
- Add API reference entries in multispectral.rst
- Add two rows to the README feature matrix
- Add notebook 17_Water_Indices.ipynb with synthetic data demo
@github-actions github-actions Bot added the performance PR touches performance-sensitive code label Mar 4, 2026
Number 17 is taken by another in-flight branch.
@brendancol brendancol merged commit 64e59b2 into master Mar 4, 2026
11 checks passed
@brendancol brendancol deleted the issue-948 branch May 4, 2026 13:06
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.

Add NDWI and MNDWI water indices to multispectral module

1 participant