R 和 HDF5 问题

发布于 2024-08-11 04:46:59 字数 1038 浏览 4 评论 0原文

我正在尝试将 hdf5 加载到 R 中并遇到一些问题。以下是我配置环境所采取的步骤:

  • 上的 R 2.10.0 (x64)
  • Mac OS X 10.6 hdf5 1.8.3
  • 通过来自 CRAN 的 macports hdf5_1.6.9.tar.gz

安装我怀疑我遇到的问题与不兼容有关我的 HDF5 版本和 R 模块期望的版本。为了完整起见,以下是我安装 R 模块的方式:

R CMD 安装 --configure-vars='CPPFLAGS=-I/opt/local/include' --configure-args='--with-hdf5=/opt/local' hdf5_1.6.9.tar.gz< /p>

这构建得很好。该库似乎加载没有问题,但当我尝试加载文件时没有返回数据:

库(hdf5)

hdf5load("test.h5")

但是,

osx:data scott$ h5dump test.h5 HDF5“测试.h5”{ 团体 ”/” { 数据集“dset”{ 数据类型 H5T_STD_I32LE 简单数据空间 { ( 31 ) / ( 31 ) } 数据 { (0):1、2、4、8、16、32、64、128、256、512、1024、2048、4096、8192、 (14):16384、32768、65536、131072、262144、524288、1048576、2097152、 (22): 4194304、8388608、16777216、33554432、67108864、134217728、 (28): 268435456、536870912、1073741824 } } } }

有什么想法吗

提前致谢。

I am trying to load an hdf5 into R and running into some problems. Here are the steps I took to configure my environment:

  • R 2.10.0 (x64) on Mac OS X 10.6
  • hdf5 1.8.3 installed via macports
  • hdf5_1.6.9.tar.gz from CRAN

I suspect the problem I am having relates to incompatibilities in my version of HDF5 and the one the R module expects. For completeness here is how I installed the R module:

R CMD INSTALL --configure-vars='CPPFLAGS=-I/opt/local/include' --configure-args='--with-hdf5=/opt/local' hdf5_1.6.9.tar.gz

This builds fine. The library seems to load without issue, but no data is returned when I try to load a file:

library(hdf5)

hdf5load("test.h5")

NULL

Yet,

osx:data scott$ h5dump test.h5
HDF5 "test.h5" {
GROUP "/" {
DATASET "dset" {
DATATYPE H5T_STD_I32LE
DATASPACE SIMPLE { ( 31 ) / ( 31 ) }
DATA {
(0): 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192,
(14): 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152,
(22): 4194304, 8388608, 16777216, 33554432, 67108864, 134217728,
(28): 268435456, 536870912, 1073741824
}
}
}
}

Any thoughts?

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

苦笑流年记忆 2024-08-18 04:46:59

您还可以尝试 CRAN 上的 h5r 包。该软件包使用新的 hdf5 库,并提供比 hdf5 库更多的功能。

You can also try the h5r package on CRAN. This package uses the new hdf5 libraries and provides more functionality than hdf5 library.

猫卆 2024-08-18 04:46:59

使用 hdfload() 中的 verbosity 参数并使用 ls() 检查您的环境。 hdfload() 有一个副作用,它将表加载到当前环境中,NULL 是默认返回值。如果使用参数 load=TRUE,则对象将作为命名列表的组件返回:

  • load:逻辑值。如果“假”,
    对象返回为
    命名列表的组成部分。如果为“TRUE”(默认值),则
    对象作为具有自己的单独变量加载
    名称 - 在这种情况下该函数不返回任何内容。

在我的 Mac 上,使用相同的设置一切都运行良好。

R> rm(list=ls())
R> ls()
character(0)
R> hdf5load("TestHDF5.h5", verbosity=3)
hdf5_global_verbosity=3 load=1
Processing object: Dataset0 ...... its a dataset...Dataset has ID335544326
Dataset has tid 201326902
Dataset has space id 268435467
Dataset has rank 1
Dataset has dims/maxdims: 1 / 1 
Allocating vector with rank=1 dim=1
calling vector_io. Hangs here with big datsets
Setting buffer size in plist
About to read with bufsize = 50
in string_ref: count=1, size=25 srcbf=25
leaving string_ref
 Done read
in vector_io: permuting
in vector_io: tidying
Phew. Done it. calling iinfo->add
Rank > 1 or not VECSXP
Calling  hdf5_load_attributes 
back from  hdf5_load_attributes 
...Finished dataset 
Processing object: Table0 ...... its a dataset...Dataset has ID335544327
Dataset has tid 201326906
Dataset has space id 268435468
Dataset has rank 1
Dataset has dims/maxdims: 1 / 1 
Dataset has type = VECSXP and rank 1
Reading...
....done
in string_ref: count=1, size=25 srcbf=25
leaving string_ref
...Finished dataset 
NULL
R> ls()
[1] "Dataset0" "Table0"

Use the verbosity argument in hdfload() and check your environment using ls(). hdfload() has a side effect, it loads the tables into the current environment, NULL is the default return value. If you use the argument load=TRUE the objects are returned as the components of a named list:

  • load: A logical value. If 'FALSE',
    the objects are returned as the
    components of a named list. If 'TRUE' (the default), the
    objects are loaded as individual variables with their own
    names - the function returns nothing in this case.

On my Mac everything works well with the same setup.

R> rm(list=ls())
R> ls()
character(0)
R> hdf5load("TestHDF5.h5", verbosity=3)
hdf5_global_verbosity=3 load=1
Processing object: Dataset0 ...... its a dataset...Dataset has ID335544326
Dataset has tid 201326902
Dataset has space id 268435467
Dataset has rank 1
Dataset has dims/maxdims: 1 / 1 
Allocating vector with rank=1 dim=1
calling vector_io. Hangs here with big datsets
Setting buffer size in plist
About to read with bufsize = 50
in string_ref: count=1, size=25 srcbf=25
leaving string_ref
 Done read
in vector_io: permuting
in vector_io: tidying
Phew. Done it. calling iinfo->add
Rank > 1 or not VECSXP
Calling  hdf5_load_attributes 
back from  hdf5_load_attributes 
...Finished dataset 
Processing object: Table0 ...... its a dataset...Dataset has ID335544327
Dataset has tid 201326906
Dataset has space id 268435468
Dataset has rank 1
Dataset has dims/maxdims: 1 / 1 
Dataset has type = VECSXP and rank 1
Reading...
....done
in string_ref: count=1, size=25 srcbf=25
leaving string_ref
...Finished dataset 
NULL
R> ls()
[1] "Dataset0" "Table0"
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文