R: Class to Store CTD (or general hydrographic) Data

ctd-class {oce} | R Documentation

## Class to Store CTD (or general hydrographic) Data

### Description

Class to store hydrographic data such as measured with a CTD (conductivity, temperature, depth) instrument, or with other systems that produce similar data. Data repositories may store conductivity, temperature and depth, as in the instrument name, but it is also common to store salinity, temperature and pressure instead (or in addition). For this reason, `ctd` objects are required to hold `salinity`, `temperature` and `pressure` in their `data` slot, with other data being optional. Formulae are available for converting between variants of these data triplets, e.g. `swSCTp` can calculate `salinity` given `conductivity`, `temperature` and `pressure`, and these are used by the main functions that create `ctd` objects. For example, if `read.ctd.sbe` is used to read a Seabird file that contains only conductivity, temperature and pressure, then that function will automatically append a data item to hold salinity. `as.ctd` acts similarly. The result this is that all `ctd` objects hold `salinity`, `temperature` and `pressure`, which are henceforth called the three basic quantities.

### Details

Different units and scales are permitted for the three basic quantities, and most `oce` functions check those units and scales before doing calculations (e.g. of seawater density), because those calculations demand certain units and scales. The way this is handled is that the accessor function `[[,ctd-method` returns values in standardized form. For example, a `ctd` object might hold temperature defined on the IPTS-68 scale, but e.g. `ctd[["temperature"]]` returns a value on the ITS-90 scale. (The conversion is done with `T90fromT68`.) Similarly, pressure may be stored in either dbars or PSI, but e.g. `ctd[["pressure"]]` returns a value in dbars, after multiplying by 0.689476 if the value is stored in PSI. Luckily, there is (as of early 2016) only one salinity scale in common use in data files, namely PSS-78.

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.

After the names listed above 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 data

Data may be extracted with `[[,ctd-method` and inserted with `[[<-,ctd-method`. As noted above, `[[,ctd-method` returns temperature in the ITS-90 scale and pressure in dbar, regardless of the scale and unit of the data within the object. Type `?"[[,ctd-method"` or `?"[[<-,ctd-method"` to learn more.

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"]]`.

### Extracting 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.

### Reading/creating data

A file containing CTD profile data may be read with `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. Data can also be assembled into `ctd` objects with `as.ctd`.

Statistical summaries are provided by `summary,ctd-method`, while `show` displays an overview.

CTD objects may be plotted with `plot,ctd-method`, 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`.

As with all oce objects, low-level manipulation may be done with `oceSetData` and `oceSetMetadata`. Additionally, many of the contents of CTD objects may be altered with the `[[,ctd-method` scheme discussed above, and skilled users may also manipulate the contents directly.

### Author(s)

Dan Kelley

### See Also

Other classes provided by `oce`: `adp-class`, `adv-class`, `argo-class`, `bremen-class`, `cm-class`, `coastline-class`, `echosounder-class`, `lisst-class`, `lobo-class`, `met-class`, `oce-class`, `odf-class`, `rsk-class`, `sealevel-class`, `section-class`, `topo-class`, `windrose-class`

Other things related to `ctd` data: `[[,ctd-method`, `[[<-,ctd-method`, `as.ctd`, `cnvName2oceName`, `ctdDecimate`, `ctdFindProfiles`, `ctdRaw`, `ctdTrim`, `ctd`, `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`

[Package oce version 0.9-20 Index]