I came across with a strange behaviour of read_zarr_array.
> mat <- array(1:25, dim = c(5,5))
> mat
[,1] [,2] [,3] [,4] [,5]
[1,] 1 6 11 16 21
[2,] 2 7 12 17 22
[3,] 3 8 13 18 23
[4,] 4 9 14 19 24
[5,] 5 10 15 20 25
> mat_zarr <- as(mat, "ZarrArray")
> set.seed(1)
> index <- list(sample(1:5,5), NULL)
> index
[[1]]
[1] 1 4 3 5 2
[[2]]
NULL
> Rarr::read_zarr_array(mat_zarr@seed@zarr_path, index)
[,1] [,2] [,3] [,4] [,5]
[1,] 1 6 11 16 21
[2,] 2 7 12 17 22
[3,] 3 8 13 18 23
[4,] 4 9 14 19 24
[5,] 5 10 15 20 25
This does not happen if indices are a subset, but not a permutation of the full index set.
> mat <- array(1:25, dim = c(5,5))
> mat
[,1] [,2] [,3] [,4] [,5]
[1,] 1 6 11 16 21
[2,] 2 7 12 17 22
[3,] 3 8 13 18 23
[4,] 4 9 14 19 24
[5,] 5 10 15 20 25
> mat_zarr <- as(mat, "ZarrArray")
> set.seed(1)
> index <- list(sample(1:5,3), NULL)
> index
[[1]]
[1] 1 4 3
[[2]]
NULL
> Rarr::read_zarr_array(mat_zarr@seed@zarr_path, index)
[,1] [,2] [,3] [,4] [,5]
[1,] 1 6 11 16 21
[2,] 4 9 14 19 24
[3,] 3 8 13 18 23
I came across with a strange behaviour of
read_zarr_array.This does not happen if indices are a subset, but not a permutation of the full index set.