Skip to contents

Inquire Zarr Attribute

Usage

inq_att(z, var, att)

# S3 method for character
inq_att(z, var, att)

# S3 method for NetCDF
inq_att(z, var, att)

# S3 method for `NULL`
inq_att(z, var, att)

# S3 method for ZarrGroup
inq_att(z, var, att)

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. -1 or "global" for global attributes

att

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

Value

list similar to that returned by att.inq.nc

Examples


z <- open_nz(z_demo())

inq_att(z, -1, 0)
#> $id
#> [1] 0
#> 
#> $name
#> [1] "CDI"
#> 
#> $type
#> [1] "character"
#> 
#> $length
#> [1] 1
#> 

inq_att(z, "global", "Conventions")
#> $id
#> [1] 2
#> 
#> $name
#> [1] "Conventions"
#> 
#> $type
#> [1] "character"
#> 
#> $length
#> [1] 1
#> 

inq_att(z, 0, 3)
#> $id
#> [1] 3
#> 
#> $name
#> [1] "long_name"
#> 
#> $type
#> [1] "character"
#> 
#> $length
#> [1] 1
#> 

inq_att(z, "latitude", "long_name")
#> $id
#> [1] 3
#> 
#> $name
#> [1] "long_name"
#> 
#> $type
#> [1] "character"
#> 
#> $length
#> [1] 1
#> 

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

  (inq_att(nc, 0, 0))
}
#> $id
#> [1] 0
#> 
#> $name
#> [1] "standard_name"
#> 
#> $type
#> [1] "NC_CHAR"
#> 
#> $length
#> [1] 8
#>