read.ctd.aml()
reads files that hold data acquired with an AML
Oceanographic BaseX2 CTD instrument. The SeaCast software associated with
this device can output data in several formats, of which only two are
handled, and only one is recommended (see “Details”).
read.ctd.aml(
file,
format,
encoding = "UTF-8-BOM",
debug = getOption("oceDebug"),
processingLog,
...
)
read.ctd.aml()
returns a ctd object.
a connection or a character string giving the name of the file to load.
an integer indicating the format type. If not supplied, the
first line is examined to determine whether the file matches the format=1
or
format=2
style (see “Details”).
a character value that indicates the encoding to be used for
this data file, if it is textual. The default value for most functions is
"latin1"
, which seems to be suitable for files containing text written in
English and French.
an integer specifying whether debugging information is
to be printed during the processing. This is a general parameter that
is used by many oce
functions. Generally, setting debug=0
turns off the printing, while higher values suggest that more information
be printed. If one function calls another, it usually reduces the value of
debug
first, so that a user can often obtain deeper debugging
by specifying higher debug
values.
ignored.
ignored.
Dan Kelley
The handled formats match files available to the author, both of which diverge slightly from the format described in the AML documentation (see “References”).
Regardless of the format, files must contain columns named Conductivity (mS/cm)
, Temperature (C)
and Pressure (dBar)
, because ctd
objects need those quantities. (Actually, if pressure is not found, but
Depth (m)
is, then pressure is estimated with swDepth()
, as a
workaround.) Note that other columns will be also read and stored in the
returned value, but they will not have proper units. Attempts are made to
infer the sampling location from the file, by searching for strings like
Latitude=
in the header. Headers typically contain two values of the
location, and it is the second pair that is used by this function, with a
NA
value being recorded if the value in the file is no-lock
. The
instrument serial number is also read, although the individual serial numbers
of the sensors are not read. Position and serial number are stored in the
the metadata
slot of the returned value. The entire header is also stored
there, to let users glean more about dataset.
Two formats are handled, as described below. Format 1 is greatly preferred,
because it is more robust (see below on format=2
) and also because it can
be read later by the AML SeaCast software.
If format
is 1
then the file is assumed to be in a format created by
selecting Export As ... Seacast (.csv) in AML's SeaCast software, with
settings to output pressure (or, as second-best, depth), temperature and
conductivity, and perhaps other things. The delimiter must be comma. If
date and time are output, their formats must be yyyy-mm-dd and UTC,
respectively. Decoding the file proceeds as follows. First, a check is done
to ensure that the first line consists of the string [cast header]
. Then an
attempt is made to infer location and serial number from the header. After
this, read.ctd.aml()
searches down for a line containing the string
[data]
. The first line thereafter is taken as a comma-separated list of
variable names, and lines following that are taken to hold the variable
values, separated by commas.
If format
is 2
then the first line must be a comma-separated list of
column names. This may be followed by header information, which is handled
similarly as for format=1
. The data are read from all lines that have the
same number of commas as the first line, an admittedly brittle strategy
developed as a way to handle some files that lacked other information about
the end of the header.
In both cases, the data columns, renamed to oce convention, are stored in the
data
slot. For the mandatory variables, units are also stored, as for
other ctd objects.
AML Oceanographic. "SeaCast 4 User Manual (Version 2.06)." AML Oceanographic,
Mahy 2016.
https://www.subseatechnologies.com/media/files/page/032e50ac/seacast-4-2-user-manual-sti.pdf
.
Other things related to ctd data:
CTD_BCD2014666_008_1_DN.ODF.gz
,
[[,ctd-method
,
[[<-,ctd-method
,
as.ctd()
,
cnvName2oceName()
,
ctd
,
ctd-class
,
ctd.cnv.gz
,
ctdDecimate()
,
ctdFindProfiles()
,
ctdFindProfilesRBR()
,
ctdRaw
,
ctdRepair()
,
ctdTrim()
,
ctd_aml.csv.gz
,
d200321-001.ctd.gz
,
d201211_0011.cnv.gz
,
handleFlags,ctd-method
,
initialize,ctd-method
,
initializeFlagScheme,ctd-method
,
oceNames2whpNames()
,
oceUnits2whpUnits()
,
plot,ctd-method
,
plotProfile()
,
plotScan()
,
plotTS()
,
read.ctd()
,
read.ctd.itp()
,
read.ctd.odf()
,
read.ctd.odv()
,
read.ctd.saiv()
,
read.ctd.sbe()
,
read.ctd.ssda()
,
read.ctd.woce()
,
read.ctd.woce.other()
,
setFlags,ctd-method
,
subset,ctd-method
,
summary,ctd-method
,
woceNames2oceNames()
,
woceUnit2oceUnit()
,
write.ctd()
Other functions that read ctd data:
read.ctd()
,
read.ctd.itp()
,
read.ctd.odf()
,
read.ctd.saiv()
,
read.ctd.sbe()
,
read.ctd.ssda()
,
read.ctd.woce()
,
read.ctd.woce.other()
library(oce)
f <- system.file("extdata", "ctd_aml.csv.gz", package = "oce")
d <- read.ctd.aml(f)
summary(d)
Run the code above in your browser using DataLab