as.ctd(salinity, temperature=NULL, pressure=NULL, conductivity=NULL,
SA=NULL, CT=NULL, oxygen=NULL,
nitrate=NULL, nitrite=NULL, phosphate=NULL, silicate=NULL,
scan=NULL, time=NULL, other=NULL,
units=NULL, pressureType="sea",
missingValue=NA, quality=NULL,
filename="", type="", model="", serialNumber="",
ship="", scientist="", institute="", address="", cruise="", station="",
date="", startTime="", recovery="",
longitude=NA, latitude=NA,
deploymentType="unknown",
pressureAtmospheric=0, waterDepth=NA,
sampleInterval=NA, src="",
debug=getOption("oceDebug"))
salinity
. First, it can be a
vector indicating the practical salinity through the water column. In that
case, as.ctd
employs the other arguments listed below. The second
choice is that
swRho
.1:length(salinity)
.list(temperature=list(unit=expression(degree*C), scale="ITS-90"),
salinity=list(unit=expression(ratio), scale="",
pressure=list(unit=expression(dbar), scale="")
"absolute"
, for total pressure, i.e. the sum of atmospheric pressure
and sea pressure, or "sea"
.NA
.quality=2
indicates good data, quality=3
means
questionable data, and quality=4
means bad data.metadata
slot of the returned value; if it
is a vector of numbers, they arelongitude
argument."unknown"
if this is not known, "profile"
for a profile (in
which the data were acquired during a downcast, while the device was lowered
into the water column, pNA
(the default), then pressure is copied
from the pressure
argument or from the contents of the first argument
(as described above for salinity
). Otherwise, if
pressureAtmospheric
is a nu
TRUE
to turn on debugging.rsk-class
object, the
pressure it contains may need to be adjusted, because rsk
objects may
contain either absolute pressure or sea pressure. This adjustment is handled
automatically by as.ctd
, by examination of the metadata item named
pressureType
(described in the documentation for
read.rsk
). Once the sea pressure is determined, adjustments may
be made with the pressureAtmospheric
argument, although in
that case it is better considered a pressure adjustment than the atmospheric
pressure. rsk-class
objects may store sea pressure or absolute pressure
(the sum of sea pressure and atmospheric pressure), depending on how the
object was created with as.rsk
or read.rsk
.
However, ctd-class
objects store sea pressure, which is needed
for plotting, calculating density, etc. This poses no difficulities, however,
because as.ctd
automatically converts absolute pressure to sea
pressure, if the metadata in the rsk-class
object indicates that
this is appropriate. Further alteration of the pressure can be accomplished
with the pressureAtmospheric
argument, as noted above.
ctd-class
explains the structure of
CTD objects, and also outlines the other functions dealing with them.library(oce)
pressure <- 1:50
temperature <- 10 - tanh((pressure - 20) / 5) + 0.02*rnorm(50)
salinity <- 34 + 0.5*tanh((pressure - 20) / 5) + 0.01*rnorm(50)
ctd <- as.ctd(salinity, temperature, pressure)
summary(ctd)
plot(ctd)
Run the code above in your browser using DataLab