xrspatial.multispectral.evi

xrspatial.multispectral.evi(nir_agg: xarray.core.dataarray.DataArray, red_agg: xarray.core.dataarray.DataArray, blue_agg: xarray.core.dataarray.DataArray, c1=6.0, c2=7.5, soil_factor=1.0, gain=2.5, name='evi')[source]

Computes Enhanced Vegetation Index. Allows for importved sensitivity in high biomass regions, de-coupling of the canopy background signal and reduction of atmospheric influences.

Parameters
  • nir_agg (xr.DataArray) – 2D array of near-infrared band data.

  • red_agg (xr.DataArray) – 2D array of red band data.

  • blue_agg (xr.DataArray) – 2D array of blue band data.

  • c1 (float, default=6.0) – First coefficient of the aerosol resistance term.

  • c2 (float, default=7.5) – Second coefficients of the aerosol resistance term.

  • soil_factor (float, default=1.0) – Soil adjustment factor between -1.0 and 1.0.

  • gain (float, default=2.5) – Amplitude adjustment factor.

  • name (str, default='evi') – Name of output DataArray.

Returns

evi_agg – 2D array of evi values. All other input attributes are preserved.

Return type

xarray.DataArray of same type as inputs

References

Examples

import matplotlib.pyplot as plt
from xrspatial.multispectral import evi
from xrspatial.datasets import get_data

# Open Example Data
data = get_data('sentinel-2')

nir = data['NIR']
red = data['Red']
blue = data['Blue']

# Generate EVI Aggregate Array
evi_agg = evi(nir_agg = nir,
              red_agg = red,
              blue_agg =blue)

# Plot NIR Band
nir.plot(cmap = 'Greys', aspect = 2, size = 4)
plt.title("NIR Band")
plt.ylabel("latitude")
plt.xlabel("longitude")

# Plot Red Band
red.plot(cmap = 'Greys', aspect = 2, size = 4)
plt.title("Red Band")
plt.ylabel("latitude")
plt.xlabel("longitude")

# Plot Blue Band
blue.plot(cmap = 'Greys', aspect = 2, size = 4)
plt.title("Blue Band")
plt.ylabel("latitude")
plt.xlabel("longitude")

# Plot EVI
evi_agg.plot(cmap = 'Greys', aspect = 2, size = 4)
plt.title("EVI")
plt.ylabel("latitude")
plt.xlabel("longitude")
../../_images/xrspatial-multispectral-evi-1_00.png

(png, hires.png, pdf)

../../_images/xrspatial-multispectral-evi-1_01.png

(png, hires.png, pdf)

../../_images/xrspatial-multispectral-evi-1_02.png

(png, hires.png, pdf)

../../_images/xrspatial-multispectral-evi-1_03.png

(png, hires.png, pdf)

>>> print(evi_agg[100:103, 100: 102])
<xarray.DataArray 'evi' (y: 3, x: 2)>
array([[-3.8247012 , -9.51086957],
       [11.81818182,  3.83783784],
       [-8.53211009,  5.48672566]])
Coordinates:
  * x        (x) float64 6.01e+05 6.01e+05
  * y        (y) float64 4.699e+06 4.699e+06 4.699e+06
    band     int32 ...
Attributes: (12/13)
    transform:                [ 1.00000e+01  0.00000e+00  6.00000e+05  0.0000... # noqa
    crs:                      +init=epsg:32719
    res:                      [10. 10.]
    is_tiled:                 1
    nodatavals:               nan
    scales:                   1.0
    ...                       ...
    instrument:               Sentinel-2
    Band:                     07
    Name:                     NIR
    Bandwidth (µm):           115
    Nominal Wavelength (µm):  0.842
    Resolution (m):            10