flowchart LR hydamo["hydamo.gpkg<br>watercourses, structures"] --> lump input["ribasim_input.gpkg<br>split nodes, boundaries"] --> lump areas["areas.gpkg<br>areas, drainage areas"] --> lump lump(["Lumping<br>00b_lump_model.py"]) --> model["Input model<br><authority>_2024_6_3"] model --> fix(["Fix script<br>01_fix_model.py"]) edits["model_edits.gpkg<br>edits by node ID"] --> fix fix --> fixed["Fix model<br><authority>_fix_model"] classDef step fill:#dfedef,stroke:#0c6a77 class lump,fix step
Lumping
The regional model of a gravity controlled water authority starts with two steps. The lumping turns the watercourses, structures and areas of the authority into an input model. The fix script then corrects that model, mostly with edits made by hand. Every map on this page shows the same 5 × 5 km of Drents Overijsselse Delta near Kampen.
The code is in ribasim_nl.lumping, a port of the ribasim_lumping code with which Sweco made these models in 2024, see Reproducing models. Noorderzijlvest is lumped from its D-HYDRO model instead, with pipeline/noorderzijlvest/00_lump_model.py.
1. The inputs
Three files describe the area. The watercourses come from the HyDAMO data of the water authority. verwerkt/3_input/ribasim_input.gpkg holds the split nodes: the weirs, pumping stations, culverts and other structures where the model splits the network. It also holds the boundaries, where water enters or leaves the area of the authority. verwerkt/3_input/areas.gpkg holds the areas that will make up the basin areas, here the level areas (peilgebieden), grouped in drainage areas.
2. Split the network into basins
The lumping cuts the watercourses into edges of about 250 m, and then cuts the network at every split node. Each piece that stays connected is a basin.
A basin between a boundary and the split node next to it is dropped, and the boundary connects straight to that split node. Where a boundary has no split node, its basin stays.
3. Give every area to a basin
Each area goes to the basin with the most watercourse length inside it. Areas without a watercourse go to the neighbouring basin they share the longest border with, preferably in the same drainage area. Gaps of up to 5000 m² between the areas are filled, and each basin gets one basin area.
A basin can end up without any area. The level areas here are large and cross several basins, so basin 1665 gets 1134 ha, including the areas around the canal of basin 1597, while basins 1597 and 1740 get none. The fix script deals with that in step 5.
4. Write the input model
Each basin becomes a Basin node, and each split node a connector by the type of its structure:
| Structure | Node |
|---|---|
| Weir | TabulatedRatingCurve |
| Pumping station | Pump |
| Culvert, open water | ManningResistance |
| Sluice, valve | Outlet |
The boundaries become LevelBoundaries or FlowBoundaries, and the links follow the direction of flow. Nodes on a KRW water body get meta_categorie hoofdwater.
5. Correct the model in the fix script
pipeline/drents_overijsselse_delta/01_fix_model.py corrects the input model by node ID. It removes and merges nodes, adds basins and connectors, and reverses or redirects links. Most edits are rows in verwerkt/model_edits.gpkg. In this window, merge_basins merges basins 1597 and 1665 into 1740, which takes over the 1134 ha of 1665, and remove_node removes LevelBoundary 5 and Outlet 535.
The last step, Model.fill_basin_area_holes, gives every part of an area that the edits left without a basin to a basin, by the same rules as the lumping. It also checks that every Basin has an area.
model = Model.read(input_model_toml)
# edits by node ID
model.remove_node(7, remove_links=True)
# the rows of model_edits.gpkg
model.apply_edits(model_edits_path, actions)
...
# last: every area to a Basin
model.fill_basin_area_holes(areas_gpkg)
model.write(fix_model_toml)



