reset the attribute manager to default

This commit is contained in:
Vitesh Shah 2023-10-09 20:20:34 +02:00
parent 85010a8d6d
commit 8bb193cc70
1 changed files with 32 additions and 15 deletions

View File

@ -83,6 +83,20 @@ class AttributeManagerNullterm(h5py.AttributeManager):
else: else:
super().create(name=name,data=data,shape=shape,dtype=dtype) super().create(name=name,data=data,shape=shape,dtype=dtype)
class ResetAttributeManager(h5py.AttributeManager):
"""
Reset the attribute management for DREAM.3D hdf5 files.
References
----------
https://stackoverflow.com/questions/38267076
https://stackoverflow.com/questions/52750232
"""
def create(self, name, data, shape=None, dtype=None):
super().create(name=name,data=data,shape=shape,dtype=dtype)
class Result: class Result:
""" """
@ -2076,6 +2090,9 @@ class Result:
o[geom_label].attrs['SpatialDimensionality'] = np.array([3],np.uint32) o[geom_label].attrs['SpatialDimensionality'] = np.array([3],np.uint32)
o[geom_label].attrs['UnitDimensionality'] = np.array([3],np.uint32) o[geom_label].attrs['UnitDimensionality'] = np.array([3],np.uint32)
h5py._hl.attrs.AttributeManager = ResetAttributeManager # Reset the attribute manager to original
def export_DADF5(self, def export_DADF5(self,
fname, fname,
output: Union[str, List[str]] = '*', output: Union[str, List[str]] = '*',