xrspatial.flood.vegetation_roughness#
- xrspatial.flood.vegetation_roughness(vegetation_agg: DataArray, mode: str = 'nlcd', lookup: dict | None = None, name: str = 'mannings_n') DataArray[source]#
Derive Manning’s n roughness from land cover or NDVI.
- Parameters:
vegetation_agg (xarray.DataArray) – 2D raster. For
mode='nlcd'this should contain integer NLCD land cover codes. Formode='ndvi'this should contain continuous NDVI values (typically -1 to 1).mode ({'nlcd', 'ndvi'}, default 'nlcd') –
How to convert vegetation data to roughness.
'nlcd': categorical lookup from NLCD codes to Manning’s n.'ndvi': piecewise linear interpolation of NDVI to Manning’s n.
lookup (dict, optional) – Override the default NLCD-to-n mapping. Keys are integer NLCD codes, values are Manning’s n floats. Only used when
mode='nlcd'.name (str, default 'mannings_n') – Name of the output DataArray.
- Returns:
2D float64 Manning’s n raster. Unrecognized NLCD codes and NaN inputs map to NaN.
- Return type:
xarray.DataArray
Notes
Supports NumPy, CuPy, Dask with NumPy, and Dask with CuPy backed xarray DataArrays.
Examples
>>> import numpy as np >>> import xarray as xr >>> from xrspatial import vegetation_roughness >>> nlcd = xr.DataArray( ... np.array([[41, 71], [11, 82]], dtype=np.int32), ... dims=['y', 'x']) >>> roughness = vegetation_roughness(nlcd, mode='nlcd')