ctd
.read.ctd(file, type=NULL, columns=NULL, station=NULL,
monitor=FALSE, debug=getOption("oceDebug"), processingLog, ...)
read.ctd.sbe(file, columns=NULL, station=NULL, missing.value,
monitor=FALSE, debug=getOption("oceDebug"), processingLog, ...)
read.ctd.woce(file, columns=NULL, station=NULL, missing.value=-999,
monitor=FALSE, debug=getOption("oceDebug"), processingLog, ...)
read.ctd.woce.other(file, columns=NULL, station=NULL, missing.value=-999,
monitor=FALSE, debug=getOption("oceDebug"), processingLog, ...)
read.ctd.odf(file, columns=NULL, station=NULL, missing.value=-999,
monitor=FALSE, debug=getOption("oceDebug"), processingLog, ...)
read.ctd.odv(file, columns=NULL, station=NULL, missing.value=-999,
monitor=FALSE, debug=getOption("oceDebug"), processingLog, ...)
read.ctd.itp(file, columns=NULL, station=NULL, missing.value=-999,
monitor=FALSE, debug=getOption("oceDebug"), processingLog, ...)
read.ctd.sbe()
and read.ctd.woce()
, this may be a
wildcard (e.g. "*.cnv"
or "*.csv"
) in which case the return
valNULL
, 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 aNULL
, then read.ctd
tries to infer column
names from the header. For SBE files only, the column
argument can
control the column selection. It is a list that names data types and the
columns containinNA
upon reading.TRUE
to provide an indication of
progress. This is useful if filename
is a wildcard.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
data$pressure
, data$salinity
, data$temperature
, and
data$sigmatheta
. ($\sigma_\theta$ is calculated
using swSigmaTheta
.)metadata
processingLog
oce
format.read.ctd.sbe
handles water depths in any of the following
forms, but ostensibly similar forms may not work.** DEPTH = 100 ** Water Depth: 40 m ** Depth (m): 3447 ** Depth: 16 ** Profondeur: 92
Similar issues come up for other items in CTD headers. For example, date
variants can cause a problem if, say, a date is stored in American notation
but the user is in another locale, where dates are represented differently;
a solution is to call Sys.setlocale("LC_TIME", "en_US")
before
reading the data.
Even when read.ctd
appears to have read the data without error, the
prudent user will do some plots and summaries on a sample file. It is also
a good idea to examine some inferred numerical values in comparison with the
information in the data file. CTD profiles are not cheap to acquire, and
publishing erroneous results is highly embarrassing. The rewards of having
confidence in the data surely outweigh the cost of a half hour spent looking
at the data.
system.file("extdata", "ctd.cnv", package="oce")
system.file("extdata", "d200321-001.ctd", package="oce")
system.file("extdata", "CTD_BCD2010666_01_01_DN.ODF", package="oce")
read.ctd
, which analyzes some of the file contents,
and then calls one of the following, any of which can be called directly.
read.ctd.sbe()
reads files files created by Seabird CTD
instruments. These are recognized by a first line with first ten characters
``* Sea-Bird
.''read.ctd.woce()
reads files stored in the exchange format used
by the World Ocean Circulation Experiment (WOCE) (first 4 characters of the
first line being ``CTD,
''), and also in a rarer format with the first
3 characters being ``CTD
'' followed by a blank or the end of the
line).read.ctd.woce.other()
reads the format called ``CTD'' in the
section of the archive websites named ``Other formats.'' These data are
stored in filenames ending.WCT
, and they do not have a great deal of
metadata (e.g. longitude), so the user is forced to infer such things from a
separate file. Support for this data type is limited, e.g. requiring a
header of a certain length and data columns in a certain order.
Improvements are unlikely to be added to the function, since this data type
seems to offer no advantages over the type handled byread.ctd.woce()
.read.ctd.odf()
reads files stored in Ocean Data Format, used in
some Canadian hydrographic databases. 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@metadata$institute
and
object@metadata$scientist
are left blank for WOCE files.
http://woce.nodc.noaa.gov/woce_v3/wocedata_1/whp/exchange/exchange_format_desc.htm
,
and a sample file is at
The ODF format, used by the Canadian Department of Fisheries and Oceans, is
described to some extent in the documentation for read.odf
. It
is not clear that ODF format is handled correctly in read.ctd.odf
, or
the more general function read.odf
, because the format seems to
be somewhat variable and some of the R code is designed mainly by examination
of some particular files being used in the author's research.
The ODV
format, used by the ODV software and some European/British data
providers, is described in a file stored on the website of the British
Oceanographic Data Center, bodc.ac.uk
, in a directory named
data/codes_and_formats/odv_format
. (The URL is not provided here
because it is unreliable, which causes problems with CRAN submission of the
oce package.)
Information about ice-tethered profile data is provided at
ctd-class
explains the structure of
ctd
objects, and also outlines the other functions dealing with them.library(oce)
## Labrador Sea data, file 0001919.tar.gz from website
## http://www.nodc.noaa.gov/cgi-bin/OAS/prd/accession/download
d <- read.ctd.woce("*.csv")
data(coastlineWorld)
plot(coastlineWorld, clat=55, clon=-50, span=5000)
longitude <- sapply(d, function(stn) stn[['longitude']])
latitude <- sapply(d, function(stn) stn[['latitude']])
points(longitude, latitude, col='red')
Run the code above in your browser using DataLab