Skip to contents

read.ctd.aml() reads files that hold data acquired with an AML Oceanographic Base.X2 CTD instrument. The software associated with this device can output data in multiple formats, of which read.ctd.aml() can read only three, based on files provided to the author by users. If the format parameter is not supplied, the function attempts to infer it from the first line in the file; see “Details”.

Usage

read.ctd.aml(
  file,
  format,
  encoding = "UTF-8-BOM",
  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 make a guess as to the format (see “Details”).

encoding

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.

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.

Value

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

Details

If format is not supplied, the first line of the file is examined. If that line contains [cast header] (case insensitive), then format 1 is inferred. If it contains a comma (i.e. if no header is present) then format 2 is inferred. (The AML documentation cautions against saving in this format.) And if it contains [header] (case insensitive) then format 3 is inferred.

Support for types 1 and 2 were added in about the year 2017, whereas type 3 was added in 2024. Documentation was once available for formats 1 and 2, but it was not an exact match to sample files provided to the author of read.ctd.aml(). No documentation seemed to be available for format 3, so the code was written after manual inspection of a sample file. Given these things, users are advised to be on the lookout for problems.

References

  1. AML Oceanographic. "SeaCast 4 User Manual (Version 2.06)." AML Oceanographic, May 2016. This was once available at the <www.subsseateechnologies.com> website, but neither it nor a new version could be located by the author's search of the website in September 2024.

Author

Dan Kelley

Examples

library(oce)
# Show S,T and p for first 5 lines of a format=1 file
f1 <- system.file("extdata", "ctd_aml_type1.csv.gz", package = "oce")
d1 <- read.ctd.aml(f1)
data.frame(S = d1[["salinity"]], T = d1[["temperature"]], p = d1[["pressure"]])
#>           S     T    p
#> 1  5.577871 5.671 0.23
#> 2  9.978261 5.509 0.22
#> 3 14.628767 5.400 0.22
#> 4 19.406751 5.325 0.24

# Show S,T and p for first 5 lines of a format=3 file
f3 <- system.file("extdata", "ctd_aml_type3.csv.gz", package = "oce")
d3 <- read.ctd.aml(f3)
data.frame(S = d3[["salinity"]], T = d3[["temperature"]], p = d3[["pressure"]])
#>        S      T    p
#> 1 37.797 25.871 0.00
#> 2 37.907 25.890 0.19
#> 3 37.914 25.861 0.44
#> 4 37.920 25.862 0.68
#> 5 37.932 25.838 0.90