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_modelmethod 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:
dt,end_time,start_time,structurefromModel.setupactive_cell,area,code,dx,flwdirfromModel.meshmean_prcp,mean_pet,qobsfromModel.input_dataqsimfromModel.outputThe final Model states (depending upon the Model structure) from state derived type of
Model.outputThe initial Model states (depending upon the Model structure) from
Model.statesThe Model parameters (depending upon the Model structure) from
Model.parameters
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_ddtRead derived data types of the Model object from HDF5 file.
ModelPrimary 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})