Assemble data into a ctd object.
as.ctd( salinity, temperature = NULL, pressure = NULL, conductivity = NULL, scan = NULL, time = NULL, other = NULL, units = NULL, flags = NULL, missingValue = NULL, type = "", serialNumber = "", ship = NULL, cruise = NULL, station = NULL, startTime = NULL, longitude = NULL, latitude = NULL, deploymentType = "unknown", pressureAtmospheric = 0, sampleInterval = NA, profile = NULL, debug = getOption("oceDebug") )
There are several distinct choices for
in-situ temperature in \(^\circ deg\)C on
the ITS-90 scale; see “Temperature units” in the documentation for
Vector of pressure values, one for each
electrical conductivity ratio through the water column (optional). To convert from raw conductivity in milliSeimens per centimeter divide by 42.914 to get conductivity ratio (see Culkin and Smith, 1980).
optional scan number. If not provided, this will be set to
optional vector of times of observation
optional list of other data columns that are not in the standard list
an optional list containing units. If not supplied,
defaults are set for
if supplied, this is a list containing data-quality flags. The elements of this list must have names that match the data provided to the object.
optional missing value, indicating data that should be
optional type of CTD, e.g. "SBE"
optional serial number of instrument
optional string containing the ship from which the observations were made.
optional string containing a cruise identifier.
optional string containing a station identifier.
optional indication of the start time for the profile,
which is used in some several plotting functions. This is best given as a
POSIXt time, but it may also be a character string
that can be converted to a time with
optional numerical value containing longitude in decimal
degrees, positive in the eastern hemisphere. If this is a single number,
then it is stored in the
optional numerical value containing the latitude in decimal
degrees, positive in the northern hemisphere. See the note on length, for
character string indicating the type of deployment. Use
A numerical value (a constant or a vector),
that is subtracted from pressure before storing it in the return value.
(This altered pressure is also used in calculating
optional numerical value indicating the time between samples in the profile.
optional positive integer specifying the number of the profile
to extract from an object that has data in matrices, such as for some
an integer specifying whether debugging information is
to be printed during the processing. This is a general parameter that
is used by many
A ctd object.
salinity argument is an object of rsk,
as.ctd passes it,
rsk2ctd(), which builds the ctd object that is
as.ctd. The other arguments to
are ignored in this instance, because
rsk objects already
contain their information. If required, any data or metadata
element can be added to the value returned by
The returned rsk object contains pressure in a form that
may need to be adjusted, because
rsk objects may contain
either absolute pressure or sea pressure. This adjustment is handled
as.ctd, by examination of the metadata item
pressureType (described in the documentation for
read.rsk()). Once the sea pressure is determined,
adjustments may be made with the
although in that case it is better considered a pressure adjustment
than the atmospheric pressure.
rsk objects may store sea pressure or absolute pressure (the
sum of sea pressure and atmospheric pressure), depending on how the object was
ctd objects store sea pressure, which is needed for
plotting, calculating density, etc. This poses no difficulties, however,
as.ctd automatically converts absolute pressure to sea pressure,
if the metadata in the rsk object indicates that this is
appropriate. Further alteration of the pressure can be accomplished with the
pressureAtmospheric argument, as noted above.
Culkin, F., and Norman D. Smith, 1980. Determination of the concentration of potassium chloride solution having the same electrical conductivity, at 15 C and infinite frequency, as standard seawater of salinity 35.0000 ppt (Chlorinity 19.37394 ppt). IEEE Journal of Oceanic Engineering, volume 5, pages 22-23.
Other things related to ctd data:
library(oce) ## 1. fake data, with default units 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) # Add a new column fluo <- 5 * exp(-pressure / 20) ctd <- oceSetData(ctd, name="fluorescence", value=fluo, unit=list(unit=expression(mg/m^3), scale="")) summary(ctd)#> CTD Summary #> ----------- #> #> * Data Overview #> #> Min. Mean Max. Dim. NAs OriginalName #> scan 1 25.5 50 50 0 - #> salinity [PSS-78] 33.486 34.111 34.521 50 0 - #> temperature [°C, ITS-90] 8.9567 9.7808 11.033 50 0 - #> pressure [dbar] 1 25.5 50 50 0 - #> fluorescence [mg/m³] 0.41042 1.7903 4.7561 50 0 - #> #> * Processing Log #> #> - 2020-07-21 16:49:04 UTC: `create 'ctd' object` #> - 2020-07-21 16:49:04 UTC: `as.ctd(salinity = salinity, temperature = temperature, pressure = pressure)` #> - 2020-07-21 16:49:04 UTC: `oceSetData(object = ctd, name = "fluorescence", value = fluo, unit = list(unit = expression(mg/m^3), scale = ""))`