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

Error on array broadcasting #131

Open
ajelenak opened this issue Mar 28, 2022 · 2 comments
Open

Error on array broadcasting #131

ajelenak opened this issue Mar 28, 2022 · 2 comments
Assignees

Comments

@ajelenak
Copy link
Contributor

This code:

import h5pyd

with h5pyd.File('hdf5://home/userme/foo.h5', mode='w') as f:
    x = f.create_dataset('x', shape=(2, 3), dtype='i4')
    x[...] = [[1, 2, 3]]

Produces error: OSError: Expected: 24 bytes, but got: 12. The correct outcome should be for x to store an [[1, 2, 3][1, 2, 3]] array.

@jreadey
Copy link
Member

jreadey commented Apr 11, 2022

A related error is:

import h5pyd

with h5pyd.File('hdf5://home/userme/foo.h5', mode='w') as f:
    x = f.create_dataset('x', shape=(2, 3), dtype='i4')
    x[1,2:5] = [1, 2, 3]

Produces error: OSError: Expected: 4 bytes, but got: 12

The same code with h5py gives: TypeError: Can't broadcast (3,) -> (1,)
The HSDS error seems to be an effect of the array selection being limited to one element but h5pyd pushing 3 4-byte ints in the request. It would seem better if HSDS would return a 400 error once it sees the query parameters are not valid.

@ajelenak
Copy link
Contributor Author

My example works with h5py. That's why I created this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants