Read RAINDROP error logs into a nested tibble
Source:R/read_raindrop_errors.R
read_raindrop_errors.RdReads the RAINDROP error protocol HDF5 (typically Fehlerprotokoll.h5)
for a set of simulation runs and returns a tibble with one row per run and a
nested tibble column containing all errors found in the file.
Arguments
- simulation_names
Character vector of simulation run names (e.g.
"s00001").- path_list
A path list object passed to
kwb.utils::resolve(). Must resolve to an elementpath_errors_hdf5.- debug
Logical. If
TRUE, pass through tokwb.utils::catAndRun().
Value
A tibble with columns:
idInteger simulation id (parsed fromsimulation_names).scenario_nameThe simulation name (e.g."s00001").pathFile path to the error HDF5.file_existsLogical.number_of_errorsScalar integer orNA.errorsNested tibble (list-column) with per-error rows:error_index,Fehlerbeschreibung,Layer1,Layer2,Massnahmenelement1,Massnahmenelement2
Details
The error HDF5 usually contains:
/AnzahlFehler(scalar integer)groups
/0,/1, ... each containing datasets such asFehlerbeschreibung,Layer1,Layer2,Massnahmenelement1,Massnahmenelement2
Note: In hdf5r, HDF5 group names must be addressed as character strings.
So group 0 must be accessed as h5[["0"]] (not h5[[0]]).
Examples
if (FALSE) { # \dontrun{
errors_df <- read_raindrop_errors(simulation_names, path_list)
# flatten all errors:
all_errors <- tidyr::unnest(errors_df, errors)
} # }