Page tree


 HDF4 (also known as HDF) is a library and multi-object file format for storing and managing data between machines.

There are two versions of HDF technologies that are completely different: HDF4 and HDF5. HDF4 is the first HDF format. HDF4 is largely deprecated, though still forms an important part of modern climate and weather observations as the standard data format for NASA's Earth Observing System data products. More information can be found at the HDF4 Support Page on the HDFgroup website.

If you are looking to modify your software to use a new data format, consider HDF5 or NetCDF... instead of HDF4.

How to use 

To use HDF4 first load one of the HDF4 modules

$ module load hdf4/4.2.14

It is important to specify a version number when loading an HDF4 module, the HDF4 modules on Gadi have been built with different features due to build compatibility issues. HDF4 cannot be built with both the Fortran Interface and shared libraries enabled. If you require the Fortran Interface to HDF4 for your application, load the hdf4/4.2.15  module instead. If not, we recommend using hdf4/4.2.14  as it has been built with shared libraries enabled.

As HDF4 is considered deprecated, there are no changes to functionality between version 4.2.14  and 4.2.15 . The majority of the changes to version 4.2.15  involve updates for platform and compiler support when building the library itself. These changes are not relevant to users who intend to build software against HDF4 on Gadi.

When building an application on Gadi against hdf4/4.2.14 , only the required HDF4 libraries need to be linked.

$ gcc -o read_h4_file read_h4_file.c -ldf -lmfhdf

In the above command icc can be substituted for gcc, as the Intel compiler is capable of linking to packages built with the GNU compilers. The libraries that HDF4 depends on are linked automatically by default using data stored in the shared HDF4 libraries. You do not need to load any other modules in order to compile your application. In order to use the Fortran Interface, the hdf4/4.2.15  module needs to be loaded, and the libraries that HDF4 depends on need to be linked manually. The easiest way to do this is to use the compiler wrappers provided by HDF4

$ h4fc -o read_h4_file read_h4_file.f90

This wrapper can be used with both GNU and Intel fortran compilers. The underlying fortran compiler used by the wrapper will be selected based on the modules loaded in your environment, and the HDF4 libraries corresponding to your choice of compiler will be selected at compile time.

Authors: Dale Roberts, Mohsin Ali
  • No labels