Add a new dimension to one or more variables in a netCDF file

Description

Adds another dimension to specified variables in a netCDF file and saves the results in another netCDF file.

Usage

1
2
3
modifyNcdfAddDim(file.con.orig, file.con.copy, var.name = "Default", 
    dim.name = "new.dim", dim.values = c(), dim.length = length(dim.values), 
    dim.pos.copy = 1)

Arguments

file.con.orig

a NetCDF object pointing to the respective netCDF file FROM which to copy

file.con.copy

a NetCDF object pointing to the respective netCDF file TO which to copy

var.name

character vector: names of the variables to which a dimension should be added. Defaults to all except those with identical names as dimensions in file.con.orig (coordinate variables)

dim.name

character string: name of the dimension to add

dim.values

numeric/character vector with the values for the dimension (coordinate values)

dim.length

integer: length of the dimension to add

dim.pos.copy

integer: position in the new dimension where to copy the original data. If set to 0, no values are copied and the variable in the new file will be empty. Setting to 1 (default) results in the original values to be filled in the first value of the new dimension and the remaining values left empty (NaN).

Author(s)

Jannis v. Buttlar

See Also

modifyNcdfCopyMetadata, att.copy.nc, modifyNcdfCopyVar

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.