h5netcdf
netCDF4 via h5py
What it is and what it does
h5netcdf is a Python interface to the netCDF4 file format that reads and writes HDF5 files directly via h5py, h5pyd, or the pure-Python Pyfive backend, without requiring the Unidata netCDF C library. It offers two APIs: a modern hierarchical interface modeled on h5py, and a legacy API designed for compatibility with netCDF4-python. The package supports both NETCDF4 and NETCDF4_CLASSIC formats, unlimited dimensions, groups, and hierarchical variable access.
The main appeal is reduced installation friction—if you already have h5py, reading netCDF4 files may be simpler than installing netCDF4-python and its C dependencies. It also provides a pure-Python reading path via Pyfive, useful in restricted or hard-to-build environments. The package has been in active development since 2015 and is marked production-stable, with support for Python 3.9 through 3.14.
Use it for:
- Read and write netCDF4 files in environments where the Unidata netCDF C library is difficult or impossible to install.
- Access HDF5 data via the netCDF4 interface when you already have h5py installed, avoiding duplicate binary dependencies.
- Use the pure-Python Pyfive backend to read netCDF files in restricted or containerized environments without C compilation.
- Migrate from netCDF4-python to h5netcdf using the legacy API for drop-in compatibility with minimal code changes.
- Work with hierarchical netCDF data using the modern API's h5py-like syntax for direct group and variable access.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
h5netcdf reads and writes netCDF4 files using h5py or h5pyd backends, bypassing the Unidata netCDF C library and offering an alternative interface to netCDF4-python with optional pure-Python support via Pyfive.
Yes. h5netcdf is production-stable, actively maintained, has low install friction, no known vulnerabilities, and a permissive license. Install it if you need netCDF4 support without the Unidata C library, or if you want a pure-Python reading option. The legacy API makes it a low-risk alternative to netCDF4-python for existing code.
Install
h5netcdf on PyPI
pip
pip install h5netcdfuv
uv add h5netcdfpoetry
poetry add h5netcdfInstalling h5netcdf
Before you install
Low friction: pure Python wheel with only packaging and numpy as runtime dependencies. Actively maintained with recent commits and production-stable status. Optional extras (h5py, h5pyd, pyfive) can be installed separately to avoid forcing a specific HDF5 backend.
License in practice
BSD 3-Clause permissive license allows commercial and private use with minimal restrictions—retain copyright notice and disclaimer in distributions.
Quickstart
pip install h5netcdf[h5py]
import h5netcdf
import numpy as np
with h5netcdf.File("mydata.nc", "w") as f:
f.dimensions = {"x": 5}
v = f.create_variable("hello", ("x",), float)
v[:] = np.ones(5)
Requires h5py (version 3.0+) or h5pyd installed separately; pure-Python Pyfive backend available but optional.
Verify before relying
- Whether the reported 4x performance improvement over netCDF4-python holds for typical workflows beyond the single cited case.
- Current state of unsupported netCDF operations (rename, delete) and whether patches have been accepted since publication.
Package facts
| License | Copyright (c) 2015, h5netcdf developers All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are… (full text in the JSON record) (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — packaging, numpy |
| Maintenance | actively maintained — 203 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 5,183,537/month — #2,146 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: h5netcdf-1.8.1-py3-none-any.whl
Tags
More Scientific/Engineering packages
NumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
pandaspandas provides fast, flexible data structures…
permissive · top 100 on PyPI
scipyscipy provides numerical algorithms for…
permissive · top 100 on PyPI
scikit-learnscikit-learn provides a comprehensive Python…
permissive · top 1,000 on PyPI
dilldill extends Python's pickle module to…
permissive · top 1,000 on PyPI
multiprocessMultiprocess is an enhanced fork of Python's…
permissive · top 1,000 on PyPI
h5pyh5py reads and writes HDF5 files from Python,…
permissive · top 1,000 on PyPI
netCDF4netcdf4 provides a Python interface to read,…
permissive · top 5,000 on PyPI
pydappydap is a pure-Python OPeNDAP client and…
permissive · top 15,000 on PyPI
h5groveh5grove provides building blocks for serving…
permissive · top 15,000 on PyPI
hickleHickle serializes Python objects to HDF5 files…
unclear · top 15,000 on PyPI
mat73Loads MATLAB 7.3 .mat files (stored as HDF5)…
copyleft · top 15,000 on PyPI
cfgribcfgrib maps GRIB meteorological data files to…
permissive · top 5,000 on PyPI
tablesPyTables provides an object-oriented interface…
permissive · top 5,000 on PyPI
pymatreaderReads MATLAB .mat files in both legacy and…
permissive · top 15,000 on PyPI
kerchunkKerchunk extracts metadata from chunked,…
permissive · top 15,000 on PyPI