xrspatial.multispectral.arvi

xrspatial.multispectral.arvi(nir_agg: xarray.core.dataarray.DataArray, red_agg: xarray.core.dataarray.DataArray, blue_agg: xarray.core.dataarray.DataArray, name='arvi')[source]

Computes Atmospherically Resistant Vegetation Index. Allows for molecular and ozone correction with no further need for aerosol correction, except for dust conditions.

Parameters
  • nir_agg (DataArray) – near-infrared band data (Sentinel 2: Band 8)

  • red_agg (DataArray) – red band data (Sentinel 2: Band 4)

  • blue_agg (DataArray) – blue band data (Sentinel 2: Band 2)

  • name (str, optional (default = "arvi")) – Name of output DataArray

Returns

  • xarray.DataArray – 2D array, of the same type as the input, of calculated arvi values. All other input attributes are preserved.

  • Notes

  • ———-

  • Algorithm References

  • - Kaufman, Y. J., & Tanre, D. (1992). Atmospherically resistant vegetation index (ARVI) for EOS-MODIS. IEEE transactions on Geoscience and Remote Sensing, 30(2), 261-270. # noqa

  • Examples

  • ———-

  • Imports

  • >>> import numpy as np

  • >>> import xarray as xr

  • >>> import xrspatial – Create Sample Band Data

  • >>> np.random.seed(0)

  • >>> nir_agg = xr.DataArray(np.random.rand(4,4), dims = [“lat”, “lon”])

  • >>> height, width = nir_agg.shape

  • >>> _lat = np.linspace(0, height - 1, height)

  • >>> _lon = np.linspace(0, width - 1, width)

  • >>> nir_agg[“lat”] = _lat

  • >>> nir_agg[“lon”] = _lon

  • >>> np.random.seed(1)

  • >>> red_agg = xr.DataArray(np.random.rand(4,4), dims = [“lat”, “lon”])

  • >>> height, width = red_agg.shape

  • >>> _lat = np.linspace(0, height - 1, height)

  • >>> _lon = np.linspace(0, width - 1, width)

  • >>> red_agg[“lat”] = _lat

  • >>> red_agg[“lon”] = _lon

  • >>> np.random.seed(2)

  • >>> blue_agg = xr.DataArray(np.random.rand(4,4),

  • >>> dims = [“lat”, “lon”])

  • >>> height, width = blue_agg.shape

  • >>> _lat = np.linspace(0, height - 1, height)

  • >>> _lon = np.linspace(0, width - 1, width)

  • >>> blue_agg[“lat”] = _lat

  • >>> blue_agg[“lon”] = _lon

  • >>> print(nir_agg, red_agg, blue_agg)

  • <xarray.DataArray (lat (4, lon: 4)>)

  • array([[0.5488135 , 0.71518937, 0.60276338, 0.54488318], – [0.4236548 , 0.64589411, 0.43758721, 0.891773 ], [0.96366276, 0.38344152, 0.79172504, 0.52889492], [0.56804456, 0.92559664, 0.07103606, 0.0871293 ]])

  • Coordinates – * lat (lat) float64 0.0 1.0 2.0 3.0
    • lon (lon) float64 0.0 1.0 2.0 3.0

    <xarray.DataArray (lat: 4, lon: 4)>

  • array([[4.17022005e-01, 7.20324493e-01, 1.14374817e-04, 3.02332573e-01], – [1.46755891e-01, 9.23385948e-02, 1.86260211e-01, 3.45560727e-01], [3.96767474e-01, 5.38816734e-01, 4.19194514e-01, 6.85219500e-01], [2.04452250e-01, 8.78117436e-01, 2.73875932e-02, 6.70467510e-01]])

  • Coordinates

    • lat (lat) float64 0.0 1.0 2.0 3.0

    • lon (lon) float64 0.0 1.0 2.0 3.0

    <xarray.DataArray (lat: 4, lon: 4)>

  • array([[0.4359949 , 0.02592623, 0.54966248, 0.43532239], – [0.4203678 , 0.33033482, 0.20464863, 0.61927097], [0.29965467, 0.26682728, 0.62113383, 0.52914209], [0.13457995, 0.51357812, 0.18443987, 0.78533515]])

  • Coordinates

    • lat (lat) float64 0.0 1.0 2.0 3.0

    • lon (lon) float64 0.0 1.0 2.0 3.0

  • Create ARVI DataArray

  • >>> data = xrspatial.multispectral.arvi(nir_agg, red_agg, blue_agg)

  • >>> print(data)

  • <xarray.DataArray ‘arvi’ (lat (4, lon: 4)>)

  • array([[ 0.08288985, -0.32062735, 0.99960309, 0.23695335], – [ 0.48395093, 0.68183958, 0.26579331, 0.37232558], [ 0.22839874, -0.24733151, 0.2551784 , -0.12864117], [ 0.26424862, -0.09922362, 0.64689773, -0.21165207]])

  • Coordinates

    • lat (lat) float64 0.0 1.0 2.0 3.0

    • lon (lon) float64 0.0 1.0 2.0 3.0