]> git.parisson.com Git - timeside.git/commitdiff
fix(tools/buffering.py): provide compatibility with pytables 2.3.1 use proper argumen...
authorThomas Fillon <thomas@parisson.com>
Thu, 17 Jul 2014 08:55:16 +0000 (10:55 +0200)
committerThomas Fillon <thomas@parisson.com>
Thu, 17 Jul 2014 08:55:16 +0000 (10:55 +0200)
timeside/tools/buffering.py

index 364536c3a696ae17cf122334d77d90a8296c05f4..e49bb28723397941fc55f136943134e8d0c40df2 100644 (file)
@@ -53,9 +53,20 @@ class BufferTable(object):
         except tables.exceptions.NoSuchNodeError:
             if name not in self.array_names:
                 self.array_names.append(name)
+             # The following is compatible with pytables 3 only
+             #self.fileh.create_earray(where=self.fileh.root,
+             #                         name=name,
+             #                         obj=[new_array])
+            atom = tables.Atom.from_dtype(new_array.dtype)
+            if len(new_array.shape) > 1:
+                shape = (0, new_array.shape[1])
+            else:
+                shape = (0,)
             self.fileh.createEArray(where=self.fileh.root,
-                                     name=name,
-                                     obj=[new_array])
+                                    name=name,
+                                    atom=atom,
+                                    shape=shape)
+            self.append(name, new_array)
 
     def close(self):
         for name in self.array_names: