pencil.io.pc_hdf5

Contains optional h5 operations with and without hdf5-parallel, for exampe to open h5 file with/without MPI using common switches. TODO open h5 pencil var object etc, as alternative to var object for large datasets with memory limits.

Functions

open_h5(filename, status[, driver, comm, overwrite, ...])

This function opens hdf5 file in serial or parallel.

group_h5(h5obj, groupname[, status, delete, ...])

This function adds/removes hdf5 group objects.

dataset_h5(h5obj, dataname[, status, data, shape, ...])

This function adds/removes hdf5 dataset objects.

Module Contents

pencil.io.pc_hdf5.open_h5(filename, status, driver=None, comm=None, overwrite=False, size=1, rank=0, lfs=False, MB=1, count=1)

This function opens hdf5 file in serial or parallel.

Keyword Arguments:
  • filename – relative or absolute path string for name of hdf5 file.

  • status – open state of file ‘w’: write, ‘r’: read or ‘a’/’r+’: append.

  • driver – ‘mpio’ required for parallel: version but absent for serial.

  • comm – only present for parallel version of h5py.

  • overwrite – flag to replace existing file.

  • rank – processor rank with root = 0.

pencil.io.pc_hdf5.group_h5(h5obj, groupname, status='r', delete=False, overwrite=False, rank=0, size=1, comm=None)

This function adds/removes hdf5 group objects.

Keyword Arguments:
  • h5obj – h5 object, may be the file or a sub group within the file

  • groupname – string for name of the group.

  • status – open state of file ‘w’: write, ‘r’: read or ‘a’/’r+’: append.

  • delete – flag to remove existing group from h5 object.

  • overwrite – flag to replace existing group from h5 object.

  • rank – processor rank with root = 0.

  • comm – only present for parallel version of h5py.

pencil.io.pc_hdf5.dataset_h5(h5obj, dataname, status='r', data=None, shape=None, dtype=None, overwrite=False, delete=False, rank=0, size=1, comm=None)

This function adds/removes hdf5 dataset objects.

Keyword Arguments:
  • h5obj – h5 object, may be the file or a sub group within the file

  • dataname – string for name of the dataset.

  • status – open state of file ‘w’: write, ‘r’: read or ‘a’/’r+’: append.

  • data – h5 compatible data object; float, integer, string, array

  • shape – data shape tuple of length > 0

  • dtype – h5 compatible data type, eg. np.float64

  • delete – flag to remove existing group from h5 object.

  • overwrite – flag to replace existing group from h5 object.

  • rank – processor rank with root = 0.

  • comm – only present for parallel version of h5py.