Description Usage Arguments Details Examples
Copy attributes from one variable in one file to another file.
1 2 3 4 5 6 7 8 9 | nc.copy.atts(
f.src,
v.src,
f.dest,
v.dest,
exception.list = NULL,
rename.mapping = NULL,
definemode = FALSE
)
|
f.src |
The source file (an object of class |
v.src |
The source variable: a string naming a variable in a file or an object of class |
f.dest |
The destination file (an object of class |
v.dest |
The destination variable: a string naming a variable in a file or an object of class |
exception.list |
A vector containing names of variables not to be copied. |
rename.mapping |
A vector containing named values mapping source to destination names. |
definemode |
Whether the file is already in define mode. |
This function copies attributes from a variable in one file to a variable in another file. If the source or destination variable is 0, then attributes are copied from/to the NetCDF file's global attributes.
If desired, some attributes can be left out using exception.list
, a vector of names of attributes to be excluded.
Attributes can also be renamed at the destination using rename.mapping
, a named vector of strings in which the name of the attribute to be renamed is the name, and the attribute's new name is the value.
1 2 3 4 5 6 7 8 9 10 11 12 | ## Copy attributes from one variable to another; but don't copy units or
## standard_name, and copy long_name as old_long_name.
## Not run:
f1 <- nc_open("pr.nc")
f2 <- nc_open("pr2.nc")
nc.copy.atts(f1, "pr", f2, "pr", c("units", "standard_name"),
c(long_name="old_long_name"))
dim.axes <- nc.get.dim.axes.from.names(f, "pr")
nc_close(f1)
nc_close(f2)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.