H5GEARS
A collection of Python tools for converting HDF5 model/mesh files to other mesh/model formats.
Installation
pip install h5gears # core: h52xyz, h5gears-info, h5gears doctor
pip install "h5gears[nc]" # adds netCDF4, required by h52nc
Or from source:
pip install -e ".[nc]"
netCDF4 is an optional extra because it is a compiled extension linking native
HDF5 and netCDF-C libraries. Installing the pip wheel on top of a conda-managed
HDF5 stack is the usual cause of import failures — see
Troubleshooting.
conda / miniforge environments
Install netCDF4 and h5py from conda-forge, then add h5gears with --no-deps
so pip does not replace them with wheels:
conda install -c conda-forge netcdf4 h5py numpy
pip install --no-deps h5gears
Features
- h52nc: Convert an SRH-2D mesh file (
.h5) to a Delft3D FM (D-Flow FM) UGRIDnet.ncmesh file — requiresnetCDF4 - h52xyz: Extract node coordinates from an SRH-2D mesh file (
.h5) to a<MeshName>_nodes.csvfile — needs onlyh5py - h5gears doctor: Report on the installed HDF5 / netCDF stack and diagnose
netCDF4extension-load failures
Usage
Command-line
# List all available commands
h5gears-info
# Convert every mesh in a single SRH-2D mesh file
h52nc mesh.h5
# Convert every mesh in all matching files (glob expansion supported)
h52nc *.h5
# Convert only a specific mesh by name
h52nc mesh.h5 -n Mesh001
# Write outputs to a specific directory, including node elevation (z)
h52nc mesh.h5 -o out/ -d 3
# Extract node coordinates from every mesh in a single SRH-2D mesh file
h52xyz mesh.h5
# Extract only a specific mesh by name
h52xyz mesh.h5 -n Mesh001
# Write outputs to a specific directory, including node elevation (z)
h52xyz mesh.h5 -o out/ -d 3
# Check the HDF5 / netCDF stack
h5gears doctor
h5gears doctor --json
Python API
from h5gears import h52nc
# List the mesh names contained in an SRH-2D file
h52nc.list_meshes("mesh.h5")
# Convert every mesh in a file to net.nc, returning the output paths
h52nc.convert_file("mesh.h5", out_dir="out/", dim=2)
# Extract node coordinates from every mesh in a file to CSV, returning the output paths
from h5gears import h52xyz
h52xyz.convert_file("mesh.h5", out_dir="out/", dim=2)
Submodules are imported lazily, so import h5gears never pulls in netCDF4.
Only h52nc.write_ugrid_net / h52nc.convert_file require it, and they raise a
descriptive ImportError if it is unavailable.
Troubleshooting
ImportError: DLL load failed while importing _netCDF4: The specified procedure could not be found.
This is a native-library conflict, not an h5gears bug. netCDF4 ships a compiled
extension linked against HDF5, netCDF-C and their dependencies (zlib, libcurl).
The message means Windows found a dependent DLL but a symbol the extension
expected was not in it — the signature of a version mismatch, almost always
caused by mixing conda packages with pip wheels (each pip wheel of netCDF4 and
h5py bundles its own HDF5). On Linux/macOS the same fault appears as
undefined symbol.
Start with:
h5gears doctor
It reports the version and install channel of numpy, h5py, netCDF4 and
cftime, the HDF5 and libnetcdf versions each links against, the full import
error, and which layer is at fault. It exits 0 when clean, 1 when problems are
found.
To repair a mixed environment, make the whole stack come from one channel:
pip uninstall -y netCDF4 h5py
conda install -c conda-forge netcdf4 h5py hdf5 libnetcdf --force-reinstall
Check for a version pin before force-reinstalling if other packages in the
environment constrain netCDF4. If you would rather not disturb a working
environment, build a clean one instead:
conda create -n d3dtools2 -c conda-forge python=3.12 netcdf4 h5py numpy
conda activate d3dtools2
pip install --no-deps h5gears
In the meantime, h52xyz, h5gears-info and h5gears doctor keep working —
they do not touch netCDF4.
Notes
h52ncreads mesh geometry from the2DMeshModulegroup of SRH-2D HDF5 mesh files (node coordinates and element connectivity) and writes it out as a UGRID-stylenet.ncfile compatible with Delft3D FM / D-Flow FM.h52xyzreads node coordinates from the same2DMeshModulegroup and writes a<MeshName>_nodes.csvfile with columnsNodeID,x,y(orNodeID,x,y,zwith-d 3), one row per 1-indexed node id.- By default, every mesh found in an input file is converted; use
-n/--nameto restrict conversion to specific mesh names. - Output files are written alongside each input file by default; use
-o/--outdirto choose a different destination directory. - Shared HDF5-reading and path helpers live in
h5gears._common, which depends only onh5pyandnumpy.
Metadata
Release files for h5gears 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| h5gears-0.3.1.tar.gz | 17.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| h5gears-0.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 38.5 kB
Release files / h5gears-0.3.1.tar.gz
| Download URL | h5gears-0.3.1.tar.gz |
|---|---|
| Size | 17.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c55fafc02d8021fbb69fdfd6f394849e0a318c6c1c6d1ee3f5a102fd302a437d
|
|
BLAKE2b-256 checksum How to use checksums |
b60d09a5441720ade8f1357b778b5763c66679a072d352e40a9096b8de519721
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 4, 2026.
Transparency logRelease files / h5gears-0.3.1-py3-none-any.whl
| Download URL | h5gears-0.3.1-py3-none-any.whl |
|---|---|
| Size | 20.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5ff74c3a4365cf6dab70918b28853fcb7828a322e2a7570079937e2b4b139ad6
|
|
BLAKE2b-256 checksum How to use checksums |
884b869920d2edf436e77d054ebdfa4cf6fd8be141dd4de14fa106ba06805df0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 4, 2026.
Transparency log