xrspatial.multispectral.bai#
- xrspatial.multispectral.bai(red_agg: DataArray, nir_agg: DataArray, name='bai')[source]#
Computes Burn Area Index (BAI).
BAI measures the spectral distance of each pixel to a charcoal reflectance point (red=0.1, NIR=0.06). Higher values indicate recently burned areas. Unlike NBR, BAI works on the raw reflectance values rather than a normalized difference.
Input bands should be in reflectance units (0-1 range). If your data is in DN or scaled integers, divide by the appropriate scale factor first.
- Parameters:
red_agg (xr.DataArray) – 2D array of red band reflectance data (0-1 range).
nir_agg (xr.DataArray) – 2D array of near-infrared band reflectance data (0-1 range).
name (str, default='bai') – Name of output DataArray.
Alternatively
first (a single xr.Dataset may be passed as the)
Dataset (argument with keyword arguments mapping band names to)
example:: (variables. For) – bai(ds, red=’B4’, nir=’B8’)
- Returns:
bai_agg – 2D array of bai values. Higher values indicate burned areas. All other input attributes are preserved.
- Return type:
xr.DataArray of same type as inputs
References
Chuvieco, E., Martin, M.P. and Palacios, A., 2002. Assessment of different spectral conditions for the detection of burned areas with Landsat TM data. International Journal of Remote Sensing, 23(1), pp.71-85.
Examples
>>> import numpy as np >>> import xarray as xr >>> from xrspatial.multispectral import bai >>> red = xr.DataArray(np.array([[0.1, 0.2], [0.3, 0.05]])) >>> nir = xr.DataArray(np.array([[0.06, 0.3], [0.4, 0.02]])) >>> bai(red, nir).values # pixel (0,0) is at charcoal point array([[ inf, 0.01686341, 0.00858369, 1111.1111 ]], dtype=float32)