smash.io.save_model#

smash.io.save_model(model, path)[source]#

Save Model object to HDF5.

Parameters:
modelModel

The Model object to be saved to HDF5 file.

pathstr

The file path. If the path not end with .hdf5, the extension is automatically added to the file path.

See also

read_model

Read 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, read_model
>>> setup, mesh = load_dataset("cance")
>>> model = smash.Model(setup, mesh)
>>> model
Model
    atmos_data: ['mean_pet', 'mean_prcp', '...', 'sparse_prcp', 'sparse_snow']
    mesh: ['active_cell', 'area', '...', 'xres', 'ymax']
    ...
    setup: ['adjust_interception', 'compute_mean_atmos', '...', 'structure', 'temp_directory']
    u_response_data: ['q_stdev']
>>> model.setup.hydrological_module, model.setup.routing_module
('gr4', 'lr')

Save Model to HDF5

>>> save_model(model, "model.hdf5")