ctd-class
dataset.
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, flags = NULL, pressureType = "sea", missingValue = NA, quality = NULL, filename = "", type = "", model = "", serialNumber = "", ship = "", scientist = "", institute = "", address = "", cruise = "", station = "", date = NULL, startTime = NULL, recovery = NULL, longitude = NA, latitude = NA, deploymentType = "unknown", pressureAtmospheric = 0, waterDepth = NA, sampleInterval = NA, src = "", debug = getOption("oceDebug"))
salinity
. (1) It can be a
vector indicating the practical salinity through the water column. In that case,
as.ctd
employs the other arguments listed below. (2) It can be
something (a data frame, a list or an oce
object) from which practical
salinity, temperature, etc., can be inferred. In that case, the relevant information
is extracted and the other arguments to as.ctd
are ignored, except for
pressureAtmospheric
. Note that if this first argument is an
object of rsk-class
, the present function merely passes
it and pressureAtmospheric
to rsk2ctd
, which
case conductivity
becomes a mandatory argument, because it will
be needed for computing actual salinity, using swSCTp
.swRho
.salinity
and
temperature
pair, or just a single pressure, which is repeated to match
the length of salinity
.1:length(salinity)
.list(temperature=list(unit=expression(degree*C), scale="ITS-90"),
salinity=list(unit=expression(), scale="",
pressure=list(unit=expression(dbar), scale="")
is used. This is quite
typical of archived datasets, but for some instrumental files it will make
sense to use salinity=list(unit=expression(uS/cm), scale="")
or
salinity=list(unit=expression(S/m), scale="")
.list
containing data-quality
flags. The elements of this list must have names that match the data
provided to the object."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.
This was deprecated in March 2016; see oce-deprecated.metadata
slot, and is not used in any processing. Since
it serves no purpose, this argument is deprecated as of April 2016,
and will be marked 'defunct' in an upcoming CRAN release;
see oce-deprecated.POSIXt
time, but it may also be a character string
that can be converted to a time with as.POSIXct
,
using UTC
as the timezone.startTime
. This is not presently used by oce
,
and is stored in the result's metadata
slot just in case the user
requires it.metadata
slot of the returned value; if it
is a vector of numbers, they are stored in data
and a mean value is
stored in metadata
.longitude
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, perhaps also including an upcast; "moored"
if
the device is installed on a fixed mooring, "thermosalinograph"
(or
"tsg"
) if the device is mounted on a moving vessel, to record
near-surface properties, or "towyo"
if the device is repeatedly
lowered and raised.salinity
, if
that is to be computed from conductivity
, etc., using
swSCTp
(see salinity
above).plot,section-method
.oce
functions. Generally, setting debug=0
turns off the printing, while higher values suggest that more information
be printed.ctd-class
.
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
data: [[,ctd-method
,
[[<-,ctd-method
,
cnvName2oceName
, ctd-class
,
ctdAddColumn
, ctdDecimate
,
ctdFindProfiles
, ctdRaw
,
ctdTrim
, ctdUpdateHeader
,
ctd
, gps-class
,
handleFlags,ctd-method
,
plot,ctd-method
, plotProfile
,
plotScan
, plotTS
,
read.ctd.itp
, read.ctd.odf
,
read.ctd.sbe
,
read.ctd.woce.other
,
read.ctd.woce
, read.ctd
,
subset,ctd-method
,
summary,ctd-method
,
woceNames2oceNames
, write.ctd
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