hdf5_savehandle#

class hdf5_savehandle(savefile, overwrite)[source]#

Get a handle to an open HDF5 file to write to.

Parameters
savefilestr of h5py File/Group handle
  • str : Name of the file to save to.

  • h5py File/Group handle : handle to part of an already open HDF5 file to save data to.

overwritebool

If True, overwrite the file if it already exists. If False, raise a FileExistsError if the file already exists.

Examples

>>> with hdf5_savehandle("file_to_save_to.h5", False) as hf:
...     hf.create_dataset("dataset_label", data=dataset_to_save)

Methods