pyflwdir.from_dem#

pyflwdir.from_dem(data: ndarray, nodata: float = -9999.0, max_depth: float = -1.0, transform: Affine = Affine(1.0, 0.0, 0.0, 0.0, -1.0, 0.0), latlon: bool = False, outlets: Literal['edge', 'min'] = 'edge') → FlwdirRaster[source]#

Derive local D8 flow directions from digital elevation data.

Outlets are assumed to only occur at the edge of valid elevation cells. Depressions elsewhere are filled to their lowest pour-point elevation. If the pour point depth is greater than or equal to max_depth, a pit is set at the depression’s 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 pits. A negative value (default) represents 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'}, optional) – Place outlets at all valid edge cells (‘edge’, default) or only at the lowest-elevation valid edge cell (‘min’).

Returns:

Actionable flow direction object

Return type:

FlwdirRaster