xrspatial.multispectral.ndbi#
- xrspatial.multispectral.ndbi(swir1_agg: DataArray, nir_agg: DataArray, name='ndbi')[source]#
Computes Normalized Difference Built-up Index (NDBI).
NDBI picks out built-up and urban areas by exploiting the higher reflectance of impervious surfaces in SWIR relative to NIR.
- Parameters:
swir1_agg (xr.DataArray) – 2D array of shortwave infrared band data. (Landsat 8: Band 6) (Sentinel-2: Band 11)
nir_agg (xr.DataArray) – 2D array of near-infrared band data. (Landsat 8: Band 5) (Sentinel-2: Band 8)
name (str, default='ndbi') – 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) – ndbi(ds, swir1=’B11’, nir=’B8’)
- Returns:
ndbi_agg – 2D array of ndbi values in the range [-1, 1]. All other input attributes are preserved.
- Return type:
xr.DataArray of same type as inputs
References
Zha, Y., Gao, J. and Ni, S., 2003. Use of normalized difference built-up index in automatically mapping urban areas from TM imagery. International Journal of Remote Sensing, 24(3), pp.583-594.
Examples
>>> import numpy as np >>> import xarray as xr >>> from xrspatial.multispectral import ndbi >>> swir1 = xr.DataArray(np.array([[600., 500.], [400., 300.]])) >>> nir = xr.DataArray(np.array([[300., 400.], [500., 600.]])) >>> ndbi(swir1, nir).values array([[ 0.33333334, 0.11111111], [-0.11111111, -0.33333334]], dtype=float32)