Skip to contents

Returns an R6 store that pizzarr's pure-R code path accepts (it inherits pizzarr::Store), so pizzarr without its Rust backend, as released on CRAN, can read and write an Icechunk repository. Every key read or written goes through the session: reads see the session's snapshot plus its uncommitted changes, and writes stay in the session until ic_commit().

Usage

ic_pizzarr_store(session)

Arguments

session

an icechunk_session (read-only, or writable to write).

Value

an R6 object inheriting pizzarr::Store.

Details

The store reports no store identifier, so pizzarr always uses its R code path with it (for pizzarr's zarrs backend, use pizzarr's own IcechunkStore, which takes the session as bytes).

Limits come from pizzarr's R decoder, not from Icechunk: Zarr v3 arrays whose codecs it does not implement cannot be read this way (sharding_indexed; and, in pizzarr 0.2.x as released, the netCDF-4 numcodecs.shuffle and numcodecs.zlib, which the mdsumner/pizzarr fork adds). ic_get() still returns their raw chunk bytes.

Examples

if (requireNamespace("pizzarr", quietly = TRUE) && requireNamespace("R6", quietly = TRUE)) {
  ex <- ic_example_repo()
  s <- ic_session_readonly(ic_repo_open(ex$path, authorize = ex$authorize), branch = "main")
  st <- ic_pizzarr_store(s)
  print(st)
  z <- pizzarr::zarr_open(st, mode = "r", path = "small")
  print(z$get_item("...")$data)
  # the virtual array, decoded from the source file's bytes
  v <- pizzarr::zarr_open(st, mode = "r", path = "from_nc")$get_item("...")$data
  all.equal(as.vector(t(v)), ex$values)
}
#> <TabularbergStore> snapshot NRYX3ZDAG6XPRBX83BRG (read-only)
#>      [,1] [,2] [,3] [,4] [,5] [,6]
#> [1,]    1    2    3    4    5    6
#> [2,]    7    8    9   10   11   12
#> [3,]   13   14   15   16   17   18
#> [4,]   19   20   21   22   23   24
#> [1] TRUE