Compare
HDF5 vs netCDF
HDF5 is a general container for hierarchical data; netCDF provides a scientific data model and APIs. netCDF-4 uses HDF5 as its storage foundation, but an arbitrary HDF5 file is not necessarily readable as netCDF-4.
Which format should you choose?
Choose HDF5 for general hierarchies and HDF5 ecosystem integration; choose netCDF for scientific arrays organized by dimensions, variables, and attributes. Check your readers and writers first.
Good fit for HDF5
Storing large scientific and technical data hierarchically · Keeping multidimensional arrays and related metadata in one container
- Organizing complex data with groups, datasets, and attributes
- Scientific workflows needing partial I/O or dataset-level compression
Good fit for netCDF
Storing and exchanging array-based climate, weather, and Earth-science data
- Describing multidimensional data with dimensions, variables, and attributes
- Portable scientific data workflows using netCDF-aware tools
Basic information
| Field | HDF5 | netCDF |
|---|---|---|
| Extension | .h5, .hdf5 | .nc, .nc4, .cdf |
| MIME type | ||
| Common uses | Storing large scientific and technical data hierarchically · Keeping multidimensional arrays and related metadata in one container | Storing and exchanging array-based climate, weather, and Earth-science data |
| How to open | Use HDF5-capable visualization or analysis software or a library. Inspect the group hierarchy, dataset shapes and types, attributes, and filters. Consult the creator's documentation because applications may define their own HDF5 conventions. | Use netCDF-aware visualization or analysis software or a library. Inspect variables, dimensions, attributes, and the file variant. Check coordinate variables, units, calendar, missing values, and any CF conventions against what your reader expects. |
| Export or convert | Before converting to CSV, Parquet, FITS, or another format, decide how to map hierarchy, array dimensions and types, attributes, units, and coordinates. Some structures or metadata may not fit the target; keep the original and compare values and metadata. | When converting to CSV, HDF5, Zarr, or another format, check whether dimensions, variable types, attributes, coordinates, and time calendars are preserved. Conversion to the classic model may lose extended features; CSV cannot fully represent hierarchy, types, and attributes. |
Choose by use case
Organizing complex data with groups, datasets, and attributes
Storing large scientific and technical data hierarchically · Keeping multidimensional arrays and related metadata in one container
HDF5Scientific workflows needing partial I/O or dataset-level compression
Storing large scientific and technical data hierarchically · Keeping multidimensional arrays and related metadata in one container
HDF5Describing multidimensional data with dimensions, variables, and attributes
Storing and exchanging array-based climate, weather, and Earth-science data
netCDFPortable scientific data workflows using netCDF-aware tools
Storing and exchanging array-based climate, weather, and Earth-science data
netCDFKey point 1
HDF5 defines groups, datasets, and attributes; netCDF centers on dimensions, variables, and attributes for scientific data.
More on the differencesKey point 2
netCDF includes classic and netCDF-4 file formats. netCDF-4 is based on HDF5, with structures constrained by the netCDF model.
More on the differencesMore on the differences
Prefer HDF5 when flexible hierarchy or HDF5-specific tools matter. Prefer netCDF when applications expect its scientific data model and conventions. Confirm compatibility with the exact file variant and software.
- HDF5 is a general hierarchical data model with groups, datasets, and attributes. netCDF offers a scientific model built around dimensions, variables, and attributes.
- netCDF has classic-family and netCDF-4 formats. netCDF-4 uses HDF5 underneath, but not every HDF5 structure is valid or interpretable as netCDF-4.
- When migrating, check dimensions, coordinates, units, missing values, compression, attributes, and extra HDF5 objects. Keep the original until validated.
Frequently asked questions
Can every HDF5 file be opened as netCDF-4?
No. netCDF-4 uses HDF5 storage, but its library expects structures that follow the netCDF-4 model.