pyflwdir.FlwdirRaster.interbasin_mask#

FlwdirRaster.interbasin_mask(region: ndarray, stream: ndarray | None = None) → ndarray[source]#

Return a mask for the most downstream contiguous area within a region.

If a stream enters and leaves the region, only the downstream portion within the region is included. If stream is provided, the mask is further restricted to cells that drain to a stream cell.

Parameters:
  • region (2D array of bool) – Boolean mask of the region.

  • stream (2D array of bool, optional) – Boolean mask of stream cells.

Returns:

mask – True for cells in the selected area.

Return type:

2D array of bool