Reference the inland German waterways to low water - #156
Draft
bkeepers wants to merge 3 commits into
Draft
Conversation
This was referenced Aug 15, 2026
bkeepers
added a commit
that referenced
this pull request
Aug 15, 2026
The reach merge is last-wins where corridors overlap, and the ramps are painted after the tidal/Stauziel surfaces, so an unclipped ramp corridor overrode its neighbour: the Rhein ramp reached south past Iffezheim and replaced the pool Stauziele with its clamped endpoint GlW (20 m+ error), and the Elbe MNW ramp bled west over the tidal SKN corridor at Geesthacht (metres too deep). The ramps now stop at the Iffezheim barrage latitude and the Geesthacht weir longitude via fill_corridor's row/column bounds. Found by review on PR #156.
There was a problem hiding this comment.
Pull request overview
Extends the existing WSV DGM-W source from tidal-only coverage to include multiple inland German waterways by generating a per-reach low-water reference surface (ramps from gauge characteristic values and stepped pool surfaces from barrage tables), then activating the additional inland tiles and documenting the methodology.
Changes:
- Expands
dgm_w_lowwatersurface generation to merge tidal SKN, free-flowing ramp surfaces (GlW/MNW), and impounded step surfaces (Stauziel) into a single datum raster. - Adds reproducible, checked-in gauge extracts (
*_glw.csv,*_mnw.csv,*_zs.csv), barrage tables (*_stau.csv), and river geometry (*_river.wkt,*_centerline.wkt) plus refresh scripts. - Activates the newly supported inland waterways in
sources/dgm_w/file_list.txtand updates metadata/docs to reflect the broader scope.
Reviewed changes
Copilot reviewed 34 out of 34 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| Snakefile | Updates the datum_surface_dgm_w rule inputs to include all reach CSV/WKT dependencies. |
| sources/README.md | Updates the sources catalog entry to reflect inland DGM-W coverage and datum regimes. |
| sources/dgm_w/README.md | Documents inland reach methodology (ramps/steps), inputs, refresh scripts, and active/deferred reaches. |
| sources/dgm_w/metadata.json | Updates the source name and expands datum description to include inland regimes and active reaches. |
| sources/dgm_w/file_list.txt | Activates inland DGM-W tiles and adds reach-by-reach commentary on datum references. |
| sources/dgm_w/build_reference.py | Major expansion: builds and merges SKN + ramp + step reference rasters into dgm_w_lowwater.tif. |
| sources/dgm_w/harvest_gauges.py | New script to regenerate committed gauge characteristic-value CSV inputs from PEGELONLINE. |
| sources/dgm_w/build_geometry.py | New script to regenerate corridor/centerline WKTs from Overture base/water for reproducibility. |
| sources/dgm_w/tideelbe_skn.csv | Adds a Geesthacht weir anchor row to extend the inner-tidal Elbe SKN fill to the regime boundary. |
| sources/dgm_w/rhein_glw.csv | Adds harvested Rhine GlW-in-NHN gauge reference inputs for the free-flowing ramp reach. |
| sources/dgm_w/elbe_mnw.csv | Adds harvested Elbe MNW-in-NHN gauge reference inputs for the free-flowing ramp reach. |
| sources/dgm_w/oder_mnw.csv | Adds harvested Oder MNW-in-NHN gauge reference inputs for the free-flowing ramp reach. |
| sources/dgm_w/weser_mnw.csv | Adds harvested Weser MNW-in-NHN gauge reference inputs for the free-flowing ramp reach. |
| sources/dgm_w/main_zs.csv | Adds harvested Main ZS_I-in-NHN gauge inputs used to cross-check the Main Stauziel table. |
| sources/dgm_w/main_stau.csv | Adds Main barrage Stauziel levels + OSM weir-line endpoints for exact pool step dividers. |
| sources/dgm_w/main_centerline.wkt | Adds Main centerline geometry used to constrain the step fill corridor. |
| sources/dgm_w/rhein_stau.csv | Adds upper Rhine barrage Stauziel levels + lock coords used for latitude-stepped pool dividers. |
| sources/dgm_w/rhein_centerline.wkt | Adds upper Rhine navigation-centerline geometry used to constrain the step fill corridor. |
| sources/dgm_w/mosel_zs.csv | Adds harvested Mosel ZS_I gauge inputs used to cross-check the Mosel Stauziel staircase. |
| sources/dgm_w/mosel_stau.csv | Adds Mosel barrage Stauziel staircase table used for impounded step surface generation. |
| sources/dgm_w/saar_zs.csv | Adds harvested Saar ZS_I gauge inputs used to cross-check the Saar Stauziel staircase. |
| sources/dgm_w/saar_stau.csv | Adds Saar barrage Stauziel staircase table (including Konz backwater stub anchoring). |
| sources/dgm_w/saar_river.wkt | Adds Saar corridor geometry used to bound the filled reference surface to the river. |
| sources/dgm_w/saar_centerline.wkt | Adds Saar centerline geometry used for arc-length pool assignment. |
| sources/dgm_w/lahn_zs.csv | Adds harvested Lahn ZS_I gauge inputs used to cross-check the Lahn Stauziel staircase. |
| sources/dgm_w/lahn_stau.csv | Adds Lahn weir Stauziel staircase table (from WSV/WSA-Koblenz fact sheets). |
| sources/dgm_w/lahn_river.wkt | Adds Lahn corridor geometry used to bound the filled reference surface to the river. |
| sources/dgm_w/lahn_centerline.wkt | Adds Lahn centerline geometry used for arc-length pool assignment. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+87
to
+90
| weir = None | ||
| if r.get("lon1", "").strip(): | ||
| weir = ((float(r["lon1"]), float(r["lat1"])), (float(r["lon2"]), float(r["lat2"]))) | ||
| rows.append({"km": float(r["km"]), "stau": float(r["stauziel_nhn_m"]), "weir": weir}) |
Extends the DGM-W datum surface beyond the tidal SKN reach to the inland waterways, where no low-water grid is published and the reference has to be fabricated per hydraulic regime: - Free-flowing rivers (Rhein below Iffezheim, upper Elbe, Grenzoder, Ober-/Mittelweser): a low-water ramp — per-gauge GlW (or MNW where GlW is un-published, the conservative proxy) interpolated by arc-length along the gauge line and painted over the Overture river corridor. - Impounded canalised rivers (Main, upper Rhein, Mosel, Saar, Lahn): a Stauziel step — flat per pool, jumping at each barrage (weir lines on the Main, latitude on the due-north upper Rhein, centerline arc-length elsewhere), cross-checked against PEGELONLINE ZS_I gauges where they exist. harvest_gauges.py (PEGELONLINE characteristic values) and build_geometry.py (Overture corridors/centerlines) refresh the checked-in CSVs/WKTs; the build reads only the committed files. build_reference.py now merges all ten reaches onto the finest grid for the single store/datum raster. 68 inland tiles activate; only the tidal Ems and the gauge-less canals stay deferred. Extracted from the add-source-wsv-dgmw branch (PR #76).
The reach merge is last-wins where corridors overlap, and the ramps are painted after the tidal/Stauziel surfaces, so an unclipped ramp corridor overrode its neighbour: the Rhein ramp reached south past Iffezheim and replaced the pool Stauziele with its clamped endpoint GlW (20 m+ error), and the Elbe MNW ramp bled west over the tidal SKN corridor at Geesthacht (metres too deep). The ramps now stop at the Iffezheim barrage latitude and the Geesthacht weir longitude via fill_corridor's row/column bounds. Found by review on PR #156.
The pool-index clip assigned the most-downstream pool's Stauziel to pixels past its barrage (the Main mouth got Kostheim's 83.9 m over Rhein backwater at ~81.5 m — the deep direction). All three step builders now return nodata there: the mouth is the neighbouring reach's backwater and the ramps cover it where their corridors reach. Also parenthesize the datum rule's multi-line input concatenation for clarity. Review comments on PR #156.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Second half of the #76 split, stacked on #155: activates the 68 inland DGM-W tiles by fabricating the low-water reference surface where Germany publishes none. Closes #53.
Inland riverbeds sit tens of metres above MSL, so without a reference they render as land. There is no packaged low-water grid for any of these rivers; the surface is assembled per hydraulic regime from gauge data and transcribed barrage tables:
Two refresh scripts keep the checked-in inputs reproducible, and neither runs in the build:
harvest_gauges.pypulls per-gauge low-water values (GlW/ZS_I/MNW in NHN) from PEGELONLINE, andbuild_geometry.pyextracts river corridors and centerlines from Overture Maps.build_reference.pybuilds the ten reaches and merges them onto the finest grid, since the datum store serves a single raster per surface name.Caveat worth knowing at review: the Mittelweser is impounded but publishes no ZS_I, so the Weser ramp smooths its pool steps by ~1–2 m at each barrage. Documented in the README, upgradeable to a proper step reach if a level table surfaces.
Still deferred:
build_reference.py --outrun before any production dispatchclamp_positiveclamp against the OSM land–water mask so drying flats survive (shared with the tidal PR)Not for navigation. References: PEGELONLINE characteristic values (WSV), Overture Maps geometry, barrage tables transcribed from Wikipedia and WSV fact sheets (sources cited per file in the README).