xrspatial.multispectral.msavi2#
- xrspatial.multispectral.msavi2(nir_agg: DataArray, red_agg: DataArray, name='msavi2')[source]#
Computes Modified Soil Adjusted Vegetation Index (MSAVI2).
MSAVI2 is a self-adjusting vegetation index that does not require an empirical soil-brightness correction factor (L). It produces less noisy results than SAVI in areas with sparse vegetation and exposed soil.
- Parameters:
nir_agg (xr.DataArray) – 2D array of near-infrared band data.
red_agg (xr.DataArray) – 2D array of red band data.
name (str, default='msavi2') – 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) – msavi2(ds, nir=’B8’, red=’B4’)
- Returns:
msavi2_agg – 2D array of msavi2 values. All other input attributes are preserved.
- Return type:
xr.DataArray of same type as inputs
References
Qi, J., Chehbouni, A., Huete, A.R., Kerr, Y.H. and Sorooshian, S., 1994. A modified soil adjusted vegetation index. Remote Sensing of Environment, 48(2), pp.119-126.
Examples
>>> import numpy as np >>> import xarray as xr >>> from xrspatial.multispectral import msavi2 >>> nir = xr.DataArray(np.array([[0.5, 0.3], [0.1, 0.4]])) >>> red = xr.DataArray(np.array([[0.1, 0.2], [0.05, 0.3]])) >>> msavi2(nir, red).values array([[0.38729835, 0.08284271, 0.0248457 , 0.08284271]], dtype=float32)