Skip to main content

Profile generation

The level controlled models get representative profiles of their water bodies in the profiles_<water board> stages. The profiles – represented by \(A(h)\)-relations – largely determine the retention time of water in a basin, where the distinction between doorgaand and bergend is crucial: doorgaand represents flowing water bodies, while bergend represents stagnant water bodies. This makes them mainly relevant for water quality simulations.

These profiles also form the basis for the coupling with the groundwater modelling, and their hydro-objects, verwerkt/profielen/network.gpkg, guide the layout of the model. The gravity controlled models get their profiles in other ways, see storage basins.

Map of a network of ditches in which the main routes are thick and blue and the side ditches thin and orange, with one Basin area in grey.

The hydro-objects of Delfland near Delft. Those on the shortest paths between the crossings of a Basin are doorgaand, and the others bergend.

Chart of level against area with two lines: doorgaand from about 23 to 27 ha and bergend from about 16 to 17 ha.

The resulting area by level of that Basin, and of its storage Basin.

Profile generation workflow

flowchart LR
  bgt["BGT water surfaces"] --> width
  hydro["hydro-objects,<br>crossings"] --> paths["doorgaand or bergend,<br>by shortest paths"]
  paths --> width["Width from the<br>BGT surface"]
  width --> depth["Depth from hydrotype,<br>or measured"]
  xs["measured cross-sections"] --> depth
  depth --> ah["A(h) of doorgaand<br>and bergend"]
  ah --> model["Basin / profile,<br>storage Basins"]

Profiles are generated per water authority, as (1) data sources are available per water authority, and (2) data sources are formatted differently per water authority.

Prior to generating the profiles, the data is preprocessed:

  1. Preprocessing of data sources, which includes generating LINESTRING Z-objects of measured cross-sections, sorting the hydro-objects and crossings by their geometry, so that the shortest paths, and with them the profiles, do not depend on the order of the rows, see path_finder.canonical, removing duplicate hydro-objects, repairing hydro-objects along HyDAMO-standards, reading the current BGT water surfaces of the area from the national data/Basisgegevens/BGT/bgt_water.parquet, see ribasim_nl.bgt_water.

Subsequently, the following steps are executed on a per-basin basis:

  1. Select relevant hydro-objects and crossings (i.e., within a basin). Hydro-objects count with their whole length in the basins they overlap by more than \(1\,\mathrm{mm}\), and not in those they only touch, see path_finder.overlaps;
  2. Generate graph (or network) from hydro-objects (using networkx);
  3. Determine the shortest path(s) between crossings, which separates the hydro-objects as doorgaand versus bergend;
  4. Couple BGT-polygons to hydro-objects (non-intersecting BGT-polygons will be classified as bergend at a later stage);
  5. Estimate representative width per hydro-object based on coupled BGT-polygon’s surface area and circumference;
  6. Estimate representative depth per hydro-object based on width and hydrotope (using a look-up table);
  7. Update representative depth of hydro-objects labelled as doorgaand using measured cross-sections, if available: the mean depth of the cross-sections they cross, below the target level of the peilgebied of each cross-section, the smallest where peilgebieden overlap. Bed levels outside \(-50\) to \(+50\,\mathrm{m}\) NAP are errors or no-data values, and are left out;
  8. Define a trapezoidal cross-sectional profile using the representative width and depth (and a slope of \(1:3\), default);
  9. Define the \(A(h)\)-relation for doorgaand and bergend separately using the length of the hydro-objects;
  10. Correct the \(A(h)\)-relation of bergend by including non-intersecting BGT-polygons’ surface areas (as preluded to in 5.);
  11. Write two basin profile tables with \(A(h)\)-relations: one for doorgaand, and one for bergend.

During model implementation, generated profiles whose maximum area is below \(100\,\mathrm{m^2}\) are discarded. Every retained profile area is then clamped to at least \(10\,\mathrm{m^2}\). If only one of the doorgaand or bergend profiles survives for a basin, it is used for the existing basin without adding a separate storing basin. When neither profile survives, the model receives a two-point fallback profile with an area of \(10\%\) of its basin polygon, subject to the \(10\,\mathrm{m^2}\) minimum, at both \(2\ \mathrm{m}\) below its target level and at its target level. If no storing basins remain, implementation still updates the existing basins’ profiles and leaves the network unchanged. This prevents dummy and very small generated profiles from reaching the solver.

Some water boards differ from these steps. Hollandse Delta and Scheldestromen flag a predefined main route, gen_profiles.flagged_hydro_objects, instead of searching shortest paths. Hollands Noorderkwartier has no measured cross-sections, and Rijnland overrides the depths of its water bodies.

Profile generation code

The source code is in src/ribasim_nl/ribasim_nl/profiles. The profiles_<water board> DVC stages run the two scripts, for instance:

pixi run dvc repro --pull --single-item profiles_delfland
  1. pipeline/prep_cross_sections.py preprocesses the measured cross-sections into LINESTRING Z-objects.
  2. pipeline/<water board>/02_profiles.py generates the profile tables, and implement.set_basin_profiles sets them in the model, and adds the storage Basins with their ManningResistances.

To run them yourself, per water authority, with the cross-sections first:

pixi run python pipeline/prep_cross_sections.py <water board>
pixi run python pipeline/<water board>/02_profiles.py

The results are in verwerkt/profielen:

File Content
network.gpkg The hydro-objects with their main-route, used for the layout.
profielen_doorgaand.csv, profielen_bergend.csv The tables with the \(A(h)\)-relations.
intermediate/lines_z.gpkg The preprocessed cross-sections.
intermediate/int_output.gpkg For inspection: main-route, endpoints, bgt, hydro-objects, basin_profiles_doorgaand and basin_profiles_bergend.
intermediate/graph.gpkg For inspection: the graph of the network.

Only network.gpkg is an output of DVC, so the others are there after running the stage yourself.