Skip to content

Commit 35d8253

Browse files
authored
Add NDSI, NDBI, BAI, MSAVI2, and OSAVI spectral indices (#1044)
* Add NDSI, NDBI, BAI, MSAVI2, and OSAVI spectral indices (#1037) 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. * Add tests for NDSI, NDBI, BAI, MSAVI2, and OSAVI (#1037) 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 docs and README entries for new spectral indices (#1037) Add BAI, MSAVI2, NDBI, NDSI, OSAVI to multispectral.rst reference docs and README feature matrix (18 indices total, up from 13). * Add user guide notebook for NDSI, NDBI, BAI, MSAVI2, OSAVI (#1037) 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.
1 parent 40fa429 commit 35d8253

File tree

7 files changed

+1432
-2
lines changed

7 files changed

+1432
-2
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,15 +299,20 @@ write_vrt('mosaic.vrt', ['tile1.tif', 'tile2.tif']) # generate VRT
299299
| Name | Description | Source | NumPy xr.DataArray | Dask xr.DataArray | CuPy GPU xr.DataArray | Dask GPU xr.DataArray |
300300
|:----------:|:------------|:------:|:----------------------:|:--------------------:|:-------------------:|:------:|
301301
| [Atmospherically Resistant Vegetation Index (ARVI)](xrspatial/multispectral.py) | Vegetation index resistant to atmospheric effects using blue band correction | Kaufman & Tanre 1992 | ✅️ |✅️ | ✅️ |✅️ |
302+
| [Burn Area Index (BAI)](xrspatial/multispectral.py) | Spectral distance to charcoal reflectance point for burn scar detection | Chuvieco et al. 2002 | ✅️ |✅️ | ✅️ |✅️ |
302303
| [Enhanced Built-Up and Bareness Index (EBBI)](xrspatial/multispectral.py) | Highlights built-up areas and barren land from thermal and SWIR bands | As-syakur et al. 2012 | ✅️ |✅️ | ✅️ |✅️ |
303304
| [Enhanced Vegetation Index (EVI)](xrspatial/multispectral.py) | Enhanced vegetation index reducing soil and atmospheric noise | Huete et al. 2002 | ✅️ |✅️ | ✅️ |✅️ |
304305
| [Green Chlorophyll Index (GCI)](xrspatial/multispectral.py) | Estimates leaf chlorophyll content from green and NIR reflectance | Gitelson et al. 2003 | ✅️ |✅️ | ✅️ |✅️ |
306+
| [Modified Soil Adjusted Vegetation Index (MSAVI2)](xrspatial/multispectral.py) | Self-adjusting soil line vegetation index, no L parameter needed | Qi et al. 1994 | ✅️ |✅️ | ✅️ |✅️ |
305307
| [Normalized Burn Ratio (NBR)](xrspatial/multispectral.py) | Measures burn severity using NIR and SWIR band difference | USGS Landsat | ✅️ |✅️ | ✅️ |✅️ |
306308
| [Normalized Burn Ratio 2 (NBR2)](xrspatial/multispectral.py) | Refines burn severity mapping using two SWIR bands | USGS Landsat | ✅️ |✅️ | ✅️ |✅️ |
309+
| [Normalized Difference Built-up Index (NDBI)](xrspatial/multispectral.py) | Picks out built-up and urban areas from SWIR and NIR bands | Zha et al. 2003 | ✅️ |✅️ | ✅️ |✅️ |
307310
| [Normalized Difference Moisture Index (NDMI)](xrspatial/multispectral.py) | Detects vegetation moisture stress from NIR and SWIR reflectance | USGS Landsat | ✅️ |✅️ | ✅️ |✅️ |
311+
| [Normalized Difference Snow Index (NDSI)](xrspatial/multispectral.py) | Separates snow and ice from clouds using green and SWIR bands | Hall et al. 1995 | ✅️ |✅️ | ✅️ |✅️ |
308312
| [Normalized Difference Water Index (NDWI)](xrspatial/multispectral.py) | Maps open water bodies using green and NIR band difference | McFeeters 1996 | ✅️ |✅️ | ✅️ |✅️ |
309313
| [Modified Normalized Difference Water Index (MNDWI)](xrspatial/multispectral.py) | Detects water in urban areas using green and SWIR bands | Xu 2006 | ✅️ |✅️ | ✅️ |✅️ |
310314
| [Normalized Difference Vegetation Index (NDVI)](xrspatial/multispectral.py) | Quantifies vegetation density from red and NIR band difference | Rouse et al. 1973 | ✅️ |✅️ | ✅️ |✅️ |
315+
| [Optimized Soil Adjusted Vegetation Index (OSAVI)](xrspatial/multispectral.py) | SAVI with fixed L=0.16, tuned for sparse vegetation | Rondeaux et al. 1996 | ✅️ |✅️ | ✅️ |✅️ |
311316
| [Soil Adjusted Vegetation Index (SAVI)](xrspatial/multispectral.py) | Vegetation index with soil brightness correction factor | Huete 1988 | ✅️ |✅️ | ✅️ |✅️ |
312317
| [Structure Insensitive Pigment Index (SIPI)](xrspatial/multispectral.py) | Estimates carotenoid-to-chlorophyll ratio for plant stress detection | Penuelas et al. 1995 | ✅️ |✅️ | ✅️ |✅️ |
313318
| [True Color](xrspatial/multispectral.py) | Composites red, green, and blue bands into a natural color image | Standard | ✅️ | ✅️ | ✅️ | ✅️ |

docs/source/reference/multispectral.rst

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ Atmospherically Resistant Vegetation Index (ARVI)
1111

1212
xrspatial.multispectral.arvi
1313

14+
Burn Area Index (BAI)
15+
=====================
16+
.. autosummary::
17+
:toctree: _autosummary
18+
19+
xrspatial.multispectral.bai
20+
1421
Enhanced Built-Up and Bareness Index (EBBI)
1522
============================================
1623
.. autosummary::
@@ -32,6 +39,13 @@ Green Chlorophyll Index (GCI)
3239

3340
xrspatial.multispectral.gci
3441

42+
Modified Soil Adjusted Vegetation Index (MSAVI2)
43+
=================================================
44+
.. autosummary::
45+
:toctree: _autosummary
46+
47+
xrspatial.multispectral.msavi2
48+
3549
Normalized Burn Ratio (NBR)
3650
===========================
3751
.. autosummary::
@@ -46,13 +60,27 @@ Normalized Burn Ratio 2 (NBR2)
4660

4761
xrspatial.multispectral.nbr2
4862

63+
Normalized Difference Built-up Index (NDBI)
64+
===========================================
65+
.. autosummary::
66+
:toctree: _autosummary
67+
68+
xrspatial.multispectral.ndbi
69+
4970
Normalized Difference Moisture Index (NDMI)
5071
===========================================
5172
.. autosummary::
5273
:toctree: _autosummary
5374

5475
xrspatial.multispectral.ndmi
5576

77+
Normalized Difference Snow Index (NDSI)
78+
=======================================
79+
.. autosummary::
80+
:toctree: _autosummary
81+
82+
xrspatial.multispectral.ndsi
83+
5684
Normalized Difference Water Index (NDWI)
5785
========================================
5886
.. autosummary::
@@ -74,6 +102,13 @@ Normalized Difference Vegetation Index (NDVI)
74102

75103
xrspatial.multispectral.ndvi
76104

105+
Optimized Soil Adjusted Vegetation Index (OSAVI)
106+
=================================================
107+
.. autosummary::
108+
:toctree: _autosummary
109+
110+
xrspatial.multispectral.osavi
111+
77112
Soil Adjusted Vegetation Index (SAVI)
78113
=====================================
79114
.. autosummary::

examples/user_guide/35_Spectral_Indices.ipynb

Lines changed: 578 additions & 0 deletions
Large diffs are not rendered by default.
806 KB
Loading

xrspatial/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,16 @@
6666
from xrspatial.hillshade import hillshade # noqa
6767
from xrspatial.mahalanobis import mahalanobis # noqa
6868
from xrspatial.multispectral import arvi # noqa
69+
from xrspatial.multispectral import bai # noqa
6970
from xrspatial.multispectral import evi # noqa
7071
from xrspatial.multispectral import mndwi # noqa
72+
from xrspatial.multispectral import msavi2 # noqa
7173
from xrspatial.multispectral import nbr # noqa
74+
from xrspatial.multispectral import ndbi # noqa
75+
from xrspatial.multispectral import ndsi # noqa
7276
from xrspatial.multispectral import ndvi # noqa
7377
from xrspatial.multispectral import ndwi # noqa
78+
from xrspatial.multispectral import osavi # noqa
7479
from xrspatial.multispectral import savi # noqa
7580
from xrspatial.multispectral import sipi # noqa
7681
from xrspatial.pathfinding import a_star_search # noqa

0 commit comments

Comments
 (0)