xrspatial.multispectral.gci#

xrspatial.multispectral.gci(nir_agg: xarray.core.dataarray.DataArray, green_agg: xarray.core.dataarray.DataArray, name='gci')[source]#

Computes Green Chlorophyll Index. Used to estimate the content of leaf chorophyll and predict the physiological state of vegetation and plant health.

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

  • green_agg (xr.DataArray) – 2D array of green band data.

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

Returns

gci_agg – 2D array of gci values. All other input attributes are preserved.

Return type

xarray.DataArray of the same type as inputs

References

Examples

>>> from xrspatial.datasets import get_data
>>> data = get_data('sentinel-2')  # Open Example Data
>>> nir = data['NIR']
>>> green = data['Green']
>>> from xrspatial.multispectral import gci
>>> # Generate GCI Aggregate Array
>>> gci_agg = gci(nir_agg=nir, green_agg=green)
>>> nir.plot(aspect=2, size=4)
>>> green.plot(aspect=2, size=4)
>>> gci_agg.plot(aspect=2, size=4)
../../_images/xrspatial-multispectral-gci-1_00.png

(png, hires.png, pdf)#

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

(png, hires.png, pdf)#

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

(png, hires.png, pdf)#

>>> y1, x1, y2, x2 = 100, 100, 103, 104
>>> print(nir[y1:y2, x1:x2].data)
[[1519. 1504. 1530. 1589.]
 [1491. 1473. 1542. 1609.]
 [1479. 1461. 1592. 1653.]]
>>> print(green[y1:y2, x1:x2].data])
[[1120. 1130. 1157. 1191.]
 [1111. 1137. 1190. 1221.]
 [1097. 1139. 1228. 1216.]]
>>> print(gci_agg[y1:y2, x1:x2].data)
[[0.35625    0.33097345 0.3223855  0.33417296]
 [0.3420342  0.29551452 0.29579833 0.31777233]
 [0.34822243 0.28270411 0.29641694 0.359375  ]]