Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

write_zarr_array is not nested structure #2

Open
giovp opened this issue Apr 28, 2023 · 1 comment
Open

write_zarr_array is not nested structure #2

giovp opened this issue Apr 28, 2023 · 1 comment

Comments

@giovp
Copy link

giovp commented Apr 28, 2023

HI,

after writing with write_zarr_array the content of the folder is the following

❯ lls new.zarrnew.zarr
.rw-r--r--@ 2.8M giovanni.palla 28 Apr 14:08 0.0.0

although I would have expected the following?

❯ tree
.
└── 0
    └── 0
        └── 0
            └── 0

yet the roundtrip as in the examples work, so not sure maybe expected behaviour?

@grimbough
Copy link
Owner

grimbough commented Apr 30, 2023

Hi @giovp

I think you should be able to use the dimension_separator argument to specify this e.g.

library(Rarr)

new_zarr_array <- file.path(tempdir(), "integer.zarr")
x <- array(1:50, dim = c(10, 5))
write_zarr_array(
  x = x, 
  zarr_array_path = new_zarr_array,
  chunk_dim = c(2, 5),
  dimension_separator = "/"
)

list.files(new_zarr_array, recursive = TRUE, full.names = TRUE)
#> [1] "/tmp/RtmpovandC/integer.zarr/0/0" "/tmp/RtmpovandC/integer.zarr/1/0"
#> [3] "/tmp/RtmpovandC/integer.zarr/2/0" "/tmp/RtmpovandC/integer.zarr/3/0"
#> [5] "/tmp/RtmpovandC/integer.zarr/4/0"

The Zarr spec says the following:

If the value is not set, then the default MUST be assumed to be ".", leading to chunk keys of the form “0.0”.

which is why the default is "."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants