- Notifications
You must be signed in to change notification settings - Fork1
Provides a Fortran wrapper for HDF5
License
cbusta/hdf5-wrapper
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
By: Christian Bustamante
https://cbustamante.co/
This package provides a Fortran wrapper for HDF5 (.h5 files).It provides a simpler interface that allows easy writing and reading of h5 files for double precision and integer arrays of up to six dimensions.On top of the Fortran wrapper, the package provides a Matlab function that simplifies the process of reading entire h5 files.As opposed to having to read variable by variables, this function reads all variables and put them in a Matlab structure.
Using this package requires a Fortran compiler and the HDF5 library.
- Fortran compiler: tested and built with
ifortversion 19.0.5.281 for Linux and Windows. It has also been tested ingfortran. - HDF5 libraries: tested and built using HDF5 1.10.5, but it has also been used with other library versions.
The following source files are provided with the package:
Lib_Rwhdf5.f90: Fortran wrapper that defines interfaces for reading and writing h5 files.Lib_Kind.f90: declares double precision and integer types.exampleh5.f90: example that illustrates the usage of the package. It writes two arrays intodata.h5.Makefile: used to buildexampleh5.f90. It depends ontree.depthat specifies the compilation order.Read_HDF5.m: Matlab function that reads and h5 file.example_readh5.m: example that illustrates how to use the functionRead_HDF5.mto readdata.h5.
After having the HDF5 library installed, load the two provided Fortran modules into your program.
use lib_kinduse lib_rwhdf5implicit noneThe Fortran wrapper provides four major subroutines and one integer type:
- Subroutines
hdf5_openfandhdf5_closefare used to open and close an h5 file. These are only needed when writing into an h5 file (not when reading). - Subroutines
hdf5_readandhdf5_writeare used to read and write data into an h5 file. The write subroutine should be used after an h5 file has been created withhdf5_openf. The file should be closed after all variables have been written to it. - Integer type
hid_t: needed to "label" an h5 file when opened.
Finally, note that theMakefile specifies theHDF5_PATH variable that needs to be adjusted depending on where theinclude andlib folders of the HDF5 library have been installed.
MIT license.
About
Provides a Fortran wrapper for HDF5
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.