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

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

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

nir = data['NIR']
swir2 = data['SWIR2']

# Generate NBR Aggregate Array
nbr_agg = nbr(nir_agg = nir,
              swir2_agg = swir2)

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

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

# Plot NBR
nbr_agg.plot(cmap = 'Greys', aspect = 2, size = 4)
plt.title("NBR")
plt.ylabel("latitude")
plt.xlabel("longitude")
../../_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)

print(nbr_agg[100:103, 100: 102])
    <xarray.DataArray 'nbr' (y: 3, x: 2)>
    array([[-0.10251108, -0.1321408 ],
           [-0.09691096, -0.12659354],
           [-0.10823033, -0.14486392]])
    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