hdf images hdf images

This web site is no longer maintained (but will remain online).
Please see The HDF Group's new Support Portal for the latest information.

HDF5 Tutorial:   Learning HDF5 with HDFView

This tutorial enables you to get a feel for HDF5 by using the HDFView browser. It does NOT require any programming experience.


Begin Tutorial

Once you have HDFView installed, bring it up and you are ready to begin the tutorial.

Topics Covered

Following are the topics covered in the tutorial. The first topic creates the file that is used in the subsequent topics.

  1. Creating a New HDF5 file with a Contiguous Dataset
  2. Displaying a Dataset as an Image
  3. Creating Attibutes
  4. Creating a Compressed and Chunked Dataset
  5. Creating an Image and a Subset
  6. Creating a Table (Compound Dataset)


Creating a New HDF5 File with a Contiguous Dataset

The steps below describe how to create a file (storm.h5), group (/Data), and a contiguous dataset (/Data/Storm) using HDFView. A group is an HDF5 object that allows objects to be collected together. A dataset is an array of data values. A contiguous dataset is one that is stored as a single block in the HDF5 file.

Displaying a Dataset as an Image

Any dataset can be viewed as an image in HDFView. Below are the steps that demonstrate this.

Creating Attributes

Additional information to describe an object can be stored in attributes. An attribute can be added to a group or dataset with HDFView.

The following illustrates how to add an attribute to the group /Data:

Adding an attribute to a dataset is very similar to adding an attribute to a group. For example, the following adds an attribute to the /Storm dataset:

Creating a Compressed and Chunked Dataset

A chunked and compressed dataset can be created using HDFView. A compressed dataset is a dataset whose size has been compressed to take up less space. In order to compress an HDF5 dataset, the dataset must be stored with a chunked dataset layout (as multiple chunks that are stored separately in the file).

Please note that the chunk sizes used in this topic are for demonstration purposes only. For information on chunking and specifying an appropriate chunk size, see the Chunking in HDF5 documentation.

Also see the HDF5 Tutorial topic on Creating a Compressed Dataset.

Creating an Image and a Subset:

A previous topic demonstrated how to view any dataset as an image in HDFView. With HDFView you can also create an image to begin with, as is shown below.

Creating a Table (Compound Dataset)

A dataset with a compound datatype contains data elements that consist of multiple fields. If the dataspace for the compound dataset is one-dimensional, then the dataset can be viewed as a table in HDFView, as is shown below.

- - Last modified: 31 January 2017