with_write_hdf5#

gwpy.io.hdf5.with_write_hdf5(func: Callable[..., object]) Callable[..., object][source]#

Decorate an HDF5-writing function to open a filepath if needed.

func should be written to take the object to be written as the first argument, and then presume an h5py.Group as the second.

This method uses keywords append and overwrite as follows if the output file already exists:

  • append=False, overwrite=False: raise IOError

  • append=True: open in mode a

  • append=False, overwrite=True: open in mode w