ndsi¶
- ndsi(green, swir1)[source]¶
Normalized Difference Snow Index (NDSI)
NDSI = (Green - SWIR1) / (Green + SWIR1)
- Parameters:
green (
numpy.ndarray) – Green band.swir1 (
numpy.ndarray) – Short-wave infrared 1 band.
- Returns:
NDSI values (typically in [-1, 1]).
- Return type:
Overview¶
ndsi computes the Normalized Difference Snow Index:
It is commonly used to separate snow/ice from most non-snow surfaces. Values typically range from -1 to 1: - Higher positive values (often > 0.3): likely snow/ice - Near 0: mixed or uncertain surfaces - Negative values: vegetation, soil, water, or built surfaces
Usage¶
import numpy as np
from eo_processor import ndsi
green = np.array([0.52, 0.58, 0.44])
swir1 = np.array([0.18, 0.22, 0.35])
out = ndsi(green, swir1)
print(out) # element-wise (green - swir1)/(green + swir1)
Shapes & Dtypes¶
Supports 1D and 2D arrays in the public Python API.
Inputs may be any numeric dtype (int/uint/float); coerced to
float64internally.Shapes of
greenandswir1must match exactly; mismatch raisesValueError.
Numerical Stability¶
Very small denominators are guarded with an EPSILON (1e-10). When green + swir1 is ~0
the output is set to 0.0 to avoid instability.
Interpretation Notes¶
Use NDSI with cloud masks, temperature, or elevation constraints in production snow workflows. Snow detection quality can vary with illumination, terrain shadow, and sensor band responses.
See Also¶
ndwi()for water-focused normalized differencendmi()for moisture-focused normalized differencenormalized_difference()generic primitive used by multiple indices
End of NDSI documentation.