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:
- write(file=None, root=None, **kwargs)[source]
Write to a HDF5 file.
- Parameters:
file (path-like or file-like, optional) – The file to write the root to. If
None
then uses the value of file that was specified whenHDF5Writer
was instantiated.root (
Root
, optional) – Write root in HDF5 format. IfNone
then write theGroup
s andDataset
s in thisHDF5Writer
.**kwargs – All key-value pairs are passed to
File
.