ctd
.read.ctd(file, type=NULL, debug=FALSE,
columns=NULL, station=NULL, check.human.headers=FALSE, log.action)
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 TRUE
to turn on debugging.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 class
"ctd"
, which is a
list with elements detailed below.
The most important elements are the station name and position, along
with the profile data that are contained in the data frame named data
.
(Other elements in the list may be deleted in future versions of the
package, if they prove to be of little use in practice, or if they prove
to have been idiosyncratic features of the particular files used in
early development of oce
.)data$pressure
,
data$salinity
, data$temperature
, and
data$sigma.theta
. ($\sigma_\theta$ is calculated
using sw.sigma.theta
.)oce
format. 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$metadata$header
),
and do something like object$metadata$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.
The WOCE-exchange format is described at
read.oce
provides an alternative to this.Data from a CTD cast may be assembled into a ctd
object using as.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 ctd.trim
,
and the data may be cast onto specified pressure levels with ctd.decimate
.
Low-level manipulation may be done with ctd.add.column
and ctd.update.header
, as well as by direct manipulation of the items
within ctd
objects.
In many cases, CTD instruments are set up to report dates in English.
This can cause a problem for users running in different locales, since
e.g month names differ. Therefore, if you know your datafile is
written in American-English notation, you might want to do
Sys.setlocale("LC_TIME", "en_US")
before you try to read the data.
library(oce)
x <- read.ctd("BED0301.cnv")
plot(x) # summary with TS and profiles
plot.TS(x) # just the TS
Run the code above in your browser using DataLab