Compare HDF5 data values
The h5diff tool has limitations for comparing HDF5 data files because it currently can compare only absolute tolerance or relative tolerance. The comparison is mutually exclusive, which fails for many floating point data. A more suitable comparison for floating point data is similar to Numpy:
is_close = abs(actual-desired) <= max(rtol * max(abs(actual), abs(desired)), atol)
- relative tolerance, perhaps 1e-5
- absolute tolerance, perhaps 1e-8 but not zero
We use h5py to read / write HDF5 files from Python.
Comparing floating point data for Python in CI can be done by pytest.approx.