pyflwdir.from_dem#

pyflwdir.from_dem(data, nodata=-9999.0, max_depth=-1.0, transform=Affine(1.0, 0.0, 0.0, 0.0, -1.0, 0.0), latlon=False, outlets='edge')[source]#

Flow direction raster derived from digital elevation data based on steepest gradient.

Outlets are assumed to only occur at the edge of valid elevation cells. 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

NOTE: to retrieve the depression filled dem, use the pyflwdir.dem.fill_depressions() method.

Parameters:
  • data (2D array) – digital elevation data

  • nodata (float, optional) – Missing data 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 infinitely large pour point depth causing all depressions to be filled.

  • transform (affine transform) – Two dimensional affine transform for 2D linear mapping, by default using the identity transform.

  • latlon (bool, optional) – True if WGS84 coordinate reference system, by default False. If True it converts the cell areas from degree to metres, otherwise it assumes cell areas are in unit metres.

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

Returns:

Actionable flow direction object

Return type:

FlwdirRaster