Learn R Programming

oce (version 0.2-1)

as.ctd: Coerce data into ctd dataset

Description

Coerces a dataset into a ctd dataset.

Usage

as.ctd(salinity, temperature, pressure, quality, 
   ship="", scientist="", institute="", address="", cruise="", station="", 
   date="", startTime="", recovery="",
   latitude=NA, longitude=NA, 
   waterDepth=NA, sampleInterval=NA, src="")

Arguments

salinity
Salinity through the water column, or a data frame containing columns named salinity, temperature, and pressure, in which case these values are extracted from the data frame, and the next two arguments ar
temperature
Temperature through the water column. (This is converted to a vector, if it is not one already.
pressure
pressure through the water column. (If just a single value is given, then it is repeated to match the length of the temperature and salinity.
quality
quality flag, e.g. from the salinity quality flag in WOCE data. (In WOCE, quality=2 indicates good data, quality=3 means questionable data, and quality=4 means bad data.
ship
optional string containing the ship from which the observations were made.
scientist
optional string containing the chief scientist on the cruise.
institute
optional string containing the institute behind the work.
address
optional string containing the address of the institute.
cruise
optional string containing a cruise identifier.
station
optional string containing a station identifier.
date
optional string containing the date at which the profile was started.
startTime
optional string containing the start time.
recovery
optional string indicating the recovery time.
latitude
optional numerical value containing the latitude in decimal degrees, positive in the northern hemisphere.
longitude
optional numerical value containing longitude in decimal degrees, positive in the eastern hemisphere.
waterDepth
optional numerical value indicating the water depth in metres.
sampleInterval
optional numerical value indicating the time between samples in the profile.
src
optional string indicating data source

Value

Details

This function assembles vectors of salinity, temperature, and pressure, to create a ctd object, e.g. so that plot.ctd can be used to make a standard four-panel plot, or so that a section can be constructed with makeSection. Normally, the input vectors will be of the same length, but as.ctd can also handle cases in which one or two of these is of unit length. For example, if only a temperature profile is available, as.ctd(35, T, p) could be used to construct a ctd object with constant salinity.

References

http://cchdo.ucsd.edu/CCHDO_DataSubmitGuide.pdf http://cchdo.ucsd.edu/manuals/pdf/90_1/chap4.pdf

See Also

A file containing CTD profile data may be read with read.ctd. A ctd object may be summarized with summary.ctd. Overview plots may be made with plot.ctd, while plot.TS produces TS plots and plot.ctd.scan produces scan plots that may help with data editing. Extraneous data such as those collected during upcasts and equilibration intervals may be trimmed with ctdTrim, and the data may be cast onto specified pressure levels with ctdDecimate. Low-level manipulation may be done with ctdAddColumn and ctdUpdateHeader, as well as by direct manipulation of the items within ctd objects.

Examples

Run this code
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