File: var.def.nc.Rd

package info (click to toggle)
r-cran-rnetcdf 1.9-1-2
 1234567891011121314151617181920212223242526272829303132333435363738394041424344 \name{var.def.nc} \alias{var.def.nc} \title{Define a NetCDF Variable} \description{Define a new NetCDF variable.} \usage{var.def.nc(ncfile, varname, vartype, dimensions)} \arguments{ \item{ncfile}{Object of class "\code{NetCDF}" which points to the NetCDF dataset (as returned from \code{\link[RNetCDF]{open.nc}}).} \item{varname}{Variable name. Must begin with an alphabetic character, followed by zero or more alphanumeric characters including the underscore ("\code{_}"). Case is significant.} \item{vartype}{One of the set of predefined NetCDF external data types. The valid NetCDF external data types are \code{NC_BYTE}, \code{NC_CHAR}, \code{NC_SHORT}, \code{NC_INT}, \code{NC_FLOAT}, and \code{NC_DOUBLE}.} \item{dimensions}{Vector of \code{ndims} dimension IDs or their names corresponding to the variable dimensions or \code{NA} if a scalar variable should be created. If the ID (or name) of the unlimited dimension is included, it must be last.} } \details{This function creates a new NetCDF variable. A NetCDF variable has a name, a type, and a shape, which are specified when it is defined. A variable may also have values, which are established later in data mode. Ordinarily, the name, type, and shape are fixed when the variable is first defined. The name may be changed, but the type and shape of a variable cannot be changed. However, a variable defined in terms of the unlimited dimension can grow without bound in that dimension. The fastetst varying dimension has to be first in \code{dimensions}, the slowest varying dimension last (this is the same way as an array is defined in R; i.e., opposite to the CDL conventions). A NetCDF variable in an open NetCDF dataset is referred to by a small integer called a variable ID. Variable IDs are 0, 1, 2,..., in the order in which the variables were defined within a NetCDF dataset. Attributes may be associated with a variable to specify such properties as units.} \references{\url{http://www.unidata.ucar.edu/software/netcdf/}} \author{Pavel Michna} \examples{ ## Create a new NetCDF dataset and define two dimensions nc <- create.nc("var.def.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)) close.nc(nc) } \keyword{file}