Skip to content

Commit

Permalink
Do not allow writing of complex datasets
Browse files Browse the repository at this point in the history
  • Loading branch information
magland committed Sep 11, 2024
1 parent 3b397f3 commit dcb3daf
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lindi/conversion/create_zarr_dataset_from_h5_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ def create_zarr_dataset_from_h5_data(
if zarr_compressor != 'default' and zarr_compressor is not None:
raise Exception('zarr_compressor is not supported for scalar datasets')

if np.issubdtype(h5_dtype, np.complexfloating):
raise Exception(f'Complex scalar datasets are not supported: dataset {label} with dtype {h5_dtype}')

if _is_numeric_dtype(h5_dtype) or h5_dtype in [bool, np.bool_]:
# Handle the simple numeric types
ds = zarr_parent_group.create_dataset(
Expand Down Expand Up @@ -110,6 +113,9 @@ def create_zarr_dataset_from_h5_data(
# If we have a list, then we need to convert it to an array
h5_data = np.array(h5_data)

if np.issubdtype(h5_dtype, np.complexfloating):
raise Exception(f'Complex datasets are not supported: dataset {label} with dtype {h5_dtype}')

if _is_numeric_dtype(h5_dtype) or h5_dtype in [bool, np.bool_]: # integer, unsigned integer, float, bool
# This is the normal case of a chunked dataset with a numeric (or boolean) dtype
if h5_chunks is None:
Expand Down

0 comments on commit dcb3daf

Please sign in to comment.