This is used by e.g. ctd2ncdf()
to determine how to describe the variable in a
particular flavour of NetCDF file, as specified by read.varTable()
.
getVarInfo(name = NULL, varTable = NULL, oce = NULL, debug = 0)
character value naming the variable. If name
is
not the name of a chemical species, then trailing digits are removed,
as a way to handle instruments that, for example, have multiple
temperature sensors. Chemical species are recognized by
the presence of any one of the following strings:
"CO"
, "NO"
, "PO" and "O2"
.
either a variable table as read by read.varTable()
,
or a character string that is to be passed to that function to
create a variable table.
(optional) an oce object. If provided, then an attempt
is made to infer the unit from it. Otherwise, the returned unit
entry is an empty string.
integer, 0 (the default) for quiet action apart from messages and warnings, or any larger value to see more output that describes the processing steps.
getVarInfo()
returns a list containing name
(the
name as used in Argo NetCDF files), long_name
(again, as used in
Argo NetCDF files, although the usefulness of this is debatable),
standard_name
(not used by ctd2ncdf()
as of now), FillValue
(used by ctd2ncdf()
for missing values) and, if oce
is provided
and it can be determined, unit
(a character string specifying
the unit).
library(ocencdf)
# Example
data(ctd)
vt <- read.varTable("argo")
getVarInfo("temperature", vt, ctd)
#> $name
#> [1] "TEMP"
#>
#> $long_name
#> [1] "Sea temperature in-situ ITS-90 scale"
#>
#> $FillValue
#> [1] 99999
#>
#> $unit
#> [1] "degree_Celcius"
#>
#> $standard_name
#> [1] "sea_water_temperature"
#>