pyflwdir.dem.fill_depressions#

pyflwdir.dem.fill_depressions(elevtn, outlets='edge', idxs_pit=None, nodata=-9999.0, max_depth=-1.0, elv_max=None, connectivity=8)[source]#

Fill local depressions in elevation data and derived local D8 flow directions.

Outlets are assumed to occur at the edge of valid elevation cells outlets=’edge’; at the lowest valid edge cell to create one single outlet outlets=’min’; or at user provided outlet cells idxs_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_depth a pit is set at the depression local minimum elevation.

Based on: Wang, L., & Liu, H. (2006). https://doi.org/10.1080/13658810500433453

Parameters:
  • elevtn (2D array) – elevation raster

  • nodata (float, optional) – nodata value, by default -9999.0

  • 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.

  • connectivity ({4, 8}) – Number of neighboring cells to consider.

  • outlets ({'edge', 'min'}) – Initial basin outlet(s) at the edge of all cells (‘edge’; default) or only the minimum elevation edge cell (‘min’)

  • elv_max – Maximum elevation for outlets, only in combination with outlets=’edge’. By default None.

  • float – Maximum elevation for outlets, only in combination with outlets=’edge’. By default None.

  • optional – Maximum elevation for outlets, only in combination with outlets=’edge’. By default None.

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

Returns:

  • elevtn_out (2D array) – Depression filled elevation

  • d8 (2D array of uint8) – D8 flow directions