pyflwdir.FlwdirRaster.snap#
- FlwdirRaster.snap(idxs=None, xy=None, mask=None, max_length=None, unit='cell', direction='down')[source]#
- Returns the last index in down- or upstream direction from the starting points where: - a pit is found (including) or now more upstream cells are found; or 
- a True cell is found in mask (including) 
- 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) – True at cell where to snap to 
- 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:
- array_like of int – linear index of snapped cell 
- array_like of float – distance along path between start and snap cell. 
 
 
