Difference between revisions of "HDF5"
KevinYager (talk | contribs) (→Installation) |
KevinYager (talk | contribs) (→Installation) |
||
Line 25: | Line 25: | ||
# Download the hdf5 plugin from [https://www.dectris.com/ Dectris]: | # Download the hdf5 plugin from [https://www.dectris.com/ Dectris]: | ||
## [https://github.com/dectris/HDF5Plugin https://github.com/dectris/HDF5Plugin] | ## [https://github.com/dectris/HDF5Plugin https://github.com/dectris/HDF5Plugin] | ||
+ | ## unzip HDF5Plugin-master.zip | ||
+ | ## cd HDF5Plugin-master/ | ||
+ | ## make | ||
+ | ## mkdir ~/local/lib/hdf5plugin | ||
+ | ## cp lib* ~/local/lib/hdf5plugin/ | ||
+ | ## Obviously, you can select some other location to copy the files in those previous steps. However, the plugin files should be in their ''own sub-folder'', not mixed with other files! One must then set an environment variable for the plugin path. E.g. in "~/.bashrc": | ||
+ | ### export HDF5_PLUGIN_PATH=~/local/lib/hdf5plugin | ||
# If necessary, install dependencies: | # If necessary, install dependencies: | ||
## [http://cython.org/ Cython] (C extensions for Python) | ## [http://cython.org/ Cython] (C extensions for Python) |
Revision as of 09:02, 5 August 2015
Hierarchical Data Format (HDF) is a portable binary format, meant to be extensible and self-describing.
Contents
Tools
- hdfview
Reading
In order to read HDF5 files, you will need a suitable library. Here, we describe how to arrange to open compressed HDF5 files in a Python environment.
Installation
- Install HDF5 library
- To install the version from the repository:
- sudo apt-get install libhdf5-dev
- In some cases, the repository version may not work (or be out of date). In that case, you can manually download the source from hdfgroup, and install it by doing:
- wget http://www.hdfgroup.org/ftp/HDF5/current/src/hdf5-1.8.15-patch1.tar.gz
- tar xzvf hdf5-1.8.15-patch1.tar.gz
- cd hdf5-1.8.15-patch1/
- make install
- Compilation may take 5-10 minutes. If there are any errors, resolve the dependencies using your package manager.
- The library files need to be accessible to other software. This involves adding three of the newly-created folders to the PATH ("hdf5/include/", "hdf5/lib/", "hdf5/bin/"). There are various options:
- The files can be made globally accessible (to all users of the machine) by moving the header files to "/usr/include/", the libraries to "/usr/lib/" and the binaries to "/usr/bin/" (of course you will need to be root to do so).
- The files can be made locally accessible by adding their location to the PATH. Edit ~/.bashrc and add (assuming you put your code in ~/local/):
- export PATH=$PATH:~/local/bin
- export LD_LIBRARY_PATH=~/local/lib
- export CPLUS_INCLUDE_PATH=~/local/include
- Activate the changes by opening a new shell (or running "source ~/.bashrc").
- To install the version from the repository:
- Download the hdf5 plugin from Dectris:
- https://github.com/dectris/HDF5Plugin
- unzip HDF5Plugin-master.zip
- cd HDF5Plugin-master/
- make
- mkdir ~/local/lib/hdf5plugin
- cp lib* ~/local/lib/hdf5plugin/
- Obviously, you can select some other location to copy the files in those previous steps. However, the plugin files should be in their own sub-folder, not mixed with other files! One must then set an environment variable for the plugin path. E.g. in "~/.bashrc":
- export HDF5_PLUGIN_PATH=~/local/lib/hdf5plugin
- If necessary, install dependencies:
- Cython (C extensions for Python)
- sudo apt-get install cython
- python-pkgconfig:
- sudo apt-get install python-setuptools
- wget https://pypi.python.org/packages/source/p/pkgconfig/pkgconfig-1.1.0.tar.gz
- cd d pkgconfig-1.1.0/
- python setup.py install
- Cython (C extensions for Python)
- Install the h5py package (Python library for HDF5).
- Download and extract tarball (e.g. from [1]).
- wget https://pypi.python.org/packages/source/h/h5py/h5py-2.5.0.tar.gz
- tar xzvf h5py-2.5.0.tar.gz
- Setup
- cd h5py
- sudo python setup.py install
- Download and extract tarball (e.g. from [1]).