Skip to content

hdf5

HDF5 writing.

This module contains classes and functions that allow OM to write data to files in HDF5 format.

load_hdf5_data(*, hdf5_filename, hdf5_path)

Loads data from an HDF5 file.

This function loads data from an HDF5 file.

Parameters:

Name Type Description Default
hdf5_filename str

The relative of absolute path to an HDF5 file containing the data to load.

required
hdf5_path str

The internal path, within the HDF5 file, to the block storing the data to load.

required

Returns:

Type Description
Union[NDArray[numpy.int_], NDArray[numpy.float_], None]

The loaded data array.

Raises:

Type Description
OmHdf5FileReadingError

Raised when an error is encountered while reading the file.

parse_parameters_and_load_hdf5_data(*, parameters, hdf5_filename_parameter, hdf5_path_parameter)

Reads data from an HDF5 file identified by a set of configuration parameters.

This function retrieves the path to a data file, and the internal HDF5 path to a block storing data, from a set of configuration parameters, then loads the data.

Parameters:

Name Type Description Default
parameters Dict[str, Any]

A set of OM configuration parameters collected together in a parameter group. The parameter group must contain the following entries:

  • An entry, whose name is specified by the hdf5_filename_parameter argument of this function, storing the relative of absolute path to an HDF5 file containing the data to load.

  • An entry, whose name is specified by the hdf5_path_parameter argument argument of this function, storing the internal path, within the HDF5 file, to the block storing the data to load.

required
hdf5_filename_parameter str

The name of the entry in the parameter set that stores the path to the data file.

required
hdf5_path_parameter str

The name of the entry in the parameter set that stores the internal HDF5 path to the block storing the data.

required

Returns:

Type Description
Union[NDArray[numpy.int_], NDArray[numpy.float_], None]

The loaded data.