hydromt.flw.d8_from_dem#

hydromt.flw.d8_from_dem(da_elv: DataArray, gdf_stream: GeoDataFrame | None = None, max_depth: float = -1.0, outlets: str = 'edge', idxs_pit: ndarray | None = None, **kwargs) DataArray[source]#

Derive D8 flow directions grid from an elevation grid.

Outlets occur at the edge of valid data or at user defined cells (if idxs_pit is provided). A local depressions is filled based on its lowest pour point level if the pour point depth is smaller than the maximum pour point depth max_depth, otherwise the lowest elevation in the depression becomes a pit.

Parameters:
  • da_elv (2D xarray.DataArray) – elevation raster

  • gdf_stream (geopandas.GeoDataArray, optional) – stream vector layer with ‘uparea’ [km2] column which is used to burn the river in the elevation data.

  • 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 infinitely large pour point depth causing all depressions to be filled.

  • outlets ({'edge', 'min'}) – Position for basin outlet(s) at the all valid elevation edge cell (‘edge’) or only the minimum elevation edge cell (‘min’)

  • idxs_pit (1D array of int) – Linear indices of outlet cells.

  • **kwargs – Additional keyword arguments that are passed to the fill_depressions function.

Returns:

da_flw – D8 flow direction grid

Return type:

xarray.DataArray

See also

pyflwdir.dem.fill_depressions