Please see The HDF Group's new Support Portal for the latest information.
Contents:
-
Programming Example (C, Fortran, Java, C++, Python):
What is a Group?
An HDF5 group is a structure containing zero or more HDF5 objects. The two primary HDF5 objects are groups and datasets. To create a group, the calling program must:
- 1. Obtain the location identifier where the group is to be created.
- 2. Create the group.
- 3. Close the group.
To create a group, the calling program must call
H5Gcreate / h5gcreate_f.
To close the group, H5Gclose / h5gclose_f must be called. The close call is mandatory.
For example:
C: group_id = H5Gcreate(file_id, "/MyGroup", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Gclose (group_id); FORTRAN: CALL h5gcreate_f (loc_id, name, group_id, error) CALL h5gclose_f (group_id, error)
Programming Example
Description
The following example shows how to create and close a group. It creates a file calledgroup.h5
(groupf.h5
for FORTRAN),
creates a group called MyGroup
in the root group,
and then closes the group and file.
-
[ C Example ]
-
h5_crtgrp.c
[ FORTRAN Example ] -
h5_crtgrp.f90
[ C++ Example ] -
h5tutr_crtgrp.cpp
[ Python Example ] -
h5_crtgrp.py
For details on compiling an HDF5 application: [ Compile Information ]
File Contents
The contents ofgroup.h5
and the
definition of the group are shown below. (The FORTRAN program
creates the HDF5 file groupf.h5
and the resulting DDL shows
groupf.h5
in the first line.)
Fig. 8.1 The Contents of group.h5 .
|
Fig. 8.2 group.h5 in DDL |
|
HDF5 "group.h5" { GROUP "/" { GROUP "MyGroup" { } } } |
- - Last modified: 21 December 2016