![]() |
HDF5
1.15.0.9c85c6e
API Reference
|
Navigate back: Main / Getting Started with HDF5 / Learning the Basics
Recall that to create an HDF5 object, we have to specify the location where the object is to be created. This location is determined by the identifier of an HDF5 object and the name of the object to be created. The name of the created object can be either an absolute name or a name relative to the specified identifier. In the previous example, we used the file identifier and the absolute name /MyGroup
to create a group.
In this section, we discuss HDF5 names and show how to use absolute and relative names.
HDF5 object names are a slash-separated list of components. There are few restrictions on names: component names may be any length except zero and may contain any character except slash (/
) and the null terminator. A full name may be composed of any number of component names separated by slashes, with any of the component names being the special name .
(a dot or period). A name which begins with a slash is an absolute name which is accessed beginning with the root group of the file; all other names are relative names and and the named object is accessed beginning with the specified group. A special case is the name /
(or equivalent) which refers to the root group.
Functions which operate on names generally take a location identifier, which can be either a file identifier or a group identifier, and perform the lookup with respect to that location. Several possibilities are described in the following table:
Location Type | Object Name | Description |
---|---|---|
File identifier | /foo/bar | The object bar in group foo in the root group. |
Group identifier | /foo/bar | The object bar in group foo in the root group of the file containing the specified group. In other words, the group identifier's only purpose is to specify a file. |
File identifier | / | The root group of the specified file. |
Group identifier | / | The root group of the file containing the specified group. |
Group identifier | foo/bar | The object bar in group foo in the specified group. |
File identifier | . | The root group of the file. |
Group identifier | . | The specified group. |
Other identifier | . | The specified object. |
See Examples from Learning the Basics for the examples used in the Learning the Basics tutorial.
The example code shows how to create groups using absolute and relative names. It creates three groups: the first two groups are created using the file identifier and the group absolute names while the third group is created using a group identifier and a name relative to the specified group.
For details on compiling an HDF5 application: [ Compiling HDF5 Applications ]
H5Gcreate creates a group at the location specified by a location identifier and a name. The location identifier can be a file identifier or a group identifier and the name can be relative or absolute.
The first H5Gcreate/h5gcreate_f creates the group MyGroup
in the root group of the specified file.
The second H5Gcreate/h5gcreate_f creates the group Group_A
in the group MyGroup
in the root group of the specified file. Note that the parent group (MyGroup
) already exists.
The third H5Gcreate/h5gcreate_f creates the group Group_B
in the specified group.
Shown below is the contents and the definition of the group of groups.h5
(created by the C program). (The FORTRAN program creates the HDF5 file groupsf.h5
and the resulting DDL shows the filename groupsf.h5
in the first line.)
![]() |
groups.h5 in DDL
Navigate back: Main / Getting Started with HDF5 / Learning the Basics