Easy HDF5 Fortran interface

Using HDF5 from any language can be intimidating if directly using the low-level HDF5 API. HDF5 interfaces have sprung up for popular languages that Make HDF5 trivially easy to use, such as Python h5py. Now Fortran also has an easy, powerful object-oriented and functional HDF5 interface named h5fortran. h5fortran builds and connects to your project using CMake or Meson. h5fortran uses Fortran 2018 standard code and is tested across multiple compilers including GFortran and Intel oneAPI. The efficient h5fortran interface is polymorphic (rank/dimension and type-agnostic) from scalars through 7-D arrays. A companion library for NetCDF is nc4fortran.


H5fortran is simpler to use than even Matlab HDF5 interface.


use h5fortran

call h5write('foo.h5', '/x', x)

call h5read('bar.h5', '/y', y)


use h5fortran

type(hdf5_file) :: h5f

call h5f%initialize('test.h5', status='new')

call h5f%write('/value1', 123.)

call h5f%finalize()