Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not allow writing of complex datasets #95

Merged
merged 3 commits into from
Sep 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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