var.def.nc | R Documentation |
Define a new NetCDF variable.
var.def.nc(ncfile, varname, vartype, dimensions,
chunking=NA, chunksizes=NULL, deflate=NA, shuffle=FALSE,
big_endian=NA, fletcher32=FALSE,
filter_id=integer(0), filter_params=list())
Arguments marked "netcdf4"
are optional for datasets in that format and ignored for other formats.
ncfile |
Object of class |
varname |
Variable name. Must begin with an alphabetic character, followed by zero or more alphanumeric characters including the underscore ( |
vartype |
External NetCDF data type as one of the following labels: |
dimensions |
Vector of |
chunking |
( |
chunksizes |
( |
deflate |
( |
shuffle |
( |
big_endian |
( |
fletcher32 |
( |
filter_id |
( |
filter_params |
( |
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 fastest varying dimension has to be first in 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.
NetCDF variable identifier, returned invisibly.
Pavel Michna, Milton Woods
https://www.unidata.ucar.edu/software/netcdf/
## Create a new NetCDF dataset and define two dimensions
file1 <- tempfile("var.def_", 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))
close.nc(nc)
unlink(file1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.