@@ -0,0 +1,777 @@
+#!/bin/env python2%0A# vim:set ts=4 sts=4 sw=4 et:%0A%0Afrom collections import defaultdict%0A%0Aimport numpy as np%0Aimport tables%0A%0Afrom km3pipe.core import Module%0A%0A%0Aclass HDF5Bucket(Module):%0A    def __init__(self, **context):%0A        super(self.__class__, self).__init__(**context)%0A        self.filename = self.get(%22filename%22)%0A        self.prefix = self.get(%22prefix%22) or '/'%0A        self.store = defaultdict(list)%0A%0A    def process(self, blob):%0A        for key, val in blob.items():%0A            self.store%5Bkey%5D.append(val)%0A%0A    def finish(self):%0A        h5 = tables.open_file(self.filename, mode='w', ftitle=%22Data%22)%0A        for key, data in self.store.items():%0A            arr = np.array(data, dtype=%5B(key, float), %5D)%0A            h5.create_table(self.prefix, key, arr)%0A        h5.close()%0A

add Hdf5bucket