Skip to content

Add NDSI, NDBI, BAI, MSAVI2, and OSAVI spectral indices#1044

Merged
brendancol merged 5 commits into
masterfrom
issue-1037
Mar 21, 2026
Merged

Add NDSI, NDBI, BAI, MSAVI2, and OSAVI spectral indices#1044
brendancol merged 5 commits into
masterfrom
issue-1037

Conversation

@brendancol
Copy link
Copy Markdown
Contributor

@brendancol brendancol commented Mar 20, 2026

Summary

Five new spectral indices in the multispectral module (13 → 18). All four backends.

  • NDSI (Normalized Difference Snow Index) -- green vs SWIR1, reuses normalized ratio kernels
  • NDBI (Normalized Difference Built-up Index) -- SWIR1 vs NIR, reuses normalized ratio kernels
  • BAI (Burn Area Index) -- spectral distance to charcoal point, dedicated kernels
  • MSAVI2 (Modified SAVI) -- self-adjusting soil line with sqrt, dedicated kernels
  • OSAVI (Optimized SAVI) -- fixed L=0.16, dedicated kernels

Also adds 32 tests (CPU, Dask, GPU backends plus uint dtype and cross-index consistency checks), API reference docs, README feature matrix entries, __init__.py exports, and a user guide notebook with synthetic data.

Closes #1037

Test plan

  • 32 new tests pass across numpy, dask+numpy, cupy, dask+cupy
  • All 143 existing multispectral tests still pass
  • Notebook executes end-to-end via nbconvert
  • Verify GPU tests pass on CI runner with CUDA

Five new indices in xrspatial/multispectral.py with all four backends
(numpy, cupy, dask+numpy, dask+cupy):

- NDSI: normalized difference snow index (green vs SWIR1)
- NDBI: normalized difference built-up index (SWIR1 vs NIR)
- BAI: burn area index (spectral distance to charcoal point)
- MSAVI2: modified SAVI with self-adjusting soil line
- OSAVI: optimized SAVI with fixed L=0.16

NDSI and NDBI reuse existing _normalized_ratio kernels.
BAI, MSAVI2, and OSAVI have dedicated kernels.
Tests cover CPU (numpy), Dask+numpy, CuPy, and Dask+CuPy backends
for all five indices. Includes uint dtype tests and cross-index
consistency checks (NDBI = -NDMI, OSAVI ≈ NDVI for large DN values).
Add BAI, MSAVI2, NDBI, NDSI, OSAVI to multispectral.rst reference
docs and README feature matrix (18 indices total, up from 13).
Notebook 35_Spectral_Indices.ipynb with synthetic 5-class scene
(snow, urban, burned, vegetation, bare soil) demonstrating all
five new spectral indices. Self-contained, no external data.
@github-actions github-actions Bot added the performance PR touches performance-sensitive code label Mar 20, 2026
Keep write-performance benchmark table from master, add 5 new
spectral index rows to the Multispectral feature matrix.
@brendancol brendancol merged commit 35d8253 into master Mar 21, 2026
11 checks passed
@brendancol brendancol deleted the issue-1037 branch March 25, 2026 14:18
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 NDSI, NDBI, BAI, MSAVI2, and OSAVI spectral indices

1 participant