Changelog
Source:NEWS.md
kwb.raindrop (development version)
Bug fixes
get_simulation_results_optim()now treats a result HDF5 that exists but cannot be opened/read (e.g. the engine crashed mid-write for a scenario, or a file briefly locked just after the run) like a missing file: itwarning()s, names the scenario, and returnsNULLinstead of throwing. Because the Wien / Bad Aussee / Eisenstadt workflows now read results per run insiderun_one(), a single unreadable file used to abort the entirefuture_lapplybatch (seen as anH5File.open()“unable to open file” error mid-render); the run now completes with NA rows for the affected scenarios.vignettes/example_wien_minimal.Rmd,vignettes/workflow_wien.Rmdandvignettes/workflow_badaussee.Rmdnow convert ET0 from mm/day to mm/h (value / period_et) before writing//Kurven/ET0, mirroring the existing rain conversion. The engine reads the ET0 curve as a mm/h rate, so the unconverted daily values were integrated 24× too high — the cause of the implausibly large modelled ET share. The minimal vignette’s timeseries-info summary now labels ET0 as mm/h and recovers its total viavalue * period_h.
New features
-
The Wien and Bad Aussee workflows now thin each run to its optimisation row inside
run_one()(viaget_simulation_results_optim(..., lean = TRUE)-
add_overflow_events_and_waterbalance()) andrun_scenarios()returns those one-row tibbles for a finaldplyr::bind_rows(). This replaces the previous “run everything, then read every run’s full results into memory at once” pass (get_simulation_results_optim_parallel()), drastically cutting peak RAM for large parameter grids.
-
get_simulation_results_optim()gains aleanargument. WhenTRUEit reads only the fields consumed downstream (element$rates,element$water_balance,connected_area$water_balance) and leaves the unusedmeta/statesandconnected_area$ratesasNULL, minimising per-run memory and I/O. Its intro message is now gated behinddebug.inst/scripts/prepare_eisenstadt_swmm_timeseries.Rextracts the rain (/Kurven/Regen) and ET0 (/Kurven/ET0) curves from an engine HDF5 and writes SWMM-5 external time-series files. It converts out of the engine’s mm/h convention (rain → mm per interval for[RAINGAGES]VOLUME, ET0 → mm/day for[EVAPORATION]). Pre-generated files for the bundled Eisenstadt 2005 template ship underinst/extdata/models/eisenstadt-2005/swmm/together with a README that documents the mm/h-vs-mm/day pitfall: the kernel reads/Kurven/ET0as mm/h, so a daily ET0 (mm/d) written there without dividing by 24 is integrated 24× too high.download_engine()fetches the Tandler “Regenwasserbewirtschaftung” Windows executable from the companion repositoryKWB-R/kwb.raindrop.binariesand caches it undertools::R_user_dir("kwb.raindrop", "cache")/<version>/. Multiple engine versions can coexist side-by-side because the version is encoded in the release tag (engine-<YYYY-MM-DD>), not in the asset filename. The download is atomic (temp file + rename) and rejects obviously broken responses (< 1 KB ⇒ likely a 404 HTML page).compute_costs()anddefault_cost_rates()attach a per-scenario construction-cost breakdown (cost_excavation,cost_profiling,cost_filter,cost_storage,cost_total) to a parameter grid using the Austrian unit-cost rates supplied by Johannes Leimgruber (OeStaP, 2026-03-27). Passstorage_type = "infiltration_box"(Sickerbox, default, ~95 % porosity) or"gravel_trench"(Schotterrigol, ~30 % porosity) — or a per-rowstorage_typecolumn on the grid — to switch the storage layer. The new columns are wired into theexample_wien_minimal,workflow_wienandworkflow_badausseevignettes so the solution-space datatables become filterable and sortable by cost.New vignette
example_wien_minimal: a self-contained smoke test of the full input → engine → results loop on Wien. Now extended into an ET-diagnostics grid that sweeps three engine switches —keineVerdunstungBeiRegen,Hoernschemeyer_aktivand theET0ref_GrasReferenzverdunstungfactor (0,1,100) — at Daniel’s reference geometry (12 scenarios total). Daniel’s three XLSX-review corrections (Dach/Evapotranspiration_aktiv = 0,EvapPond = 0,LAI = 3.9) were applied briefly between PRs #11 and the one introducing this NEWS entry but made the Tandler engine return Status 1 for every scenario, so they are reverted for now. They will be re-introduced one-by-one as sweep dimensions in a follow-up diagnostic vignette so the failing combination can be isolated. After the model loop the per-scenario*.h5inputs are dumped to a single XLSX (raindrop_wien_minimal_params.xlsx) with one sheet per scenario plus abasesheet for the un-modified template, atimeseries_infosheet summarising the rain / ET0 series fed to every run (identical across scenarios), and anapplied_settingssheet listing the diff of every key the package writes on top ofbase.h5per scenario. Prints a complete static-parameter overview frombase.h5for review of every default that drives the model. Designed to render on Windows CI; the four heavy case-study vignettes only render their parameter grids on CI and skip the model runs.
Helper scripts
-
inst/scripts/prepare_wien_swmm_timeseries.Rconverts the shipped Wien rainfall (10-minute, mm) and reference ET0 (daily, mm/day) series to SWMM-5 external time-series files (wien_rain.dat,wien_et0.dat) for direct import into a SWMM[TIMESERIES]/[RAINGAGES]/[EVAPORATION]block. Output directory defaults totempdir(); passout_dir(R) or a positional CLI argument (Rscript) to redirect.
Inputs and data shipping
Per-scenario input data ships under
inst/extdata/models/<scenario>/for Wien, Bad Aussee and Eisenstadt 2005 (base.h5HDF5 model templates plusrain.csv.gzandet.csvtime series for the two GeoSphere-Austria sites). Vignettes read inputs viasystem.file()and write model outputs to atempdir()scratch root, so they are hermetic and reproducible.Rain timeseries are shipped gzipped (
rain.csv.gz);readr::read_csv()reads the compressed files transparently. Totalinst/extdata/footprint is ~6.8 MB (down from ~53 MB raw).Provenance documented in
inst/extdata/SOURCES.mdand an “Input data” section in each rendered vignette: precipitation and evapotranspiration come from GeoSphere Austria (Österreichischer Wetterdienst, formerly ZAMG); HDF5 templates are produced with the Tandler engine.
CI / packaging
GitHub Actions workflows for Claude Code (
@claudemention bot and automatic PR review) added; both pinned to Opus 4.7 withthink hardreasoning on the review prompt.R-CMD-checkmatrix restricted towindows-latest(devel/oldrel/release) — the calculation engine is a Windows.exe, so non-Windows runners cannot exercise the workflow. Aligns with the existingtest-coverageandpkgdownjobs.Bumped
actions/checkoutto v5 and pinnedactions/upload-artifactto v4 (Node.js 24 readiness ahead of the 2026-09-16 Node 20 removal).
Dependency hygiene
-
tidyr,rlang: moved toImports(used in package code). -
plotly: moved fromImportstoSuggests(only used in vignettes). -
htmlwidgets,readr,writexl: added toSuggests(used in vignettes).
Bug fixes
get_simulation_results_optim()andget_simulation_results_optim_parallel()no longer returnNULLwhen only the connected-area H5 (Dach.h5) is missing; they now return a partial result withconnected_area = NULLwhile still populating the element side. This unblocks scenarios where//Massnahmenelemente/Dach/Berechnungsparameter/Evapotranspiration_aktivis0and the engine consequently skips writing Dach.h5.add_overflow_events_and_waterbalance()tolerates per-scenarioNULLand missing components (element,connected_area,*$water_balance,element$rates). Affected scenarios still produce a row of the output tibble with the available metrics computed and the missing columns left asNA.add_overflow_events_and_waterbalance()now fabricates anNA-filled column stub when one side’s water balance is missing while the other side has data, by mirroring the populated side’s variable names. Previously the missing side’s columns were dropped entirely (dplyr::bind_rows()only adds columns that at least one scenario contributes), which left the results table with noconnectedarea.*_columns at all when every scenario disabled roof ET. The mirror keeps the column structure visible in the rendered datatable and the function emits one summarymessage()per fallback path (instead of one per scenario) naming all affected scenarios, so the user can match the diagnostic to the all-NA rows.New exported
default_canonical_wb_variables()returns the canonical set of water-balance variable names the Tandler engine writes (WB_Regen,WB_Evapotranspiration,WB_InfiltrationNetto,WB_Oberflaechenablauf_Ueberlauf,WB_Oberflaechenablauf_Verschaltungen). All five vignettes now pass it ascanonical_variables = default_canonical_wb_variables()toadd_overflow_events_and_waterbalance(), so the rendered datatables keep the expectedelement.WB_*_andconnectedarea.WB_*_columns even when every scenario in a batch isNULL(e.g. the engine returns Status 1 for every input and writes no result HDF5).example_wien_minimalvignette: the per-scenariorun_one()helper now wraps the H5 input write + engine call intryCatchand passesstrict = FALSE+scalar_strategy = "first"toh5_write_values(). A scenario that errors during write or whose engine returns a non-zero status no longer aborts the wholerun_scenariosloop; the failure is reported viamessage()and the remaining scenarios still execute, producing a results datatable with NA in the result columns for the failed rows (paired with the new mirror-stub above).R/plot_hpond_vs_ref.R: replace literal▲glyph in the caption with▲so the source file is ASCII-only (R-CMD-check WARNING).R/read_hdf5_timeseries.R: wrap array-indexing notation ([1, ],[2..k, ],[, 1],[, 2..k]) in backticks so roxygen2’s markdown parser does not turn them into broken\link{...}entries.