smash.io.read_model_ddt#
- smash.io.read_model_ddt(path)[source]#
Read some derived data types of the Model object from HDF5.
This method does not reconstruct the Model object because certain information has not been saved from the
smash.io.save_model_ddt
method in order to have light memory backup. This method returns a dictionary whose organisation is similar to the Model object.- Parameters:
- pathstr
The file path.
- Returns:
- model_ddtdict[str, dict[str, Any]]
A dictionary with derived data types loaded from HDF5.
- Raises:
- FileNotFoundError:
If file not found.
- ReadHDF5MethodError:
If file not created with
save_model_ddt
.
See also
save_model_ddt
Read derived data types of the Model object from HDF5.
smash.Model
Primary data structure of the hydrological model
smash
.
Examples
>>> from smash.factory import load_dataset >>> from smash.io import save_model_ddt, read_model_ddt >>> setup, mesh = load_dataset("cance") >>> model = smash.Model(setup, mesh)
Save some derived data types of the Model object to HDF5
>>> save_model_ddt(model, "model_ddt.hdf5")
Read some derived data types of the Model object from HDF5
>>> model_ddt = read_model_ddt("model_ddt.hdf5") >>> model_ddt.keys() dict_keys(['mesh', 'physio_data', 'response', 'response_data', 'rr_final_states', 'rr_initial_states', 'rr_parameters', 'serr_mu_parameters', 'serr_sigma_parameters', 'setup'])
Access to setup variables
>>> model_ddt["setup"] {'descriptor_name': array(['slope', 'dd'], dtype='<U5'), 'dt': 3600.0, 'end_time': '2014-11-14 00:00', 'hydrological_module': 'gr4', 'routing_module': 'lr', 'serr_mu_mapping': 'Zero', 'serr_sigma_mapping': 'Linear', 'snow_module': 'zero', 'start_time': '2014-09-15 00:00'}
Access to rainfall-runoff parameter keys
>>> model_ddt["rr_parameters"]["keys"] array(['ci', 'cp', 'ct', 'kexc', 'llr'], dtype='<U4')