pyflwdir.FlwdirRaster.path#

FlwdirRaster.path(idxs=None, xy=None, mask=None, max_length=None, unit='cell', direction='down')[source]#

Returns paths of indices in down- or upstream direction from the starting points until: 1) a pit is found (including) or now more upstream cells are found; or 2) a True cell is found in mask (including); or 3) the max_length threshold is exceeded.

To define starting points, either idxs or xy should be provided.

Parameters:
  • idxs (array_like, optional) – linear indices of starting point, by default is None.

  • xy (tuple of array_like of float, optional) – x, y coordinates of starting point, by default is None.

  • mask (2D array of bool, optional) – True if stream cell.

  • max_length (float, optional) – maximum length of trace

  • unit ({'m', 'cell'}, optional) – unit of length, by default ‘cell’

  • direction ({'up', 'down'}, optional) – direction of path, be default ‘down’, i.e. downstream

Returns:

  • list of 1D-array of int – linear indices of path

  • 1D-array of float – distance along path between start and end cell