Partition methods#

A partition divides a raster into parts, for upstream accumulation in processes. It is an optional feature: install it with pip install pyflwdir[partition].

FlwdirRaster.partition() divides the raster into one part a process and returns a partition.PartitionPlan: the part of each cell, the cell count of each part, and the opened mainstem sections, which the accumulation finishes last. partition.partition_plan() is the function behind it.

Upstream accumulation is the only computation that uses a plan: pass it as partition_plan to FlwdirRaster.accuflux() or FlwdirRaster.upstream_area(), with parallel=True. The accumulation checks the plan against the flow directions first, and one plan serves any number of calls. Making a plan does not make any other method run in parallel.

A tributary subtree is never cut, so the heaviest part is at least as heavy as the largest subtree of an opened basin, however many parts are asked.

partition.partition_plan(flw[, level, ...])

Divide a raster into parts, and return how the opened mainstems connect to them.

partition.PartitionPlan(parts, loads, ...[, ...])

How the cells of a raster divide over processes, from pyflwdir.FlwdirRaster.partition().

partition.MainstemSection(mainstem, ...)

The cells of one opened mainstem that are accumulated after the parts.