xrspatial.multispectral.osavi#

xrspatial.multispectral.osavi(nir_agg: DataArray, red_agg: DataArray, name='osavi')[source]#

Computes Optimized Soil Adjusted Vegetation Index (OSAVI).

OSAVI uses a fixed soil-brightness correction factor of L=0.16, chosen to work well across a range of soil conditions without requiring per-scene tuning. It performs best in areas with sparse to moderate vegetation cover.

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='osavi') – 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) – osavi(ds, nir=’B8’, red=’B4’)

Returns:

osavi_agg – 2D array of osavi values. All other input attributes are preserved.

Return type:

xr.DataArray of same type as inputs

References

  • Rondeaux, G., Steven, M. and Baret, F., 1996. Optimization of soil-adjusted vegetation indices. Remote Sensing of Environment, 55(2), pp.95-107.

Examples

>>> import numpy as np
>>> import xarray as xr
>>> from xrspatial.multispectral import osavi
>>> 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]]))
>>> osavi(nir, red).values
array([[0.5263158 , 0.15151516, 0.16129032, 0.11627907]],
      dtype=float32)