ctd
. Accessing metadata.
Metadata (contained in the S4 slot named metadata
) may be retrieved
or set by name, ctd[["longitude"]] <- ctd[["longitude"]] + 1
corrects a one-degree error.
Accessing measured data.
Column data may be accessed by name, e.g. ctd[["salinity"]]
,
ctd[["temperature"]]
, ctd[["pressure"]]
, etc. The TEOS-10
notation for these quantities also works, with ctd[["SP"]]
,
ctd[["t"]]
and ctd[["p"]]
returning identical values to those
returned for the longer names. (FIXME: GSW "t" should be T in ITS-90, but
"temperature" will be whatever happens to be in the datafile, which could
be IPTS-68 or ITS-90. Maybe there should be methods for "ITS-90" etc. This
needs to be adjusted in code and documentation.) After these names have
been checked, the remaining names in the data
slot are checked using
pmatch
, so that e.g. ctd[["sal"]]
will recover
practical salinity
, ctd[["sc"]]
will recover scan
(if
it exists), etc.
Accessing derived data.
Depth is accessed with e.g. ctd[["depth"]]
, while its negative, the
vertical coordinate, is accessed with e.g. ctd[["z"]]
; note that
these are calculated using swDepth
and swZ
, and
that any values that may have been read in a data file are ignored.
Potential temperature defined according to UNESCO-1980 is calculated with
ctd[["theta"]]
or ctd[["potential temperature"]]
. Salinity
is retrieved with ctd[["S"]]
or ctd[["salinity"]]
.
Conservative Temperature defined according to TEOS-2010 is calculated with
ctd[["CT"]]
or ctd[["conservative temperature"]]
. Absolute
salinity is calculated with ctd[["SA"]]
or ctd[["absolute
salinity"]]
. Note that the salinity calculation requires a latitude
and longitude, and if the ctd
object lacks those data, the values
300E and 30N will be used as a default.
The square of buoyancy frequency is retrieved with ctd[["N2"]]
or
swN2
, density ratio with ctd[["Rrho"]]
and spiciness
with ctd[["spice"]]
.
Assigning values.
Items stored in the object may be altered with e.g.
ctd[["salinity"]] <- rep(35,10)
. For obvious reasons, this does not
work with derived quantities such as conservative temperature, etc.
Overview of contents.
The show
method (e.g. show(ctd)
) displays information about
the object.
read.ctd
, and a CTD object can also be created with
as.ctd
. See read.ctd
for references on data
formats used in CTD files.
Statistical summaries are provided by summary.ctd
, while
show
displays an overview.
CTD objects may be plotted with plot.ctd
, which does much of
its work by calling plotProfile
or plotTS
, both
of which can also be called by the user, to get fine control over the
plots. A CTD profile can be isolated from a larger record with
ctdTrim
, a task made easier when plotScan
is
used to examine the results. Towyow data can be split up into sets of
profiles (ascending or descending) with ctdFindProfiles
. CTD
data may be smoothed and/or cast onto specified pressure levels with
ctdDecimate
.
Low-level manipulation may be done with functions such as
ctdAddColumn
and ctdUpdateHeader
.
Additionally, many of the contents of CTD objects may be altered with the
[[]]
scheme discussed above, and skilled uses may also manipulate
the contents directly.