exosim.models.utils.cachedData#

Classes#

CachedData

This class caches data cube into an h5 file. The cube data are chunked toward the first axis.

Module Contents#

class CachedData(axis0, axis1, axis2, output=None, output_path=None, dataset_name=None, dtype=np.float64)[source]#

Bases: exosim.log.Logger

This class caches data cube into an h5 file. The cube data are chunked toward the first axis. In this class are also defined a set of operation to operate on the dataset using the chinks system.

Variables:
  • axis0 (int) – first axis size

  • axis1 (int) – second axis size

  • axis2 (int) – third axis size

  • output (h5py.File or HDF5Output or HDF5OutputGroup) – name of the file used for caching.

  • dataset_name (str) – name used to store the dataset into the h5 file.

  • output – h5py open file used for caching

  • dataset_path (str) – path where is stored the dataset inside the output file.

  • chunked_dataset (h5py.Dataset) – h5py dataset used to store the data

Parameters:
  • axis0 (int) –

  • axis1 (int) –

  • axis2 (int) –

  • output (Union[str, exosim.output.HDF5Output, exosim.output.HDF5OutputGroup]) –

  • output_path (str) –

  • dataset_name (str) –

  • dtype (numpy.dtype) –

Notes

The cached data may be stored in a temporary file. To delete temporary files we included a garbage collector. Please, remember to delete the class when done as in the following example

>>> myClass = CachedData(1,1,1)
>>> del myClass
rename_dataset(new_name)[source]#

It renames the dataset in the HDF5 file.

Parameters:

new_name (str) – new name for the dataset

Return type:

None