RNetCDF (version 2.4-2)

var.inq.nc: 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.

Value

A list of named components, some of which are only included for datasets in "netcdf4" format (as indicated 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.

The arguments below apply only to datasets in "netcdf4" format:

chunksizes

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

cache_bytes

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

cache_slots

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

cache_preemption

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

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

shuffle

TRUE if byte shuffling is enabled for the variable, FALSE otherwise.

big_endian

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

fletcher32

TRUE if the fletcher32 checksum is enabled for this variable, FALSE otherwise.

szip_options

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

szip_bits

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

filter_id

Identifier of filter associated with the variable. NA if no filter is defined, or NULL if unsupported.

filter_params

Vector of integer parameters for the filter associated with the variable. NA if no filter is defined, or NULL if unsupported.

Details

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

References

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

Examples

Run this code
# NOT RUN {
##  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)
# }

Run the code above in your browser using DataLab