Skip to contents

Inquire Zarr Variable

Usage

inq_var(z, var)

# S3 method for character
inq_var(z, var)

# S3 method for NetCDF
inq_var(z, var)

# S3 method for ZarrGroup
inq_var(z, var)

# S3 method for `NULL`
inq_var(z, var)

Arguments

z

an open ZarrGroup as returned by open_nz

var

integer or character zero-based index id of variable of interest or name of variable of interest.

Value

list similar to that returned by var.inq.nc

Examples


z <- open_nz(z_demo())

inq_var(z, 0)
#> $id
#> [1] 0
#> 
#> $name
#> [1] "latitude"
#> 
#> $type
#> [1] "<f4"
#> 
#> $ndims
#> [1] 1
#> 
#> $dimids
#> [1] 0
#> 
#> $natts
#> [1] 6
#> 

inq_var(z, "pr")
#> $id
#> [1] 2
#> 
#> $name
#> [1] "pr"
#> 
#> $type
#> [1] "<f4"
#> 
#> $ndims
#> [1] 3
#> 
#> $dimids
#> [1] 2 0 1
#> 
#> $natts
#> [1] 4
#> 

# equivalent data in NetCDF
if(requireNamespace("RNetCDF", quietly = TRUE)) {
  nc <- z_demo(format = "netcdf")
  nc <- rnz::open_nz(nc, backend = "RNetCDF")
  inq_var(nc, 0)
}
#> $id
#> [1] 0
#> 
#> $name
#> [1] "latitude"
#> 
#> $type
#> [1] "NC_FLOAT"
#> 
#> $ndims
#> [1] 1
#> 
#> $dimids
#> [1] 0
#> 
#> $natts
#> [1] 6
#>