xrspatial.multispectral.nbr#

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

Computes Normalized Burn Ratio. Used to identify burned areas and provide a measure of burn severity.

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

  • swir_agg (xr.DataArray) – 2D array of shortwave infrared band. (Landsat 4-7: Band 6) (Landsat 8: Band 7)

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

Returns

nbr_agg – 2D array of nbr values. All other input attributes are preserved.

Return type

xr.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']
>>> swir2 = data['SWIR2']
>>> from xrspatial.multispectral import nbr
>>> # Generate NBR Aggregate Array
>>> nbr_agg = nbr(nir_agg=nir, swir2_agg=swir2)
>>> nir.plot(aspect=2, size=4)
>>> swir2.plot(aspect=2, size=4)
>>> nbr_agg.plot(aspect=2, size=4)
../../_images/xrspatial-multispectral-nbr-1_00.png

(png, hires.png, pdf)#

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

(png, hires.png, pdf)#

../../_images/xrspatial-multispectral-nbr-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(swir2[y1:y2, x1:x2].data)
[[1866. 1962. 2086. 2112.]
 [1811. 1900. 2012. 2041.]
 [1838. 1956. 2067. 2109.]]
>>> print(nbr_agg[y1:y2, x1:x2].data)
[[-0.10251108 -0.1321408  -0.15376106 -0.14131317]
 [-0.09691096 -0.12659353 -0.13224536 -0.11835616]
 [-0.10823033 -0.14486392 -0.12981689 -0.12121212]]