HDFGroup / h5pyd

h5py distributed - Python client library for HDF Rest API
Other
110 stars 39 forks source link

indexing inconsistency between h5pyd and h5py (and numpy) #69

Open vsisl opened 4 years ago

vsisl commented 4 years ago

There is an inconsistency in the shape of the returned array when querying slice of numpy ndarray from an HDF5 file using h5py and h5pyd.

Imagine 3D numpy ndarray my_ary stored in my_file.h5

my_ary = np.zeros((5, 5, 5)) select = (slice(0,1), slice(0,2), slice(0,1)) my_ary[select].shape

(1, 2 ,1)

my_file = h5py.File('my_file.h5', 'w') my_file.create_dataset(name='my_ary', data=my_ary) my_file.close()

my_file = h5py.File('my_file.h5', 'r') my_file['my_ary'][select].shape

(1, 2, 1)

my_file.close() my_file = h5pyd.File('my_file.hdfgroup.org', 'r', endpoint='xxx:yyy') my_file['my_ary'][select].shape

(2,)

Is this intended behavior?