Learn R Programming

oce (version 0.1.67)

read.ctd: Read a CTD data file

Description

Read a CTD data file, producing an object of type ctd.

Usage

read.ctd(file, type=NULL, debug=FALSE,
 	columns=NULL, check.human.headers=TRUE)

Arguments

file
a connection or a character string giving the name of the file to load.
type
if NULL, then the first line is studied, in order to determine the file type. If type="SBE19", then a Seabird 19 (or similar) CTD format is assumed. If type="WOCE" then a WOCE-exchange file is assumed.
debug
a flag that can be set to TRUE to turn on debugging.
columns
if NULL, then read.ctd tries to infer column names from the header. If a list, then it will be taken to be the list of columns. The list must include "pressure", "temperature"
check.human.headers
produces warnings for missing human-written header items.

Value

  • A ctd object containing information about the station (e.g. latitude, etc.), along with vectors containing the acquired data (e.g. S, etc.). The full header is also contained in the list. The returned list is as follows, but the reader is cautioned that some items may be blank for some file formats.
  • header[]the header itself, normally containing several dozen lines of information
  • filenamename of the file passed to read.ctd
  • filename.origname of the original file saved by the instrument (normally a hex file)
  • system.upload.timesystem upload time
  • shipname of the ship from which the CTD was deployed
  • scientistname of the scientist taking the data
  • institutename of the institute
  • addressthe address of the institute where the scientist
  • cruisename of cruise
  • section.idname of section
  • stationstation number or name
  • datedate of lowering of CTD into the water
  • latitudelatitude, in decimal degrees, positive north of equator
  • longitudelongitude, in decimal degrees, positive if east of Greenwich and west of dateline
  • recoverydate of recovery of CTD
  • sample.intervaltime interval between samples [s]
  • water.depththe water depth at the site [m]
  • processing.logA processing log.
  • dataA data table containing the profile data as vectors. The column names are discovered from the header, and may thus differ from file to file. For example, some CTD instruments may have a fluorometer connected, others may not. The following vectors are normally present: data$pressure, data$salinity, data$temperature, and data$sigma. Note that data$sigma is calculated from the pressure, salinity, and temperature in the file, using sw.sigma.

Details

Oceanographers use CTD (conductivity-temperature-depth) instruments to measure key properties of the ocean, such as water temperature, salinity, etc. This function reads CTD datasets that have been stored in common formats, and could be extended to accommodate other formats if needed.

read.ctd does a reasonable job of inferring meta-information from file headers, but it still has limitations. For example, in the first file tested during development, the sampling rate was written as * sample rate = 1 scan every 0.5 seconds, while in the second test file it was written * Real-Time Sample Interval = 0.125 seconds. Similarly, read.ctd can be challenged in parsing latitudes and longitudes in the wide variety of ways that humans choose. Still, such limitations are not really pressing in practice, since the ctd object is made available for manipulation. If read.ctd cannot scan 33 and a third as a latitude, just examine the header (stored as a list in object$header), and do something like object$latitude <- 33 + 1/3.

It should be noted that different file types provide different meta-information. For example, the WOCE exchange format binds together the institute name and the initials of the chief scientist into a single string that read.ctd cannot parse, so both object$institute and object$scientist are left blank for WOCE files.

References

The Seabird CTD instrument is described at http://www.seabird.com/products/spec_sheets/19plusdata.htm, and the WOCE-exchange format is described at http://www.nodc.noaa.gov/woce_V2/disk02/exchange/exchange_format_desc.htm

See Also

The generic function read.oce provides an alternative to this.

A ctd object may be summarized with summary.ctd and plotted with plot.ctd.

Examples

Run this code
library(oce)
x <- read.ctd("/usr/local/lib/R/library/oce/demo/ctdprofile.cnv")
plot(x) # summary with TS and profiles
plot.TS(x) # just the TS

Run the code above in your browser using DataLab