bodcNames2oceNames | R Documentation |
Translate names in the NERC/BODC vocabulary to oce names, primarily so that
read.netcdf()
can produce more easily interpreted results. Please note
that bodcNames2oceNames()
handles only a tiny subset of the huge number of
names in the NERC/BODC vocabulary (see Reference 1). To see the names that
the function handles currently, type bodcNames2oceNames
in an R session.
bodcNames2oceNames(bodcNames, unduplicate = TRUE)
bodcNames |
character vector that specifies variable names that use the NERC/BODC convention. |
unduplicate |
logical value indicating whether to rename
repeated entries, so that e.g. if |
bodcNames2oceNames
returns a vector of the same length as its
first argument, with translations to oce names, as appropriate.
Note that the usual oce convention for handling duplicates is
used, with the first name that maps to temperature being set
to temperature
, the next to temperature2
, etc.
Dan Kelley
The NERC Environmental Data Server. http://vocab.nerc.ac.uk/collection/P01/current/
Other functions that convert variable names to the oce convention:
ODFNames2oceNames()
,
argoNames2oceNames()
,
metNames2oceNames()
,
woceNames2oceNames()
# Example 1: typical usage
bodcNames2oceNames(c("PSALST01", "TEMPP901", "PRESPR01"))
# Example 2: extend to add new variables
BODC2 <- function(originalNames) {
rval <- bodcNames2oceNames(originalNames, unduplicate = FALSE)
rval[rval == "bowler hat"] <- "hat"
rval[rval == "top hat"] <- "hat"
unduplicateNames(rval)
}
BODC2(c("PSALST01", "TEMPP901", "PRESPR01", "bowler hat", "top hat"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.