brew tap homebrew/science
brew install hdf5
luarocks install hdf5
sudo apt-get install libhdf5-serial-dev hdf5-tools
luarocks install hdf5
sudo apt-get install libhdf5-serial-dev hdf5-tools
luarocks install hdf5 LIBHDF5_LIBDIR="/usr/lib/x86_64-linux-gnu/"
require 'hdf5'
local myFile = hdf5.open('/path/to/write.h5', 'w')
myFile:write('/path/to/data', torch.rand(5, 5))
myFile:close()
require 'hdf5'
local myFile = hdf5.open('/path/to/read.h5', 'r')
local data = myFile:read('/path/to/data'):all()
myFile:close()
h5read /path/to/file.h5 /location/of/data
See the Matlab documentation for further information.
You need to install a library:
$ pip install h5py
Then:
import h5py
myFile = h5py.File('/path/to/file.h5', 'r')
# The '...' means retrieve the whole tensor
data = myFile['location']['of']['data'][...]
print(data)
See also the h5py manual.
You need to install a library:
source("http://bioconductor.org/biocLite.R")
biocLite("rhdf5")
Then:
library(rhdf5)
mydata <- h5read("/path/to/file.h5", "/location/of/data")
str(mydata)
Alternative libraries for R include 'h5r' and 'ncdf4'.
You can optionally pass a DataSetOptions
object to specify how you want data to be written:
require 'hdf5'
local myFile = hdf5.open('/path/to/write.h5', 'w')
local options = hdf5.DataSetOptions()
options:setChunked(32, 32)
options:setDeflate()
myFile:write('/path/to/data', torch.rand(500, 500), options)
myFile:close()
There are also a number of handy command-line tools.
Lists specified features of HDF5 file contents.
Examine the contents of an HDF5 file and dump those contents to an ASCII file.
Compare two HDF5 files.
Copies HDF5 objects from a file to a new file
See this page for many more HDF5 tools.
Libraries for many other languages and tools exist, too. See this list for more information.