norm_diff#

geowombat.norm_diff(data, b1, b2, sensor=None, nodata=None, mask=False, scale_factor=None)#

Calculates the normalized difference band ratio

Parameters:
  • data (DataArray) – The xarray.DataArray to process.

  • b1 (str) – The band name of the first band.

  • b2 (str) – The band name of the second band.

  • sensor (Optional[str]) – sensor (Optional[str]): The data’s sensor. If None, the band names should reflect the index being calculated.

  • nodata (Optional[int or float]) – A ‘no data’ value to fill NAs with. If None, the ‘no data’ value is taken from the xarray.DataArray attributes.

  • mask (Optional[bool]) – Whether to mask the results.

  • scale_factor (Optional[float]) – A scale factor to apply to the data. If None, the scale value is taken from the xarray.DataArray attributes.

Equation:

\[{norm}_{diff} = \frac{b2 - b1}{b2 + b1}\]
Returns:

Data range: -1 to 1

Return type:

xarray.DataArray