how to compare and check if two binary(h5) files numerically have the same contents
Cameron Simpson
cs at cskk.id.au
Tue Nov 21 06:03:21 EST 2017
On 21Nov2017 02:04, Heli <hemla21 at gmail.com> wrote:
>I am trying to compare the contents of two binary files. I use python 3.6
>filecomp comparing same name files inside two directories.
>
>results_dummy=filecmp.cmpfiles(dir1, dir2, common, shallow=True)
>
>The above line works for *.bin file I have in both directories, but it does not work with h5 files.
>
>When comparing two hdf5 files that contain exactly the same groups/datasets and numerical data, filecmp.cmpfiles finds them as mismatch. My hdf files are not binary equal but contain the same exact data.
>
>Is there anyway to compare the contents of two hdf5 files from within Python
>script and without using h5diff?
There are several packages on PyPI related to the H5 data format:
https://pypi.python.org/pypi?%3Aaction=search&term=h5
I imagine what you need to do is to load your 2 H5 data files and then compare
the data structures within them. Hopefully one of these packages can be used
for this. This one looks promising:
https://pypi.python.org/pypi/h5py/2.7.1
If you have pip, you should be able to install it thus:
pip install --user h5py
to make use of it.
Cheers,
Cameron Simpson <cs at cskk.id.au> (formerly cs at zip.com.au)
More information about the Python-list
mailing list