diff --git a/lindi/LindiH5pyFile/LindiH5pyDataset.py b/lindi/LindiH5pyFile/LindiH5pyDataset.py index 83c540a..4c915b7 100644 --- a/lindi/LindiH5pyFile/LindiH5pyDataset.py +++ b/lindi/LindiH5pyFile/LindiH5pyDataset.py @@ -152,6 +152,15 @@ def fletcher32(self): else: raise Exception(f'Unexpected dataset object type: {type(self._dataset_object)}') + @property + def chunks(self): + if isinstance(self._dataset_object, h5py.Dataset): + return self._dataset_object.chunks + elif isinstance(self._dataset_object, zarr.Array): + return self._dataset_object.chunks + else: + raise Exception(f'Unexpected dataset object type: {type(self._dataset_object)}') + def __repr__(self): # type: ignore return f"<{self.__class__.__name__}: {self.name}>" diff --git a/lindi/LindiH5pyFile/LindiH5pyFile.py b/lindi/LindiH5pyFile/LindiH5pyFile.py index da72de0..179eb1d 100644 --- a/lindi/LindiH5pyFile/LindiH5pyFile.py +++ b/lindi/LindiH5pyFile/LindiH5pyFile.py @@ -384,7 +384,7 @@ def _recursive_copy(src_item: Union[h5py.Group, h5py.Dataset], dest: h5py.File, dst_rfs['refs'][dst_ref_key] = _deep_copy(src_rfs['refs'][src_ref_key]) return - dst_item = dest.create_dataset(name, data=src_item[()]) + dst_item = dest.create_dataset(name, data=src_item[()], chunks=src_item.chunks) for k, v in src_item.attrs.items(): dst_item.attrs[k] = v else: