You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Suppose I have a array block id (e.g. "0.0.0") and I want its equivalent slice on the full array. Does Zarr currently have a function to do this? I'm looking for something like this:
In [1]: block_id='0.0.0'In [2]: block_size= (10, 20, 30)
In [3]: defslice_axis(key, chunk_size):
...: returnslice(key*chunk_size, (key+1) *chunk_size)
...:
...:
...: defget_indexers(key, chunks):
...: ikeys=key.split(".")
...: returntuple(slice_axis(int(i), c) fori, cinzip(ikeys, chunks))
...:
In [4]: get_indexers(block_id, block_size)
Out[4]: (slice(0, 10, None), slice(0, 20, None), slice(0, 30, None))
In [5]: importnumpyasnpIn [6]: data=np.random.random((100, 100, 100))
In [7]: slices=get_indexers(block_id, block_size)
In [8]: data[slices]
I recognize this is actually the inverse operation that Zarr takes when slicing a zarr array (usually we go from slice -> block_id).
The text was updated successfully, but these errors were encountered:
Suppose I have a array block id (e.g. "0.0.0") and I want its equivalent slice on the full array. Does Zarr currently have a function to do this? I'm looking for something like this:
I recognize this is actually the inverse operation that Zarr takes when slicing a zarr array (usually we go from slice -> block_id).
The text was updated successfully, but these errors were encountered: