smash.read_model_ddt#

smash.read_model_ddt(path)[source]#

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

Parameters:
pathstr

The file path.

Returns:
datadict

A dictionary with derived data types loaded from HDF5 file.

Raises:
FileNotFoundError:

If file not found.

ReadHDF5MethodError:

If file not created with save_model_ddt.

See also

save_model_ddt

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

Examples

>>> setup, mesh = smash.load_dataset("cance")
>>> model = smash.Model(setup, mesh)
>>> smash.save_model_ddt(model, "model_ddt.hdf5")

Read the derived data types from HDF5 file

>>> data = smash.read_model_ddt("model_ddt.hdf5")

Then, to see the dataset keys

>>> data.keys()
dict_keys(['active_cell', 'area', 'cft', 'code', 'cp', 'exc', 'flwdir',
'hft', 'hft_0', 'hlr', 'hlr_0', 'hp', 'hp_0', 'lr', 'mean_pet', 'mean_prcp',
'qobs', 'qsim', 'dt', 'dx', 'end_time', 'start_time', 'structure'])

And finally, to access to derived data

>>> data["mean_prcp"]
array([[0., 0., 0., ..., 0., 0., 0.],
       [0., 0., 0., ..., 0., 0., 0.],
       [0., 0., 0., ..., 0., 0., 0.]], dtype=float32)