hydromt.flw.d8_from_dem#

hydromt.flw.d8_from_dem(da_elv: ~xarray.core.dataarray.DataArray, max_depth: float = -1.0, outlets: ~typing.Literal['edge', 'min', 'idxs_pit'] = 'edge', idxs_pit: ~numpy.ndarray | None = None, gdf_riv: ~geopandas.geodataframe.GeoDataFrame | None = None, riv_burn_method: ~typing.Literal['fixed', 'rivdph', 'uparea'] = 'fixed', riv_depth: float = 5, logger=<Logger hydromt.flw (WARNING)>, **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

  • 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', 'idxs_pit'}) – Position of basin outlet(s) If ‘edge’ (default) all valid elevation edge cell are considered. If ‘min’ only the global minimum elevation edge cell is considered and all flow is directed to this cell. If ‘idxs_pit’ the linear indices of the outlet cells are provided in idxs_pit.

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

  • gdf_riv (geopandas.GeoDataArray, optional) – River vector data. If provided, the river cells are burned into the dem. Different methods can be used to burn in the river cells, see riv_burn_method.

  • riv_burn_method ({'uparea', 'rivdph', 'fixed'}, optional) – Method to burn in river vector to aid the flow direction derivation, requires gdf_riv. If ‘fixed’ (default) a fixed river depth rivdph value is used to burn in the river cells. If ‘rivdph’ the rivdph column is used to burn in the river cells directly. If ‘uparea’ the uparea column is used to create a synthetic river depth based on max(1, log10(uparea[m2])).

  • riv_depth (float) – fixed depth value used to burn in the dem

  • **kwargs – Additional keyword arguments that are passed to the pyflwdir.dem.fill_depressions() function.

Returns:

da_flw – D8 flow direction grid

Return type:

xarray.DataArray

See also

pyflwdir.dem.fill_depressions