使用pytables合并2个hdf5文件

时间:2010-12-06 03:44:05

标签: python hdf5 pytables merging-data

ptrepack几乎是我想要的,除了它只有覆盖或忽略重复路径的选项。下面的例子说明了我想用结构发生的事情

输入文件一

/ (RootGroup) ''
/data_set_name (Group) 'group of images files'
/data_set_name_Set (EArray(7913, 128)) ''
/data_set_name/image_set_index (Table(3,)) ''
  /data_set_name/i100 (Group) 'sift features and coordinates'
  /data_set_name/i100/descriptors (Array(7913, 128)) 'sift descriptors'
  /data_set_name/i100/locations (Array(7913, 4)) 'sift feature locations'

输入文件二

/ (RootGroup) ''
/data_set_name (Group) 'group of images files'
/data_set_name_Set (EArray(4328, 128)) ''
/data_set_name/image_set_index (Table(4,)) ''
  /data_set_name/i1156 (Group) 'sift features and coordinates'
  /data_set_name/i1156/descriptors (Array(4328, 128)) 'sift descriptors'
  /data_set_name/i1156/locations (Array(4328, 4)) 'sift feature locations'

期望的输出

/ (RootGroup) ''
/data_set_name (Group) 'group of images files'
/data_set_name_Set (EArray(12241, 128)) ''
/data_set_name/image_set_index (Table(7,)) ''
  /data_set_name/i100 (Group) 'sift features and coordinates'
  /data_set_name/i100/descriptors (Array(7913, 128)) 'sift descriptors'
  /data_set_name/i100/locations (Array(7913, 4)) 'sift feature locations'

  /data_set_name/i1156 (Group) 'sift features and coordinates'
  /data_set_name/i1156/descriptors (Array(4328, 128)) 'sift descriptors'
  /data_set_name/i1156/locations (Array(4328, 4)) 'sift feature locations'

这是一种有效的方法吗?

1 个答案:

答案 0 :(得分:1)

您的意思是使用相同的路径自动扩展数据集?嗯,我没有想过这个,但看起来像一个很好的功能来实现(虽然只适用于可扩展的数组)。添加了一张票:

http://pytables.org/trac/ticket/325