Skip to content

Add German waterway bathymetry for the tidal estuaries - #155

Merged
bkeepers merged 4 commits into
mainfrom
dgm-w-tidal
Aug 15, 2026
Merged

Add German waterway bathymetry for the tidal estuaries#155
bkeepers merged 4 commits into
mainfrom
dgm-w-tidal

Conversation

@bkeepers

@bkeepers bkeepers commented Aug 15, 2026

Copy link
Copy Markdown
Member

Adds the German federal waterway bathymetry (WSV DGM-W) as a prepared source, scoped to the 16 tidal/estuary tiles: Nordsee, Außenelbe below the Geesthacht weir, Jade, and Unter-/Außenweser. This is the first half of the #76 split; the inland reaches follow in #156, stacked on this one. Part of #53.

What it is

DGM-W (Digitales Geländemodell des Wasserlaufs) is the WSV's 2 m terrain-plus-riverbed model for the federal waterways, published through the WSV INSPIRE "Höhe" Atom download service as 93 zipped GeoTIFF tiles (Float32, nodata −32768, per-region CRS → mixed_crs, one .tif per zip → unpack: "zip:*.tif!1"). The feed's contour zips are excluded; Seascape builds its own contours. The 77 inland tiles stay commented out in file_list.txt until their low-water surfaces land.

The datum problem

DGM-W stores orthometric NHN elevation, not depth. NHN ≈ MSL, so a bed value used as-is reads a metre or few deeper than a chart in these macrotidal estuaries, which is the dangerous, optimistic direction. The prep subtracts an SKN-in-NHN reference surface per pixel (offset_surface) and clamps above-datum cells to nodata (clamp_positive), so the synced COG is depth below chart datum (SKN ≈ LAT). Same mechanism as the CUDEM/VDatum correction, so there are no pipelines/ changes at all.

The surface itself is bespoke: sources/dgm_w/build_reference.py composes store/datum/dgm_w_lowwater.tif from the BSH "SKN-Fläche Nordsee 2026" grid (CC-BY 4.0) over the outer estuaries, extended east of the grid's ~9.5° E edge over the inner tidal Elbe using the GDWS per-gauge SKN table (tideelbe_skn.csv) interpolated along the gauge line. A new datum_surface_dgm_w Snakefile rule runs it, keyed on the script and its data files; the generic VDatum rule now matches only the VDatum surfaces.

Validated end to end in #76 on outer Elbe km710–728 (BSH grid) and inner Elbe km620–639 (assembled fill), both yielding water-only depths below chart datum.

Known follow-up carried over from #76: clamp_positive also drops intertidal drying flats; reconciling the clamp against the OSM land–water mask is tracked in the README.

Not for navigation. Licences: DEM GeoNutzV (attribute WSV), SKN-Fläche CC-BY 4.0 (attribute BSH).

The German federal waterway DEM (2 m, NHN elevation) enters as a prepared
mixed_crs source, scoped to the 16 tidal/estuary tiles (Nordsee, Aussenelbe,
Jade, Unter-/Aussenweser). build_reference.py composes the SKN-in-NHN chart
datum surface — the BSH SKN-Flaeche Nordsee grid west of ~9.5 E, the inner
tidal Elbe filled from the GDWS per-gauge SKN table along the gauge line —
and the prep subtracts it per pixel (offset_surface) and clamps above-datum
cells, so the COG is depth below chart datum.

The inland reaches (beds tens of metres above MSL) stay commented out in
file_list.txt until their low-water surfaces (GlW/Stauziel/MNW) land.

Validated end to end on outer Elbe km710-728 and inner Elbe km620-639;
extracted from the add-source-wsv-dgmw branch (PR #76), ported from the
Justfile lane to the Snakemake sources lane.
The gauge line ended at Zollenspieker (km 598), so the corridor fill left
km 586-598 of the active km585_600 tile un-referenced and those beds read
at raw NHN — up to ~1.9 m too deep. A held-flat anchor at the weir's
downstream face extends the spine over the whole tidal reach; holding
Zollenspieker's SKN reads shallow versus the true taper, the safe
direction. Found by review on PR #155.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new prepared bathymetry source (dgm_w) for German tidal/estuary waterways, including a bespoke SKN (chart datum) reference surface build so the ingested tiles render as depth (below datum) rather than raw NHN elevation.

Changes:

  • Register WSV DGM‑W as a source (metadata + documentation) and enable only the 16 tidal/estuary tiles in file_list.txt.
  • Add a new datum surface build script (sources/dgm_w/build_reference.py) and wire it into Snakemake via a dedicated datum_surface_dgm_w rule.
  • Update the global sources catalog (sources/README.md) to list the new Germany DGM‑W source and its datum.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
sources/README.md Adds DGM‑W to the top-level sources table with scope/datum summary.
sources/dgm_w/tideelbe_skn.csv Introduces checked-in SKN gauge reference points for inner tidal Elbe fill.
sources/dgm_w/README.md Documents dataset access, licensing, scope limitations, and datum normalization approach.
sources/dgm_w/metadata.json Defines prepared-source knobs (mixed CRS, nodata, offset_surface, clamp_positive, max_zoom).
sources/dgm_w/file_list.txt Activates only tidal/estuary tile URLs; comments out inland tiles pending inland datum surfaces.
sources/dgm_w/build_reference.py Implements composition of dgm_w_lowwater surface from BSH grid + gauge corridor fill.
Snakefile Excludes dgm_w_lowwater from the generic VDatum datum rule; adds dedicated datum_surface_dgm_w rule.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread sources/dgm_w/build_reference.py Outdated
The whole zip and its GeoTIFF member were held in RAM before writing;
streaming the download and copying the member out keeps memory bounded
whatever size a future grid edition ships at. Review comment on PR #155.
* origin/main:
  GC: strict mosaic listing — it is the delete universe and absence oracle
  GC: absence is proof, errors are not; reconcile build.md
  Re-root the weekly GC on the published mosaic
  Address review: cache builder inputs, guard basenames, real precedence check
  Address review: tolerant link regex, clearer datum wording
  Add the French chart-datum surface and per-surface builder dispatch
  Add Kartverket 50 m bathymetry (Norway, Svalbard, Barents Sea)

# Conflicts:
#	Snakefile
@bkeepers
bkeepers merged commit fbe76ab into main Aug 15, 2026
3 checks passed
@bkeepers
bkeepers deleted the dgm-w-tidal branch August 15, 2026 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants