hdf images hdf images

HDF5 Tutorial:   Learning The Basics
Creating a Group

Contents:


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:

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 called group.h5 (groupf.h5 for FORTRAN), creates a group called MyGroup in the root group, and then closes the group and file.

See HDF5 Introductory Examples for the examples used in the Learning the Basics tutorial. There are examples for several other languages, including Java.

For details on compiling an HDF5 application: [ Compile Information ]

File Contents

The contents of group.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