py3dep.geoops#
Utilities for Py3DEP.
Module Contents#
- py3dep.geoops.deg2mpm(slope)#
Convert slope from degrees to meter/meter.
- Parameters:
slope (
xarray.DataArray) – Slope in degrees.- Returns:
xarray.DataArray– Slope in meter/meter. The name is set toslopeand theunitsattribute is set tom/m.- Return type:
- py3dep.geoops.fill_depressions(elevtn, outlets='min', idxs_pit=None, nodata=np.nan, max_depth=-1.0, elv_max=None, connectivity=8)#
Fill local depressions in elevation data based on Wang and Liu (2006).
Note
This function is based on the
fill_depressionsfunction from the pyflwdir package. This function improves the performance of the original function by a factor of up to 2 and adds more input checks. Additionally, it works withxarray.DataArrayobjects.Outlets are assumed to occur at the edge of valid elevation cells
outlets='edge'; at the lowest valid edge cell to create one single outletoutlets='min'; or at user provided outlet cellsidxs_pit.Depressions elsewhere are filled based on its lowest pour point elevation. If the pour point depth is larger than the maximum pour point depth
max_deptha pit is set at the depression local minimum elevation.Wang, L., & Liu, H. (2006). https://doi.org/10.1080/13658810500433453
- Parameters:
elevtn (
numpy.ndarrayorxarray.DataArray) – elevation raster as a 2Dnumpy.ndarrayorxarray.DataArray.outlets (
{"edge", "min}, optional) – Initial basin outlet(s) at the edge of all cells (‘edge’) or only the minimum elevation edge cell (‘min’; default)idxs_pit (
1D arrayofint, optional) – Linear indices of outlet cells, in any, defaults to None.nodata (
float, optional) – nodata value, defaults tonumpy.nan.max_depth (
float, optional) – Maximum pour point depth. Depressions with a larger pour point depth are set as pit. A negative value (default) equals an infitely large pour point depth causing all depressions to be filled. Defaults to -1.0.elv_max, float, optional – Maximum elevation for outlets, only in combination with
outlets='edge'. By defaultNone.connectivity (
{4, 8}, optional) – Number of neighboring cells to consider, defaults to 8.
- Returns:
elevtn_out (
numpy.ndarray) – Depression filled elevation with type float32.- Return type:
DataArray