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. The descriptors and tags page gives the layout and the tag and number type codes.
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.
Not described
The tags page follows the HDF4 Specification and Developer's Guide (4.1r5) and the library headers.
Known, not yet covered
- Reference: specification chapter 5 (sets and groups), 7 (the SD model, with its attribute and dimension records) and 8 (the GR model) are covered only through the tag layouts; the bit-level streams of the N-bit, skipping Huffman, deflate and szip coders; and the Vdata attribute convention. The compression codes and parameters and the SD predefined attributes are now on the tags page.
- Viewer: not re-audited in this pass.
Also used for
- Hierarchical Data Format version 5 – Groups and large numeric datasets, organised like a file system.
Links
Software
Developers
- HDF4 library – The HDF Group’s reference library (C, Fortran)
- GDAL – geospatial library with an HDF4 driver (C, C++)