Skip to contents

Unpacks one of two Icechunk repositories shipped with the package: ten days of NOAA OISST v2.1 daily sea surface temperature (September 1981), from zarr-icechunk-assure. The two are the same repository built twice, with the virtual references written for NOAA's https:// archive or its s3:// bucket. Metadata, coordinates and history read offline; chunk values are fetched from NOAA when read, so they need the network. Each has two tags: as-virtualized (the time array lacks its units attribute, a defect kept on purpose) and cf-repaired (the units added by a metadata-only commit).

Usage

ic_example_oisst(cell = c("https", "s3"), path = tempfile("oisst-"))

Arguments

cell

"https" or "s3": how the references were written.

path

directory to unpack into (must not exist).

Value

A list with path (the repository), authorize (a named list: the container's URL prefix and an anonymous credential, ready for ic_repo_open()), probe (the contract from probe.json: shape, codecs, prefixes and one probe pixel) and cell.

See also

ic_example_repo() for a synthetic repository; the files are in system.file("extdata", "oisst-sample", package = "tabularberg").

Examples

ox <- ic_example_oisst("https")
repo <- ic_repo_open(ox$path)
ic_tags(repo)
#>             name          snapshot_id
#> 1 as-virtualized FE61C35T4WZMAX8MACDG
#> 2    cf-repaired 7G4W5KJ1X6XG8A5BBWA0

# the repair between the two tags touched metadata only
ic_diff(repo, from = list(tag = "as-virtualized"), to = list(tag = "cf-repaired"))
#> <icechunk_diff>
#>   updated_arrays: /time

# coordinates are stored in the repository; data chunks point at NOAA
s <- ic_session_readonly(repo, tag = "cf-repaired")
ic_chunk_refs(s, "/sst")[1:2, c("key", "location", "length")]
#>             key
#> 1 sst/c/0/0/0/0
#> 2 sst/c/1/0/0/0
#>                                                                                                                               location
#> 1 https://www.ncei.noaa.gov/data/sea-surface-temperature-optimum-interpolation/v2.1/access/avhrr/198109/oisst-avhrr-v02r01.19810901.nc
#> 2 https://www.ncei.noaa.gov/data/sea-surface-temperature-optimum-interpolation/v2.1/access/avhrr/198109/oisst-avhrr-v02r01.19810902.nc
#>   length
#> 1 683590
#> 2 684863
# \donttest{
# reading a data chunk needs the container authorised (and the network)
s <- ic_session_readonly(ic_repo_open(ox$path, authorize = ox$authorize), tag = "cf-repaired")
length(ic_get(s, "sst/c/0/0/0/0"))
#> [1] 683590
# }