hsds
hsds copied to clipboard
Error on array broadcasting
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.
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.
My example works with h5py. That's why I created this issue.