var.inq.nc: Inquire About a NetCDF Variable

View source: R/RNetCDF.R

var.inq.ncR Documentation

Inquire About a NetCDF Variable

Description

Inquire about a NetCDF variable.

Usage

var.inq.nc(ncfile, variable)

Arguments

ncfile

Object of class NetCDF which points to the NetCDF dataset (as returned from open.nc).

variable

Either the ID or the name of the variable to be inquired.

Details

This function returns information about a NetCDF variable, including its name, ID, type, number of dimensions, a vector of the dimension IDs, and the number of attributes.

Value

A list of named components, some of which are only included for datasets in "netcdf4" format (as reported by file.inq.nc).

id

Variable ID.

name

Variable name.

type

External NetCDF data type as one of the following labels: NC_BYTE, NC_UBYTE, NC_CHAR, NC_SHORT, NC_USHORT, NC_INT, NC_UINT, NC_INT64, NC_UINT64, NC_FLOAT, NC_DOUBLE, NC_STRING, or a user-defined type name.

ndims

Number of dimensions the variable was defined as using.

dimids

Vector of dimension IDs corresponding to the variable dimensions (NA for scalar variables). Order is leftmost varying fastest.

natts

Number of variable attributes assigned to this variable.

chunksizes

("netcdf4") Chunk size expressed as the number of elements along each dimension, in the same order as dimids. NULL implies contiguous storage.

cache_bytes

("netcdf4") Size of chunk cache in bytes (NULL if unsupported).

cache_slots

("netcdf4") The number of slots in the chunk cache (NULL if unsupported).

cache_preemption

("netcdf4") A value between 0 and 1 (inclusive) that biases the cache scheme towards eviction of chunks that have been fully read (NULL if unsupported).

deflate

("netcdf4") Integer indicating level of compression, from 0 (minimum) to 9 (maximum), or NA if compression is not enabled.

shuffle

("netcdf4") TRUE if byte shuffling is enabled for the variable, FALSE otherwise.

big_endian

("netcdf4") Byte order of the variable. TRUE for big-endian, FALSE for little-endian, NA for not yet determined, or NULL if unsupported.

fletcher32

("netcdf4") TRUE if the fletcher32 checksum is enabled for this variable, FALSE otherwise.

szip_options

("netcdf4") Integer containing a bitmask of szip options. NA if szip is not used, or NULL if unsupported.

szip_bits

("netcdf4") Number of bits per pixel for szip. NA if szip is not used, or NULL if unsupported.

filter_id

("netcdf4") Vector of filter IDs associated with the variable, or NULL if the NetCDF library does not support the multi-filter interface.

filter_params

("netcdf4") List with one element per filter_id, or NULL if the NetCDF library does not support the multi-filter interface. Each list member is a vector of numeric parameters for the corresponding filter. Please see the NetCDF documentation for information about the available filters and their parameters.

Author(s)

Pavel Michna, Milton Woods

References

https://www.unidata.ucar.edu/software/netcdf/

Examples

##  Create a new NetCDF dataset and define two dimensions
file1 <- tempfile("var.inq_", fileext=".nc")
nc <- create.nc(file1)

dim.def.nc(nc, "station", 5)
dim.def.nc(nc, "time", unlim=TRUE)

##  Create two variables, one as coordinate variable
var.def.nc(nc, "time", "NC_INT", "time")
var.def.nc(nc, "temperature", "NC_DOUBLE", c(0,1))

##  Inquire about these variables
var.inq.nc(nc, 0)
var.inq.nc(nc, "temperature")

close.nc(nc)
unlink(file1)

RNetCDF documentation built on May 29, 2024, 2:41 a.m.