save_MCrun_results API Reference
geoloop.utils.helpers.save_MCrun_results
save_MCrun_results(
config: SingleRunConfig,
param_dict: dict,
results: list[Any],
outpath: Path,
) -> None
Save the results of a Monte Carlo model run to an HDF5 file.
The function organizes the results and input parameters into structured xarray datasets, grouped by their dimensions, and writes them to the specified HDF5 file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
SingleRunConfig
|
Configuration object containing model settings and metadata. |
required |
param_dict
|
dict
|
Dictionary containing locked and variable input parameters along with their values, as specified in the configuration. |
required |
results
|
list[Any]
|
List of results from Monte Carlo simulation runs. Each element is a results object containing simulation outputs for one run. |
required |
outpath
|
Path
|
Path to the directory and file name for saving the HDF5 output. |
required |
Returns:
| Type | Description |
|---|---|
None
|
The function writes the datasets to an HDF5 file and does not return any value. |
Notes
- Each Monte Carlo sample is processed individually, and results are concatenated along a 'samples' dimension.
- Input parameters are grouped into variable and locked parameters, and datasets are created for parameters with special dimensions such as pipe-specific or layer-specific values.
- The final HDF5 file contains two main groups: "results" and "parameters".