var.inq.nc {RNetCDF} | R Documentation |
Inquire about a NetCDF variable.
var.inq.nc(ncfile, variable)
ncfile |
Object of class " |
variable |
Either the ID or the name of the variable to be inquired. |
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
.
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 ( |
natts |
Number of variable attributes assigned to this variable. |
Pavel Michna
http://www.unidata.ucar.edu/software/netcdf/
## 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)