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.

This tutorial requires that the default HDFView File Access Mode be Read / Write. If fields are greyed out so that you cannot select them, then the File Access Mode is Read Only.

To change the File Access Mode follow these steps:

  • Bring up HDFView
  • Left-mouse click on the Tools pull-down menu and select User Options.
  • A Preferences window pops up with the General Settings tab selected.
    About half-way down you will see Default File Access Mode.
    Select Read / Write.
  • Click on Apply and Close at the bottom of the window.
  • Close down HDFView.
  • Bring HDFView back up and try the tutorial again.

PLEASE BE AWARE that selecting a File Access Mode of Read / Write can result in changes to the timestamp of HDF files that are viewed with HDFView. In general, a File Access Mode of Read Only should be used to ensure that this does not occur.

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 Attributes
  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.