我曾广泛使用过ROOT,它有自己的数据文件格式,但由于各种原因,我们希望切换到HDF5文件。不幸的是,我们仍然需要一些在格式之间转换文件的方法。有没有人知道有没有现成的库这样做?
发布于 2012-05-19 04:46:45
您可以查看rootpy,它有一个通过PyTables:http://www.rootpy.org/commands/root2hdf5.html将根文件转换为HDF5的工具
发布于 2013-01-20 04:04:35
如果您仍然对这个问题感兴趣,那么最近对rootpy的root2hdf5脚本和root_numpy包( root2hdf5用来将TTrees转换为NumPy结构化数组)有了很大的改进:
root2hdf5 -h
usage: root2hdf5 [-h] [-n ENTRIES] [-f] [--ext EXT] [-c {0,1,2,3,4,5,6,7,8,9}]
[-l {zlib,lzo,bzip2,blosc}] [--script SCRIPT] [-q]
files [files ...]
positional arguments:
files
optional arguments:
-h, --help show this help message and exit
-n ENTRIES, --entries ENTRIES
number of entries to read at once (default: 100000.0)
-f, --force overwrite existing output files (default: False)
--ext EXT output file extension (default: h5)
-c {0,1,2,3,4,5,6,7,8,9}, --complevel {0,1,2,3,4,5,6,7,8,9}
compression level (default: 5)
-l {zlib,lzo,bzip2,blosc}, --complib {zlib,lzo,bzip2,blosc}
compression algorithm (default: zlib)
--script SCRIPT Python script containing a function with the same name
that will be called on each tree and must return a tree or
list of trees that will be converted instead of the
original tree (default: None)
-q, --quiet suppress all warnings (default: False)发布于 2014-02-10 14:30:49
在我最后一次检查时(几个月前),root2hdf5有一个限制,它不能处理TBranches,它是数组。出于这个原因,我写了一个bash脚本:root2hdf (很抱歉没有创意的名字)。
它将根文件和文件中TTree的路径作为输入参数,并生成源代码&编译为可在根文件上运行的可执行文件,将它们转换为HDF5数据集。
它也有一个限制,即它不能处理复合TBranch类型,但我不知道root2hdf5也是如此。
https://stackoverflow.com/questions/10121233
复制相似问题