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: Hdf5storageError

Exception for a failure to read the desired data.

TypeNotMatlabCompatibleError

exception hdf5storage.lowlevel.TypeNotMatlabCompatibleError[source]

Bases: 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:
fh5py.File

The open HDF5 file.

grph5py.Group or h5py.File

The Group to place the data in.

namestr

The name to write the data to.

dataany

The data to write.

type_stringstr or None

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

optionshdf5storage.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:
fh5py.File

The open HDF5 file.

grph5py.Group or h5py.File

The Group to read the data from.

namestr

The name of the data to read.

optionshdf5storage.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