Read Raindrop optimisation simulation results from HDF5
Source:R/get_simulation_results_optim.R
get_simulation_results_optim.RdReads per-run result files (HDF5) for both the measure element and the connected area results and returns a named list (one entry per simulation).
Arguments
- paths
A list of path definitions. Used for messaging and expected to contain
file_results_hdf5_elementandfile_results_hdf5_flaeche(file names). Note: within the loop,pathsis overwritten by the resolved paths for the current simulation run.- path_list
A list passed to
kwb.utils::resolve()to generate run-specific paths (must yieldpath_results_hdf5_element,path_results_hdf5_flaeche, anddir_target_output).- simulation_names
Character vector of simulation run identifiers (e.g.
c("s00001", "s00002")).- debug
print debug messages (default: TRUE)
Value
A named list with one entry per simulation_names. Each entry is
either NULL (missing files) or a nested list:
- element
- meta
Data.frame/list of scalar metadata (from
Metainfo).- rates
Time series table (from
Raten).- water_balance
Scalars table (from
Wasserbilanz).- states
Time series table (from
Zustandsvariablen).
- connected_area
Same structure as
element, read from the area HDF5.
Details
For each simulation name (e.g. "s00001"), the function resolves the run
directory via kwb.utils::resolve(path_list, dir_target = s_name) and
then loads standard result groups from two HDF5 files:
element:
Metainfo,Raten,Wasserbilanz,Zustandsvariablenconnected_area:
Metainfo,Raten,Wasserbilanz,Zustandsvariablen
If either of the expected HDF5 files is missing for a run, the corresponding
list entry will be NULL.
The function uses hdf5r::H5File$new(..., mode = "r") to open the files.
The HDF5 handles are not explicitly closed; depending on your workflow, you
may want to close them (see hdf5r::H5File$close_all() / $close()).