smash.save_model_ddt#

smash.save_model_ddt(model, path, sub_data=None, sub_only=False)[source]#

Save some derived data types of the Model object to HDF5 file.

This method is considerably lighter than smash.save_model method that saves the entire Model object. However, it is not capable of reconstructing the Model object from the saved data file.

By default, the following data are stored into the HDF5 file:

Subsidiary data can be added by filling in sub_data.

Parameters:
modelModel

The Model object to save derived data types as a HDF5 file.

pathstr

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

sub_datadict or None, default None

Dictionary which indicates the subsidiary data to store into the HDF5 file.

Note

If not given, no subsidiary data is saved

sub_onlybool, default False

Allow to only store subsidiary data.

See also

read_model_ddt

Read derived data types of the Model object from HDF5 file.

Model

Primary data structure of the hydrological model smash.

Examples

>>> setup, mesh = smash.load_dataset("cance")
>>> model = smash.Model(setup, mesh)
>>> model
Structure: 'gr-a'
Spatio-Temporal dimension: (x: 28, y: 28, time: 1440)
Last update: Initialization

Save spatially distributed precipitation in addition to default derived data types of Model

>>> smash.save_model_ddt(model, "model_ddt.hdf5", sub_data={"prcp": model.input_data.prcp})