indexing zarr with both coordinate arrays and slice

57 views Asked by At

Currently zarr support advanced indexing by coordinate arrays:

z = zarr.array(np.arange(3*4).reshape(3,4))
z.vindex[[0, 2], [1, 3]]
array([ 1, 11])

But the coordinate arrays have to be provided for each dimension. If one dimension is indexing with slice, e.g.:

z = zarr.array(np.arange(3*4*5).reshape(3, 4, 5))
z.vindex[[0, 2], [1, 3]] #None in the last dim

It will raise error.

I want to get an array of shape (2,5). Any kind of workaround?

I have tried

z.vindex[[0,2],[1,3],slice(None)]

But it doesn't work.

0

There are 0 answers