From 227b89cccb8db5ba54cbb6416e0d63109f3e767d Mon Sep 17 00:00:00 2001 From: "s0wlz (Matthias Puchstein)" Date: Wed, 11 Feb 2026 00:26:07 +0100 Subject: [PATCH] Support boundary_outflows and sink_areas in sink params --- geodata_pipeline/swe_lods.py | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/geodata_pipeline/swe_lods.py b/geodata_pipeline/swe_lods.py index 9d7991f..10a93fe 100644 --- a/geodata_pipeline/swe_lods.py +++ b/geodata_pipeline/swe_lods.py @@ -772,7 +772,11 @@ def _write_boundary_manifest( swe_cfg.source_area_params_toml, kinds=("source_areas", "source_area", "sources", "source"), ) - sink_params = _load_boundary_params_toml(swe_cfg.sink_params_toml, kind="sinks") + sink_params = _load_boundary_params_multi( + swe_cfg.sink_params_toml, + kinds=("sinks", "sink", "boundary_outflows", "boundary_outflow", "sink_areas", "sink_area"), + merge=True, + ) tiles_payload = [] boundary_inflow_stats: dict[int, dict] = {} @@ -1083,14 +1087,31 @@ def _load_boundary_params_toml(path: str, *, kind: str) -> dict[int, dict]: return out -def _load_boundary_params_multi(path: str, *, kinds: tuple[str, ...]) -> dict[int, dict]: +def _load_boundary_params_multi(path: str, *, kinds: tuple[str, ...], merge: bool = False) -> dict[int, dict]: if not path: return {} + + if not merge: + for kind in kinds: + out = _load_boundary_params_toml(path, kind=kind) + if out: + return out + return {} + + out: dict[int, dict] = {} + merged_kind = "|".join(kinds) for kind in kinds: - out = _load_boundary_params_toml(path, kind=kind) - if out: - return out - return {} + section = _load_boundary_params_toml(path, kind=kind) + for ident, payload in section.items(): + _set_boundary_param( + out, + ident, + payload, + kind=merged_kind, + path=path, + entry_name=f"{kind}.{ident}", + ) + return out def _parse_int_id(value) -> int | None: