xrspatial.multispectral.ndsi#
- xrspatial.multispectral.ndsi(green_agg: DataArray, swir1_agg: DataArray, name='ndsi')[source]#
Computes Normalized Difference Snow Index (NDSI).
NDSI separates snow and ice from clouds and other bright surfaces by exploiting the high reflectance of snow in the green band and low reflectance in the shortwave infrared.
- Parameters:
green_agg (xr.DataArray) – 2D array of green band data. (Landsat 8: Band 3) (Sentinel-2: Band 3)
swir1_agg (xr.DataArray) – 2D array of shortwave infrared band data. (Landsat 8: Band 6) (Sentinel-2: Band 11)
name (str, default='ndsi') – Name of output DataArray.
Alternatively
first (a single xr.Dataset may be passed as the)
Dataset (argument with keyword arguments mapping band names to)
example:: (variables. For) – ndsi(ds, green=’B3’, swir1=’B11’)
- Returns:
ndsi_agg – 2D array of ndsi values in the range [-1, 1]. All other input attributes are preserved.
- Return type:
xr.DataArray of same type as inputs
References
Hall, D.K., Riggs, G.A. and Salomonson, V.V., 1995. Development of methods for mapping global snow cover using moderate resolution imaging spectroradiometer data. Remote Sensing of Environment, 54(2), pp.127-140.
Examples
>>> import numpy as np >>> import xarray as xr >>> from xrspatial.multispectral import ndsi >>> green = xr.DataArray(np.array([[600., 500.], [400., 300.]])) >>> swir1 = xr.DataArray(np.array([[100., 200.], [300., 400.]])) >>> ndsi(green, swir1).values array([[ 0.71428573, 0.42857143], [ 0.14285715, -0.14285715]], dtype=float32)