pyflwdir.FlwdirRaster.inflow_idxs#

FlwdirRaster.inflow_idxs(region: ndarray) → ndarray[source]#

Return linear indices of the most upstream cells within a region.

Parameters:

region (2D array of bool) – True for cells inside the region.

Returns:

Linear indices of the most upstream cells in region.

Return type:

1D array of int

Notes

The cells follow the sequence set with order_cells, so their order changes with the method. Which cells are returned depends on which upstream cell of a confluence comes first in the sequence. “dfs” and “walk” both put the upstream cell with the lowest index first, so they return the same cells; “sort” and “topo” can put another one first and return other cells.