msl.io.writers.hdf5 module

Writer for the HDF5 file format.

Attention

requires that the h5py package is installed.

class msl.io.writers.hdf5.HDF5Writer(file=None, **metadata)[source]

Bases: Writer

Create a HDF5 writer.

You can use HDF5Writer as a context manager. For example,

with HDF5Writer('my_file.h5') as root:
    root.create_dataset('dset', data=[1, 2, 3])

This will automatically write root to the specified file when the with block exits.

Parameters:
  • file (path-like or file-like, optional) – The file to write the data to. Can also be specified in the write() method.

  • **metadata – Key-value pairs that are used as Metadata of the Root.

write(file=None, root=None, **kwargs)[source]

Write to a HDF5 file.

Parameters: