Introduction
HDF4 is the older of the two Hierarchical Data Formats, created at the National Center for Supercomputing Applications in the late 1980s and now maintained by The HDF Group. It stores scientific data sets, raster images, tables and annotations in one file. It is still met mainly in NASA Earth observation archives, such as data from the MODIS instruments, which use the HDF-EOS conventions built on it.
HDF4 is not compatible with HDF5, a redesign
with a different file layout. Files use .hdf, .h4 or
.hdf4; some HDF5 files also use .hdf.
Structure
An HDF4 file starts with the four bytes 0E 03 13 01. Everything in it is
an object identified by a tag, which says what kind of object it is,
and a reference number, which tells objects of the same kind apart.
Blocks of data descriptors list each object’s tag, reference number,
offset and length, and link to the next block, so a reader finds every object through
them. Numbers are big-endian.
Higher-level structures, such as a scientific data set with its dimensions and attributes, are built from several tagged objects grouped together.
Telling .HDF files apart
Read the first four bytes. 0E 03 13 01 means HDF4. The eight bytes
89 48 44 46 0D 0A 1A 0A mean an HDF5 file.
Also used for
Links
Software
Developers
- HDF4 library, C and Fortran, from The HDF Group
- GDAL, C and C++, with an HDF4 driver