Module H5R

H5R API for object and region references.

Functional API

h5py.h5r.create(ObjectID loc, STRING name, INT ref_type, SpaceID space=None) → ReferenceObject ref

Create a new reference. The value of ref_type detemines the kind of reference created:

Reference to an object in an HDF5 file. Parameters “loc” and “name” identify the object; “space” is unused.
Reference to a dataset region. Parameters “loc” and “name” identify the dataset; the selection on “space” identifies the region.
h5py.h5r.dereference(Reference ref, ObjectID id) → ObjectID or None

Open the object pointed to by the reference and return its identifier. The file identifier (or the identifier for any object in the file) must also be provided. Returns None if the reference is zero-filled.

The reference may be either Reference or RegionReference.

h5py.h5r.get_region(Reference ref, ObjectID id) → SpaceID or None

Retrieve the dataspace selection pointed to by the reference. Returns a copy of the dataset’s dataspace, with the appropriate elements selected. The file identifier or the identifier of any object in the file (including the dataset itself) must also be provided.

The reference object must be a RegionReference. If it is zero-filled, returns None.

h5py.h5r.get_obj_type(Reference ref, ObjectID id) → INT obj_code or None

Determine what type of object the reference points to. The reference may be a Reference or RegionReference. The file identifier or the identifier of any object in the file must also be provided.

The return value is one of:

If the reference is zero-filled, returns None.

h5py.h5r.get_name(Reference ref, ObjectID loc) → STRING name

Determine the name of the object pointed to by this reference. Requires the HDF5 1.8 API.

Reference classes

class h5py.h5r.Reference

Opaque representation of an HDF5 reference.

Objects of this class are created exclusively by the library and cannot be modified. The read-only attribute “typecode” determines whether the reference is to an object in an HDF5 file (OBJECT) or a dataset region (DATASET_REGION).

The object’s truth value indicates whether it contains a nonzero reference. This does not guarantee that is valid, but is useful for rejecting “background” elements in a dataset.

class h5py.h5r.RegionReference

Bases: h5py.h5r.Reference

Opaque representation of an HDF5 region reference.

This is a subclass of Reference which exists mainly for programming convenience.

API constants


Typecode for object references


Typecode for dataset region references

Table Of Contents

Previous topic

Module H5P

Next topic

Module H5S

This Page