R: Define a NetCDF Dimension

dim.def.nc {RNetCDF} | R Documentation

## Define a NetCDF Dimension

### Description

Define a new NetCDF dimension.

### Usage

    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

    ##  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)

[Package RNetCDF version 1.9-1 Index]