pyflwdir.partition.PartitionPlan#
- class pyflwdir.partition.PartitionPlan(parts: ndarray, loads: ndarray, basin_ids: ndarray, level: str, stems: tuple[MainstemSection, ...] = ())[source]#
How the cells of a raster divide over processes, from
pyflwdir.FlwdirRaster.partition().Pass it as
partition_plantopyflwdir.FlwdirRaster.upstream_area()orpyflwdir.FlwdirRaster.accuflux(), withparallel=True, to accumulate each part in its own process. The accumulation checks it against the flow directions first and refuses a plan that does not fit them.- parts#
Label of each cell, shaped like the raster: from 0 to
n - 1in a part,nin a mainstem section, and -1 off the network, on a basin of a single cell, and in or draining into a loop of the flow directions, wherenisloads.size, the number of parts and of processes.- Type:
ndarray of int32
- loads#
Cell count of each part. The mainstem sections are excluded.
- Type:
ndarray of int64
- basin_ids#
Basin label of each cell, shaped like the raster: those of
pyflwdir.FlwdirRaster.basins(), 0 off the network.- Type:
ndarray of int
- level#
The partition level.
- Type:
{‘basin’, ‘subbasin’}
- stems#
One section per opened basin; empty at basin level.
- Type:
- __init__(parts: ndarray, loads: ndarray, basin_ids: ndarray, level: str, stems: tuple[MainstemSection, ...] = ()) None#
Methods
__init__(parts, loads, basin_ids, level[, stems])Attributes
cut_inletsThe
cut_inletsof all sections; the accumulation readsstems.cut_outletsThe
cut_outletsof all sections; the accumulation readsstems.cut_partsThe
cut_partsof all sections, one after the other.mainstemThe cells of every mainstem section, for plotting and inspection.