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 cc3901b..3b8a8b1 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: diff --git a/lindi/conversion/create_zarr_dataset_from_h5_data.py b/lindi/conversion/create_zarr_dataset_from_h5_data.py index 0e36127..007df86 100644 --- a/lindi/conversion/create_zarr_dataset_from_h5_data.py +++ b/lindi/conversion/create_zarr_dataset_from_h5_data.py @@ -80,7 +80,7 @@ def create_zarr_dataset_from_h5_data( return ds else: raise Exception(f'Unsupported scalar value type: {type(scalar_value)}') - elif h5_dtype.kind == 'S': + elif h5_dtype.kind == 'S' or h5_dtype.kind == 'U': # byte string if h5_data is None: raise Exception(f'Data must be provided for scalar dataset {label}')