I’m struggle with using HDF5
.
I’m trying to append data in .h5
file.
So, I wanna make a dataset whose prescribed size is unlimited (on the first axis, specifically).
For example, receiving data with dims (5,6)
, then append the existing array with size (n, 5, 6)
to be (n+1, 5, 6)
.
I’ve read this docs, but I don’t understand what I have to do for that.
Here is an example code:
function test_hdf5()
# using HDF5 (done at the beginning of this file)
path = "data/tmp.h5"
name = "asdf"
val = zeros(1, 5, 6)
h5open(path, "w") do dummy
end # generate `data/tmp.h5`
h5open(path, "r+") do h5file
dset = d_create(
h5file,
name,
Float64,
(size(val), (-1, size(val)[2:end]...)), # (1)
"chuck", # (2)
size(val), # (3)
)
end
end
- do I have to write dims and max_dims (see (1))? Can’t I just write information like
(typemax(Int64), 5, 6)
? - Do I have to add “chuck”? and
size(val)
? - To do what I need, what should be changed in the example code?
Sorry for my poor understand in use of HDF5
.