The Wayback Machine - https://web.archive.org/web/20090330052722/http://www.hdfgroup.org:80/h5h4-diff.html
hdf images hdf images

HDF5 FAQ -- How is HDF5 different than HDF4 ?

What are the Most Noticeable Differences between HDF4 and HDF5?

The HDF5 Format is completely different from HDF4. For most users it will never be necessary to know about the file format for either format.

Most users will work with the Data Model and APIs. The HDF4 and HDF5 Data Models and APIs are considerably different.


How is the HDF5 Data Model Different from HDF4?

The HDF4 Data Model has eight basic objects:

HDF5 includes two primary objects:

The HDF4 objects can all be conceptually mapped to an HDF5 Group or Dataset.

In addition to the fundamental data objects, HDF5 manages dataspaces, data types, and attributes as objects in their own right. HDF4 uses these concepts, but has no object model that represents them.

The HDF5 data model is "simpler" in the sense that it has fewer objects and has a consistent object model throughout. In comparison, HDF4 has many more objects, and lacks a clear object model.

On the other hand, the HDF5 data model exposes many details. This makes the object model very powerful, but usually requires the user program to handle many routine details. In contrast, the HDF4 objects are simpler, requiring less programming to accomplish simple tasks.


How is the HDF5 API Different?

HDF4 has interfaces for the six types of objects supported, which allow a user program to perform common operations in a few calls. Equivalent operations may require many more calls to HDF5, even for very simple tasks.

The HDF5 high-level APIs provide simpler interfaces for common tasks.


What features does HDF4 have that HDF5 does not (yet) provide?

Aside from the general differences, HDF5 does not currently support several features of HDF4.


Can I read/write netCDF with HDF5?

No.


Can I use JPEG, etc. Compression with HDF5?

HDF5 currently supports only GZIP and SZIP compression. However, additional compression can be added easily.


What features does HDF5 have that HDF4 does not?

An HDF5 file has a true hierarchical file structure and a naming scheme for all the objects in the file (path names).

HDF5 uses a true hierarchical file structure, similar to the Unix file system. There is a "root group" and all objects belong to at least one group. In HDF5, every link has a name and objects are accessible by path names.

HDF4 uses a "pseudo-flat" file structure using Vgroups. There is no "root group" and objects do not have to belong to a group (Vgroup). Not all HDF4 objects have names.


HDF5 has "Dataspace" objects, which are not in HDF4.


HDF5 has "Datatype" objects, which are different than HDF4 datatypes.


...convert data from HDF4 to HDF5?

...create and use "String" data?




...create a Chunked/Compressed Dataset?

The storage properties, including chunking and compression, are controlled with an HDF5 Property List. See the HDF5 tutorial for an example:

    /HDF5/Tutor/extend.html - Example using Chunking


...read/write a sub-set or sub-sample of a Dataset

HDF5 supports a very flexible and general set of data selection features, which control both the source and destination. HDF5 supports:

See the HDF5 tutorial for examples:

   /HDF5/Tutor/select.html - Hyperslab selection
   /HDF5/Tutor/selectc.html - Point selection


...find the tag and ref of an HDF5 object?

HDF5 does not use tags and refs.


...locate and access specific objects in an HDF5 file?

You have to traverse all the objects in the file using H5Giterate. For any object for which the link count is > 1, record it in a table, using "objno" as a key (See H5Gget_objinfo). The first time you see it, there will be no entry in the table, and subsequent visits will find an entry.

If you need a table of contents for the whole file, then collect all the information you need, and use "objno" as a key to avoid loops.

In a future release of HDF5 we will be providing a function to return a table of contents, as well as functions to determine the number of members in a group and to return the name and type of the member of the group for a specific index value.


...write or access global attributes in HDF5?

You can write attributes to the root group, which would be "global" to all objects in the HDF5 file. To do this you must open the root group with H5Gopen and attach the attribute to this group. You cannot attach an attribute to the file, using the file identifier.

- - Last modified:August 22nd 2007