dim.def.nc: Define a NetCDF Dimension

Description Usage Arguments Details Author(s) References Examples

View source: R/RNetCDF.R

Description

Define a new NetCDF dimension.

Usage

1
dim.def.nc(ncfile, dimname, dimlength=1, unlim=FALSE)

Arguments

ncfile

Object of class "NetCDF" which points to the NetCDF dataset (as returned from open.nc).

dimname

Dimension name. Must begin with an alphabetic character, followed by zero or more alphanumeric characters including the underscore ("_"). Case is significant.

dimlength

Length of dimension, that is, number of values for this dimension as an index to variables that use it. This must be a positive integer. If an unlimited dimension is created (unlim=TRUE), the value of length is not used.

unlim

Set to TRUE if an unlimited dimension should be created, otherwise to FALSE.

Details

This function creates a new NetCDF dimension. There is a suggested limit (100) to the number of dimensions. Ordinarily, the name and length of a dimension are fixed when the dimension is first defined. The name may be changed later, but the length of a dimension (other than the unlimited dimension) cannot be changed without copying all the data to a new NetCDF dataset with a redefined dimension length. A NetCDF dimension in an open NetCDF dataset is referred to by a small integer called a dimension ID. In the C interface, dimension IDs are 0, 1, 2, ..., in the order in which the dimensions were defined. At most one unlimited length dimension may be defined for each NetCDF dataset.

Author(s)

Pavel Michna

References

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

Examples

1
2
3
4
5
6
7
##  Create a new NetCDF dataset and define two dimensions
nc <- create.nc("dim.def.nc")

dim.def.nc(nc, "station", 5)
dim.def.nc(nc, "time", unlim=TRUE)

close.nc(nc)

RNetCDF documentation built on May 2, 2019, 6:12 p.m.