r - Saving in hdf5save creates an unreadable file -
i'm trying save array hdf5 file using r, having no luck.
to try , diagnose problem ran example(hdf5save)
. created hdf5 file read h5dump
.
when ran r code manually, found didn't work. code ran same ran in example script (except change of filename avoid overwriting). here code:
(m <- cbind(a = 1, diag(4))) ll <- list(a=1:10, b=letters[1:8]); l2 <- list(c="c", l=ll); pp <- pi hdf5save("ex2.hdf", "m","pp","ll","l2") rm(m,pp,ll,l2) # , reload them: hdf5load("ex2.hdf",verbosity=3) m # read "ex1.hdf"; buglet: dimnames dropped str(ll) str(l2)
and here error message h5dump
:
h5dump error: unable open file "ex2.hdf"
does have ideas? i'm @ loss.
thanks
i have had problem. not sure of cause , neither hdf5 maintainers. authors of r package have not replied.
alternatives work
in time since answered, hdf5
package has been archived, , suitable alternatives (h5r
, rhdf5
, , ncdf4) have been created; using
ncdf4`:
- since netcdf-4 uses hdf5 storage layer, ncdf4 package provides interface both netcdf-4 , hdf5.
- the h5r package r>=2.10
- the
rhdf5
package available on bioconductor.
workarounds 2 functional unsatisfactory workarounds used prior finding alternatives above:
- install r 2.7, hdf5 version 1.6.6, r hdf5 v1.6.7, , zlib1g version 1:1.2.3.3 , use when writing files (this solution until migrating
ncdf4
library). - use h5totxt @ command line [hdf5utils][1] program (requires using bash , rewriting r code)
a minimal, reproducible demonstration of issue:
here reproducible example sends error
first r session
library(hdf5) dat <- 1:10 hdf5save("test.h5","dat") q() n # not save workspace
second r session:
library(hdf5) hdf5load("test.h5")
output:
hdf5-diag: error detected in hdf5 library version: 1.6.10 thread 47794540500448. trace follows. #000: h5f.c line 2072 in h5fopen(): unable open file major(04): file interface minor(17): unable open file #001: h5f.c line 1852 in h5f_open(): unable read superblock major(04): file interface minor(24): read failed #002: h5fsuper.c line 114 in h5f_read_superblock(): unable find file signature major(04): file interface minor(19): not hdf5 file #003: h5f.c line 1304 in h5f_locate_signature(): unable find valid file signature major(05): low-level i/o layer minor(29): unable initialize object error in hdf5load("test.h5") : unable open hdf file: test.h5
Comments
Post a Comment