R: Read an AML CTD file

read.ctd.aml {oce} | R Documentation

## Read an AML CTD file

### Description

`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’).

### Usage

    read.ctd.aml(file, format, debug = getOption("oceDebug"), processingLog, ...)

### Arguments

`file` | a connection or a character string giving the name of the file to load.
`format` | 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’).
`debug` | 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.
`processingLog` | ignored.
`...` | ignored.

### Details

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.

1. 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.

2. 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.

### Value

`read.ctd.aml()` returns a ctd object.

### Author(s)

Dan Kelley

### References

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.

### See Also

Other functions that read ctd data: `read.ctd.itp()`, `read.ctd.odf()`, `read.ctd.sbe()`, `read.ctd.woce.other()`, `read.ctd.woce()`, `read.ctd()`

### Examples

    library(oce)
    f <- system.file("extdata", "ctd_aml.csv", package="oce")
    d <- read.ctd.aml(f)
    summary(d)

[Package oce version 1.7-2 Index]