hdf5storage.lowlevel

Module of Exceptions and low level read and write functions.

Hdf5storageError Base class of hdf5storage package exceptions.
CantReadError Exception for a failure to read the desired data.
TypeNotMatlabCompatibleError Exception for trying to write non-MATLAB compatible data.
write_data(f, grp, name, data, type_string, ...) Writes a piece of data into an open HDF5 file.
read_data(f, grp, name, options) Writes a piece of data into an open HDF5 file.

Hdf5storageError

exception hdf5storage.lowlevel.Hdf5storageError[source]

Bases: OSError

Base class of hdf5storage package exceptions.

CantReadError

exception hdf5storage.lowlevel.CantReadError[source]

Bases: hdf5storage.lowlevel.Hdf5storageError

Exception for a failure to read the desired data.

TypeNotMatlabCompatibleError

exception hdf5storage.lowlevel.TypeNotMatlabCompatibleError[source]

Bases: hdf5storage.lowlevel.Hdf5storageError

Exception for trying to write non-MATLAB compatible data.

In the event that MATLAB compatibility is being done (Options.matlab_compatible) and a Python type is not importable by MATLAB, the data is either not written or this exception is thrown depending on the value of Options.action_for_matlab_incompatible.

write_data

hdf5storage.lowlevel.write_data(f, grp, name, data, type_string, options)[source]

Writes a piece of data into an open HDF5 file.

Low level function to store a Python type (data) into the specified Group.

Parameters:

f : h5py.File

The open HDF5 file.

grp : h5py.Group or h5py.File

The Group to place the data in.

name : str

The name to write the data to.

data : any

The data to write.

type_string : str or None

The type string of the data, or None to deduce automatically.

options : hdf5storage.core.Options

The options to use when writing.

Raises:

NotImplementedError

If writing data is not supported.

TypeNotMatlabCompatibleError

If writing a type not compatible with MATLAB and options.action_for_matlab_incompatible is set to 'error'.

See also

hdf5storage.core.write
Higher level version.

read_data, hdf5storage.core.Options

read_data

hdf5storage.lowlevel.read_data(f, grp, name, options)[source]

Writes a piece of data into an open HDF5 file.

Low level function to read a Python type of the specified name from specified Group.

Parameters:

f : h5py.File

The open HDF5 file.

grp : h5py.Group or h5py.File

The Group to read the data from.

name : str

The name of the data to read.

options : hdf5storage.core.Options

The options to use when reading.

Returns:

data

The data named name in Group grp.

Raises:

CantReadError

If the data cannot be read successfully.

See also

hdf5storage.core.read
Higher level version.

write_data, hdf5storage.core.Options