0
我通常使用h5py
做HDF5东西在Python和我是否想创建,我想以后扩展数据集,或者我做HDF5扩展阵列:使用PyTables
f = h5py.File('foo.h5', 'w')
d = f.create_dataset('whatever', (5, 5), maxshape=(None, 5), dtype='i8', chunks=True)
...
d.resize((23, 5))
...
的maxshape(None, ...)
设置第一维到“无限”,所以它是可扩展的。
现在我有一个项目,我需要坚持使用PyTables,并希望逐步构建大型数组。有没有办法在PyTables中扩展arrays
?
这大致的想法:
import tables as tb
import numpy as np
filename = "foo.h5"
h5file = tb.File(filename, "a")
gbar = h5file.create_group(h5file.root, "bar", "Pressure")
h5file.create_array(gbar, 'left', np.array((1, 2, 3, 4)), "...")
# now extend the shape of (4,) and append more arrays iteratively???
h5file.close()