R: Inquire About a NetCDF Variable

var.inq.nc {RNetCDF} | R 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. 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. The valid external NetCDF data types are `NC_BYTE`, `NC_CHAR`, `NC_SHORT`, `NC_INT`, `NC_FLOAT`, and `NC_DOUBLE`.

### Value

A list containing the following components:

`id` | Variable ID.
`name` | Variable name.
`type` | External NetCDF data type.
`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.

### Author(s)

Pavel Michna

### References

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

### Examples

    ##  Create a new NetCDF dataset and define two dimensions
    nc <- create.nc("var.inq.nc")

    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)

[Package RNetCDF version 1.9-1 Index]