Skip to contents

open netcdf or zarr

Usage

open_nz(nz, backend = NULL, warn = TRUE)

# S3 method for Store
open_nz(nz, backend = NULL, warn = TRUE)

# S3 method for character
open_nz(nz, backend = NULL, warn = TRUE)

# S3 method for `NULL`
open_nz(nz, backend = NULL, warn = TRUE)

Arguments

nz

a pizzarr store, a path to a zarr store, or a path to a netcdf resource

backend

character "pizzarr" or "RNetCDF" if NULL (the default) will try pizzar first and fall back to RNetCDF

warn

logical warn or no warn?

Value

ZarrGroup or NetCDF object

Examples

if(requireNamespace("pizzarr", quietly = TRUE)) {

z <- z_demo()

bcsd <- open_nz(z)

class(bcsd)

zarr <- pizzarr::DirectoryStore$new(z)

class(zarr)

bcsd <- open_nz(zarr)

class(bcsd)

}
#> [1] "ZarrGroup" "R6"       

# equivalent data in NetCDF
if(requireNamespace("RNetCDF", quietly = TRUE)) {
  nc <- z_demo(format = "netcdf")

  bcsd <- open_nz(nc)

  class(bcsd)
}
#> Warning: Failed to open as zarr
#> Opened as NetCDF
#> [1] "NetCDF"