Page tree

Latest Release:   2.2.4 (tested with HDF 4.2.14, HDF5-1.8.21, and HDF5-1.10.3)       

The h4toh5 software consists of the h4toh5 and h5toh4 command-line utilities, as well as a conversion library for converting between individual HDF4 and HDF5 objects.


The h4toh5 tool is a command line utility that converts a single HDF4 file to an equivalent HDF5 file. All the objects in the file are converted following the HDF4 to HDF5 Mapping Specification. It can also convert an HDF-EOS2 file to an HDF5 file that can be accessed by netCDF-4.


The h5toh4 tool is a command line utility for converting all supported objects and pathways to produce an HDF4 file.  (Not all objects can be converted, and it is NOT an inverse of h4toh5) 

h4toh5 Conversion Library

The h4toh5 Conversion library is a C library that converts individual objects from an HDF4 file to equivalent objects in an HDF5 file. It uses the HDF4 and HDF5 libraries.The conversion library follows the default mapping defined in the specification document, Mapping HDF4 Objects to HDF5 Objects.

Six basic HDF4 objects can be converted to the corresponding HDF5 objects: SDS, Image (including GR, RI8, and RI24), Vdata, Vgroup, Palette, Annotation

In each case, the data, attributes, and auxiliary objects (such as HDF4 dimension scales) are converted, as well.  Additional functions convert sets of objects. Options to the API control some aspects of the conversion, including the name and location of the object in the HDF5 file.

This library is intended to be a toolkit to assist the construction of conversion utilities tailored to specific applications and data products. The application will convert objects from HDF4 to create the desired HDF5 file. In many cases, the application can use the h4toh5 library to perform default or custom conversions of selected objects. in other cases, the h4toh5 library can provide an example or template for the application-specific conversion.

Although we continue to maintain HDF4, we do not plan on adding new features to HDF4, and recommend users move to HDF5 to take advantage of the improved features and performance of HDF5.



Related Information

Differences between HDF4 and HDF5

HDF4 and HDF5 Compatibility and Transition

  • Transition from HDF5 for HDF4 Users: status and goals, December, 2002. [ pdf ]
  • Mapping HDF4 Objects to HDF5 Objects (Specification), Revised in 2017. [ pdf ]
  • Transition from HDF4 to HDF5: Notes about Compatibility, Conversion, and Interoperability of HDF and HDF-EOS  (White paper), September, 2000. [ pdf ]
  • Backward/Forward Compatibility

Technical Reports

  • "Tests of the NCSA h4toh5 utility with NASA Datasets", August, 2001. [HTML]
    This paper reports tests of the h4toh5 utility using real NASA data.  The utility converted files, usually in less than one second per file.  These results show that conversion of HDF4 files to HDF5 is feasible for large collections or on demand.
  • "Conversion of from HDF4 to HDF5: 'Hybrid' HDF-EOS Files", February, 2002. [HTML]
    In this experiment, the heconvert utility is augmented using the h4toh5 Library. In addition to the standard conversion of HDF-EOS objects, the experimental program identifies and converts non-EOS objects in an EOS dataset, creating a more complete HDF-EOS5 file. In conclusion, this experiment shows that the h4toh5 Library provides a toolkit to more easily construct conversion utilities for NASA HDF-EOS files.

--- Last Modified: October 25, 2018 | 08:13 AM