Skip to main content

split_basins

split_basins

Split basins in a Ribasim model, based on pre-split basin polygons, or along a route.

Classes

Name Description
NodeMetaCache Caching of ‘meta_categorie’-data
SplitBasins Replace one basin by pre-split basin polygons and reconnect its links.

NodeMetaCache

split_basins.NodeMetaCache(model)

Caching of ‘meta_categorie’-data

Methods

Name Description
get_meta_category Get the ‘meta_categorie’-data.
set_meta_category (Re)set the ‘meta_category’-data.
get_meta_category
split_basins.NodeMetaCache.get_meta_category(model)

Get the ‘meta_categorie’-data.

set_meta_category
split_basins.NodeMetaCache.set_meta_category(model, fill_nan=True)

(Re)set the ‘meta_category’-data.

Optionally set all non-cached ‘meta_categorie’-data to ‘hoofdwater’ (default).

SplitBasins

split_basins.SplitBasins(
    model,
    splitted_basin_path,
    basin_node_id_to_split,
    geometry_tolerance=1.0,
    printing=False,
)

Replace one basin by pre-split basin polygons and reconnect its links.

Methods

Name Description
add_manning_nodes_between_splitted_basins Add ManningResistance nodes between split basin polygons that share a boundary face. A ManningResistance node is added at the centroid of the shared boundary face and connected to the two basins with links. This ensures that water can flow between the newly created basins. They are added on each face. This may be redundant, but this will improve recognizability of the model and is not expected to cause performance issues, since the number of basins that are split and the number of shared faces is expected to be low.
create_new_basins Create basin nodes and basin tables for each supplied split basin polygon.
redirect_connectors_to_new_basins Redirect links connected to the original basin to the nearest new split basin.
run Run the full split workflow and return the updated model.
add_manning_nodes_between_splitted_basins
split_basins.SplitBasins.add_manning_nodes_between_splitted_basins(
    newly_created_basins,
)

Add ManningResistance nodes between split basin polygons that share a boundary face. A ManningResistance node is added at the centroid of the shared boundary face and connected to the two basins with links. This ensures that water can flow between the newly created basins. They are added on each face. This may be redundant, but this will improve recognizability of the model and is not expected to cause performance issues, since the number of basins that are split and the number of shared faces is expected to be low.

create_new_basins
split_basins.SplitBasins.create_new_basins()

Create basin nodes and basin tables for each supplied split basin polygon.

redirect_connectors_to_new_basins
split_basins.SplitBasins.redirect_connectors_to_new_basins(newly_created_basins)

Redirect links connected to the original basin to the nearest new split basin.

run
split_basins.SplitBasins.run()

Run the full split workflow and return the updated model.

Functions

Name Description
split_basin_along_route Split a Basin in sections along route, connected in the direction of route by ManningResistances.

split_basin_along_route

split_basins.split_basin_along_route(
    model,
    basin_id,
    route,
    split_points,
    basin_names,
    manning_names,
    *,
    manning_n,
    profile_slope,
    cross_section_length=5000.0,
)

Split a Basin in sections along route, connected in the direction of route by ManningResistances.

route runs through the Basin area in the direction of flow, for instance along the links of its main channel. The ManningResistances lie on it at the points nearest to split_points, where the Basin area is cut across it. The section that contains the Basin node keeps it; the others get a new Basin node on the route, halfway between where their inflows and outflows join it, so their links do not run back along the route. Each section gets the profile of the Basin with its area scaled by the share of the section in the length of the route within the Basin, so the volume is divided in proportion, and copies of the other tables of the Basin. The flow links of the Basin, which keep their IDs, move to the section where they join the route, and run along the route to its node. The ManningResistances get manning_n, profile_slope, the width of the Basin area across the route, and the length of their links, which run along the route from Basin node to Basin node.

Parameters

Name Type Description Default
model Model model to update in place required
basin_id int Basin to split, with a single area required
route LineString line through the Basin area in the direction of flow required
split_points Sequence[Point] where to split the Basin, in the order of the route required
basin_names Sequence[str] names of the sections, one more than split_points required
manning_names Sequence[str] names of the ManningResistances, one per split point required
manning_n float Manning roughness of the ManningResistances [s/m^(1/3)] required
profile_slope float profile slope of the ManningResistances [-] required
cross_section_length float maximum width of the Basin area across the route [m] 5000.0

Returns

Name Type Description
tuple[list[int], list[int]] the Basin node IDs of the sections and the ManningResistance node IDs, in the order of the route