Support boundary_outflows and sink_areas in sink params
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user