]> git.parisson.com Git - timeside.git/commitdiff
Fix hdf5 bad handling of empty numpy array in some h5py versions
authorThomas Fillon <thomas@parisson.com>
Mon, 21 Apr 2014 17:03:47 +0000 (19:03 +0200)
committerThomas Fillon <thomas@parisson.com>
Mon, 21 Apr 2014 17:03:47 +0000 (19:03 +0200)
timeside/analyzer/core.py

index a88c65977b7b33121c346c9baa5f65bed6287d51..32e33dcc7701a94867909f9127ea22bda64c3990 100644 (file)
@@ -436,7 +436,11 @@ class DataObject(MetadataObject):
                                            key).tolist().__repr__(),
                                        dtype=h5py.special_dtype(vlen=str))
             else:
-                h5group.create_dataset(key, data=self.__getattribute__(key))
+                if numpy.prod(self.__getattribute__(key).shape):
+                    maxshape = None
+                else:
+                    maxshape = (None,)
+                h5group.create_dataset(key, data=self.__getattribute__(key), maxshape = maxshape)
 
     def from_hdf5(self, h5group):
         for key, dataset in h5group.items():