Learn R Programming

oce (version 0.8-3)

as.ctd: Coerce data into ctd dataset

Description

Coerces a dataset into a ctd dataset.

Usage

as.ctd(salinity, temperature, pressure,
   oxygen, nitrate, nitrite, phosphate, silicate,
   other, missingValue,
   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.
oxygen
optional oxygen concentration
nitrate
optional nitrate concentration [micromole/kg]
nitrite
optional nitrite concentration [micromole/kg]
phosphate
optional phosphate concentration [micromole/kg]
silicate
optional silicate concentration [micromole/kg]
other
optional list of other data columns that are not in the standard list
missingValue
optional missing value, indicating data that should be taken as NA.
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

The documentation for ctd-class explains the structure of CTD objects, and also outlines the other functions dealing with them.

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