Skip to content

Latest commit

 

History

History
33 lines (24 loc) · 1.33 KB

lowlevel.rst

File metadata and controls

33 lines (24 loc) · 1.33 KB

Low-Level API

This documentation mostly describes the h5py high-level API, which offers the main features of HDF5 in an interface modelled on dictionaries and NumPy arrays. h5py also provides a low-level API, which more closely follows the HDF5 C API.

You can easily switch between the two levels in your code:

  • To the low-level: High-level .File, .Group and .Dataset objects all have a .id attribute exposing the corresponding low-level objects—~low:h5py.h5f.FileID, ~low:h5py.h5g.GroupID and ~low:h5py.h5d.DatasetID:

    dsid = dset.id
    dsid.get_offset()  # Low-level method

    Although there is no high-level object for a single attribute, .AttributeManager.get_id will get the low-level ~low:h5py.h5a.AttrID object:

    aid = dset.attrs.get_id('timestamp')
    aid.get_storage_size()  # Low-level method
  • To the high-level: Low-level ~low:h5py.h5f.FileID, ~low:h5py.h5g.GroupID and ~low:h5py.h5d.DatasetID objects can be passed to the constructors of .File, .Group and .Dataset, respectively.