File: lowlevel.rst

package info (click to toggle)
h5py 3.16.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,828 kB
  • sloc: python: 12,212; ansic: 578; makefile: 433; sh: 33
file content (33 lines) | stat: -rw-r--r-- 1,370 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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.

.. seealso::

   - `h5py Low-Level API Reference <https://api.h5py.org/>`_
   - `HDF5 C/Fortran Reference Manual <https://support.hdfgroup.org/documentation/hdf5/latest/_r_m.html>`_

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

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

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

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

      aid = dset.attrs.get_id('timestamp')
      aid.get_storage_size()  # Low-level method

- **To the high-level**: Low-level :class:`~low:h5py.h5f.FileID`,
  :class:`~low:h5py.h5g.GroupID` and :class:`~low:h5py.h5d.DatasetID` objects
  can be passed to the constructors of :class:`.File`, :class:`.Group` and
  :class:`.Dataset`, respectively.