Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

For further information on datatypes, see The Datatype Interface (H5T) in the HDF5 User's Guide, in addition to the Datatypes tutorial topic.

Fig 5.1   HDF5 datatypes

...

High Level APIs

The High Level HDF5 Lite APIs (H5LT) include functions that simplify and condense the steps for creating datasets in HDF5. The examples in the following section use the standard APIs. For a quick start you may prefer to look at the HDF5 Lite APIs at this time.

If you plan to work with images, please look at the High Level HDF5 Image APIs (H5IM), as well.

Programming Example

...

The following example shows how to create an empty dataset. It creates a file called dset.h5 in the C version (dsetf.h5 in Fortran), defines the dataset dataspace, creates a dataset which is a 4x6 integer array, and then closes the dataspace, the dataset, and the file:

C   F90   C++   Python

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 ]

Remarks

H5ScreateH5S_simple / h5screate_simple_fCREATE_SIMPLE creates a new simple dataspace and returns a dataspace identifier.
H5Sclose / h5scloseH5S_fCLOSE releases and terminates access to a dataspace.

...

 C:
    dataspace_id = H5Screate_simple (rank, dims, maxdims);
    status = H5Sclose (dataspace_id );

 FORTRAN:
    CALL h5screate_simple_f (rank, dims, dataspace_id, hdferr, maxdims=max_dims)
         or
    CALL h5screate_simple_f (rank, dims, dataspace_id, hdferr)

    CALL h5sclose_f (dataspace_id, hdferr)

 

H5Dcreate / h5dcreateH5D_fCREATE creates an empty dataset at the specified location and returns a dataset identifier.
H5Dclose / h5dcloseH5D_fCLOSE closes the dataset and releases the resource used by the dataset. This call is mandatory.

...

  CALL h5open_f (hdferr)
  CALL h5close_f (hdferr)

h5openH5_fOPEN must be called before any HDF5 library subroutine calls are made;
h5closeH5_fCLOSE must be called after the final HDF5 library subroutine call.

...