-
Notifications
You must be signed in to change notification settings - Fork 25
Closed
Labels
Description
Currently (v1.0.1) negative slices, i.e. slices with a negative step, such as [10:1:-1], are not allowed on chunked data. This breaks some downstream applications (e.g. cfdm and cf-python):
>>> import pyfive
>>> q = pyfive.File('pyfive/tests/data/chunked.hdf5')
>>> q['dataset1']
<HDF5 dataset "dataset1": shape (21, 16), type "int32">
>>> q['dataset1'][::-1]
NegativeStepError: only slices with step >= 1 are supportedThis can be fixed :)
Negative slices are already OK for contiguous data (because they uses np.memmap access in this case):
>>> import pyfive
>>> p = pyfive.File('pyfive/tests/data/dataset_multidim.hdf5')
>>> p['d']
<HDF5 dataset "d": shape (2, 3, 4, 5), type "int32">
>>> p['d'][::-1, 0, 0, 0]
array([60, 0], dtype=int32)Reactions are currently unavailable