HDF5InputOutput#
- class pybrops.core.io.HDF5InputOutput.HDF5InputOutput[source]#
Bases:
object
Abstract class for defining HDF5 input/output functionality.
This abstract class defines two functions with the following purposes:
to_hdf5
- write an object to an HDF5 file.from_hdf5
- load an object from an HDF5 file.
Methods
Read an object from an HDF5 file.
Write an object to an HDF5 file.
- abstract classmethod from_hdf5(filename, groupname)[source]#
Read an object from an HDF5 file.
- Parameters:
filename (str, Path, h5py.File) – If
str
, an HDF5 file name from which to read. IfPath
, an HDF5 file name from which to read. Ifh5py.File
, an opened HDF5 file from which to read.groupname (str, None) – If
str
, an HDF5 group name under which object data is stored. IfNone
, object is read from base HDF5 group.
- Returns:
out – An object read from an HDF5 file.
- Return type:
- abstract to_hdf5(filename, groupname, overwrite)[source]#
Write an object to an HDF5 file.
- Parameters:
filename (str, Path, h5py.File) – If
str
, an HDF5 file name to which to write. IfPath
, an HDF5 file path to which to write. Ifh5py.File
, an opened HDF5 file to which to write.groupname (str, None) – If
str
, an HDF5 group name under which object data is stored. IfNone
, object is written to the base HDF5 group.overwrite (bool) – Whether to overwrite values in an HDF5 file if a field already exists.
- Return type:
None