read.ctd {oce} | R Documentation |
Read a CTD data file, producing an object of type ctd
.
read.ctd(file, type=NULL, debug=FALSE, columns=NULL, check.human.headers=TRUE)
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"
and either "conductivity" or "salinity" , or else very little
can be done with the file. |
check.human.headers |
produces warnings for missing human-written header items. |
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.
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 |
filename |
name of the file passed to read.ctd |
filename.orig |
name of the original file saved by the instrument (normally a hex file) |
system.upload.time |
system upload time |
ship |
name of the ship from which the CTD was deployed |
scientist |
name of the scientist taking the data |
institute |
name of the institute |
address |
the address of the institute where the scientist |
cruise |
name of cruise |
section.id |
name of section |
station |
station number or name |
date |
date of lowering of CTD into the water |
latitude |
latitude, in decimal degrees, positive north of equator |
longitude |
longitude, in decimal degrees, positive if east of Greenwich and west of dateline |
recovery |
date of recovery of CTD |
sample.interval |
time interval between samples [s] |
water.depth |
the water depth at the site [m] |
processing.log |
A processing log. |
data |
A 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 . |
Dan Kelley Dan.Kelley@Dal.Ca
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
The generic function read.oce
provides an alternative to this.
A ctd
object may be summarized with summary.ctd
and plotted
with plot.ctd
.
## Not run: 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 ## End(Not run)