HDF5
Hierarchical Data Format for large scientific datasets
HDF5 (Hierarchical Data Format version 5) is a file format and accompanying software library for storing and organizing large, complex scientific datasets in a single self-describing binary file. It structures data in a filesystem-like…
Definition
HDF5 (Hierarchical Data Format version 5) is a file format and accompanying software library for storing and organizing large, complex scientific datasets in a single self-describing binary file. It structures data in a filesystem-like hierarchy of groups and datasets, similar to directories and files, and lets each dataset carry its own metadata and multi-dimensional array structure, making it suited to numerical data too large or structurally complex for plain text or spreadsheet formats.
Overview
An HDF5 file is organized around two core building blocks: groups, which act like folders that can nest other groups or datasets, and datasets, which hold the actual multi-dimensional numerical arrays along with metadata describing their type, shape, and attributes. This tree structure allows a single file to hold many logically related but structurally distinct datasets — for instance, temperature readings at different time steps, alongside coordinate arrays and experiment metadata — all addressable through a path-like naming scheme reminiscent of a filesystem. Mechanically, the HDF5 library handles the low-level details of chunking, compression, and efficient partial I/O: rather than requiring an entire dataset to be loaded into memory, applications can read or write specific slices of a large array directly from disk, and datasets can be chunked and compressed transparently so that only the relevant chunks are decompressed on access. This makes HDF5 practical for datasets far larger than available RAM, since programs interact with the file through an API that manages memory-efficient access patterns rather than manual byte-offset arithmetic. HDF5 differs from simpler scientific data formats in its combination of hierarchy and self-description: a plain binary dump requires an external specification to interpret, and even structured formats like CSV or plain NumPy arrays lack a built-in way to attach rich metadata or organize multiple related arrays in one file. NetCDF-4, a widely used format in climate and atmospheric science, is actually built on top of HDF5's underlying storage model but adds its own conventions for scientific metadata, illustrating how HDF5 often serves as a foundation layer beneath domain-specific formats rather than being used entirely on its own terms. In practice, HDF5 is used extensively in fields that generate large numerical datasets: climate modeling, astronomy, genomics, and physics simulations commonly store multi-terabyte results in HDF5 files, and it is a standard export and interchange format for tools in the scientific Python ecosystem, deep learning checkpoint storage, and instrument data acquisition systems. Its language bindings span Python, C, C++, Java, and Fortran among others, making it a practical choice for scientific workflows that mix multiple programming languages around a shared dataset. HDF5's flexibility comes with complexity: the format's rich feature set (chunking strategies, compression filters, and internal metadata structures) means files can be harder to inspect casually than plain text formats, and a corrupted HDF5 file can be more difficult to partially recover than simpler formats due to its internal indexing structures. It is also not well suited to workloads needing simple human-readable output or lightweight, ad hoc configuration data, where a plain text or JSON format is a more appropriate and simpler choice.
Key Features
- Organizes data in a hierarchical tree of groups and datasets
- Stores multi-dimensional numerical arrays with attached metadata
- Supports chunked storage and compression for efficient partial I/O
- Allows reading or writing dataset slices without loading entire arrays
- Serves as the underlying storage model for formats like NetCDF-4
- Provides language bindings across Python, C, C++, Java, and Fortran
- Suited to datasets far larger than available system memory