Raw bytes by Zarr key ("zarr.json", "temp/zarr.json",
"temp/c/0/0/0"). Decoding is a Zarr reader's job (pizzarr, GDAL).
Usage
ic_get(session, key, offset = NULL, length = NULL)
ic_get_many(session, keys)
ic_set(session, key, value)
ic_exists(session, key)
ic_delete(session, key)
ic_list(session, prefix = "", recursive = TRUE)Value
ic_get() a raw vector or NULL if absent (an absent chunk
means fill value); ic_get_many() a list of those.
Examples
ex <- ic_example_repo()
s <- ic_session_readonly(ic_repo_open(ex$path, authorize = ex$authorize), branch = "main")
ic_list(s, "small")
#> [1] "small/c/0/0" "small/c/0/1" "small/c/1/0" "small/c/1/1"
#> [5] "small/zarr.json"
ic_exists(s, "small/zarr.json")
#> [1] TRUE
jsonlite::fromJSON(rawToChar(ic_get(s, "small/zarr.json")))$shape
#> [1] 4 6
# a chunk's bytes: the virtual ones come from the source file
x <- ic_get(s, "from_bin/c/1/0")
head(readBin(x, "double", 3072, size = 4, endian = "little"))
#> [1] 192.00 192.25 192.50 192.75 193.00 193.25
# a byte range of a chunk
readBin(ic_get(s, "from_nc/c/0/0", offset = 0, length = 8), "double", 2, size = 4)
#> [1] 0.00 0.25
lengths(ic_get_many(s, c("small/c/0/0", "small/c/1/1", "small/c/9/9")))
#> [1] 48 48 0
# writes go to a writable session
w <- ic_session_writable(ic_repo_open(ex$path), "main")
ic_set(w, "small/c/0/0", writeBin(as.double(101:106), raw(), size = 8, endian = "little"))
ic_delete(w, "small/c/1/1")
ic_status(w)
#> <icechunk_diff>
#> updated chunks: 2