4.5.4 pde.storage.modelrunner module
Defines a class storing data using modelrunner
.
- class ModelrunnerStorage(storage, *, loc='trajectory', info=None, write_mode='truncate_once')[source]
Bases:
StorageBase
Store discretized fields in a
modelrunner
storage.This storage class acts as a wrapper for the
trajectory
module, which allows handling time-dependent data inmodelrunner
storages. In principle, all backends are supported, but it is advisable to use binary formats likeHDFStorage
orZarrStorage
to write large amounts of data.from modelrunner import Result r = Result.from_file("data.hdf5") r.result.plot() # plots the final state r.storage["trajectory"] # allows accessing the stored trajectory
- Parameters:
storage (
StorageGroup
) – Modelrunner storage used for storing the trajectoryloc (str or list of str) – The location in the storage where the trajectory data is written.
info (dict) – Supplies extra information that is stored in the storage
write_mode (str) – Determines how new data is added to already existing data. Possible values are: ‘append’ (data is always appended), ‘truncate’ (data is cleared every time this storage is used for writing), or ‘truncate_once’ (data is cleared for the first writing, but appended subsequently). Alternatively, specifying ‘readonly’ will disable writing completely.
- clear(clear_data_shape=False)[source]
Truncate the storage by removing all stored data.
- Parameters:
clear_data_shape (bool) – Flag determining whether the data shape is also deleted.
- end_writing()[source]
Finalize the storage after writing.
This makes sure the data is actually written to a file when self.keep_opened == False
- Return type:
None