Learn R Programming

oce (version 0.9-18)

read.adp: Read an ADP data file

Description

Read an ADP data file, producing an object of type adp.

Usage

read.adp(file, from=1, to, by=1, tz=getOption("oceTz"),
  longitude=NA, latitude=NA,
  manufacturer=c("rdi", "nortek", "sontek"),
  monitor=FALSE, despike=FALSE, processingLog,
  debug=getOption("oceDebug"), ...)
read.adp.rdi(file, from=1, to, by=1, tz=getOption("oceTz"),
  longitude=NA, latitude=NA,
  type=c("workhorse"),
  monitor=FALSE, despike=FALSE, processingLog,
  testing=FALSE,
  debug=getOption("oceDebug"), ...)
read.aquadopp(file, from=1, to, by=1, tz=getOption("oceTz"),
  longitude=NA, latitude=NA,
  orientation, distance,
  monitor=FALSE, despike=FALSE, processingLog,
  debug=getOption("oceDebug"), ...)
read.aquadoppHR(file, from=1, to, by=1, tz=getOption("oceTz"),
  longitude=NA, latitude=NA,
  orientation, distance,
  monitor=FALSE, despike=FALSE, processingLog,
  debug=getOption("oceDebug"), ...)
read.aquadoppProfiler(file, from=1, to, by=1, tz=getOption("oceTz"),
  longitude=NA, latitude=NA,
  orientation, distance,
  monitor=FALSE, despike=FALSE, processingLog,
  debug=getOption("oceDebug"), ...)
read.adp.nortek(file, from=1, to, by=1, tz=getOption("oceTz"),
  longitude=NA, latitude=NA,
  type=c("aquadoppHR", "aquadoppProfiler", "aquadopp"),
  orientation, distance,
  monitor=FALSE, despike=FALSE, processingLog,
  debug=getOption("oceDebug"), ...)
read.adp.sontek(file, from=1, to, by=1, tz=getOption("oceTz"),
  longitude=NA, latitude=NA,
  type=c("adp","pcadp"),
  monitor=FALSE, despike=FALSE, processingLog,
  debug=getOption("oceDebug"), ...)
read.adp.sontek.serial(file, from=1, to, by=1, tz=getOption("oceTz"),
  longitude=NA, latitude=NA,
  type=c("adp", "pcadp"),
  beamAngle=25, orientation,
  monitor=FALSE, processingLog,
  debug=getOption("oceDebug"))

Arguments

file
a connection or a character string giving the name of the file to load. (For read.adp.sontek.serial, this is generally a list of files, which will be concatenated.
from
indication of the first profile to read. This can be an integer, the sequence number of the first profile to read, or a POSIXt time before which profiles should be skipped, or a character string that converts to a POSIXt time (assuming UTC ti
to
if supplied, an indication of the last profile to read, in a format as described for from. If not supplied, the whole file will be read.
by
an indication of the stride length to use while walking through the file. If this is an integer, then by-1 profiles are skipped between each pair of profiles that is read. If this is a string representing a time interval, in col
manufacturer
a character string indicating the manufacturer, used by the general function read.adp to select a subsidiary function to use, such as read.adp.nortek.
type
a character string indicating the type of instrument.
orientation
optional character string specifying the orientation of the sensor, provided for those cases in which it cannot be inferred from the data file. The valid choices are "upward", "downward", and "sideward".
distance
optional vector holding the distances of bin centres from the sensor. This argument is ignored except for Nortek profilers, and need not be given if the function determines the distances correctly from the data. The problem is that the distan
tz
character string indicating time zone to be assumed in the data.
longitude
optional signed number indicating the longitude in degrees East.
latitude
optional signed number indicating the latitude in degrees North.
beamAngle
angle between instrument axis and beams, in degrees.
monitor
boolean, set to TRUE to provide an indication (with numbers and dots) of every profile read.
despike
if TRUE, despike will be used to clean anomalous spikes in heading, etc.
processingLog
if provided, the action item to be stored in the log. (Typically only provided for internal calls; the default that it provides is better for normal calls by a user.)
testing
a flag that applies only to RDI units. If this is TRUE, then the time-varying device orientation is inferred from the per-profile header information, and the boolean result is stored in an integer vector named upward
debug
a flag that turns on debugging. Set to 1 to get a moderate amount of debugging information, or to 2 to get more.
...
additional arguments, passed to called routines.

Value

  • An object of class "adp", which contains measurements made with an ADP device. See adp-class for notes on the contents of the object.

    In ADP data files, velocities are coded to signed 2-byte integers, with a scale factor being used to convert to velocity in metres per second. These two facts control the maximum recordable velocity and the velocity resolution, values that may be retrieved for an ADP object name d with d[["velocityMaximum"]] and d[["velocityResolution"]].

Implementation notes

  • Teledyne-RDI files.If a heading bias had been set with theEBcommand during the setup for the deployment, then a heading bias will have been stored in the file's header. This value is stored in the object's metadata asmetadata$heading.bias.Importantly, this value is subtracted from the headings stored in the file, and the result of this subtraction is stored in the objects heading value (indata$heading). It should be noted thatread.adp.rdi()was tested for firmware version 16.30. For other versions, there may be problems. For example, the serial number is not recognized properly for version 16.28.
  • Nortek Aquadopp files.The R code is based on information in the Nortek System Integrator Guide (2008) and on postings on the Nortek ``knowledge center'' discussion board. One might assume that the latter is less authoritative than the former. For example, the inference of cell size follows advice found athttp://www.nortekusa.com/en/knowledge-center/forum/hr-profilers/736804717(downloaded June 2012)), which contains a typo in an early posting that is corrected later on.

A warning for RDI files

The upward/downward orientation is inferred from the ``fixed'' header of the first profile in the data file, so it will be incorrect if the deployment orientation is different. This poses a problem for data recorded in beam coordinates, because the orientation is used by e.g. beamToXyz in converting to xyz coordinates. The solution is to alter the value of @metadata$orientation prior to doing any such coordinate transformation.

Details

Reads a binary-format ADP file. Several file types can be handled. Some of these functions are wrappers that map to device names, e.g. read.aquadoppProfiler does its work by calling read.adp.nortek; in this context, it is worth noting that the ``aquadopp'' instrument is a one-cell profiler that might just as well have been documented under the heading read.adv.

References

1. Teledyne-RDI, 2007. WorkHorse commands and output data format. P/N 957-6156-00 (November 2007). (Section 5.3 h details the binary format, e.g. the file should start with the byte 0x7f repeated twice, and each profile starts with the bytes 0x80, followed by 0x00, followed by the sequence number of the profile, represented as a little-endian two-byte short integer. read.adp.rdi() uses these sequences to interpret data files.)

2. Information on Nortek profilers (including the System Integrator Guide, which explains the data format byte-by-byte) is available at http://www.nortekusa.com/. (One must join the site to see the manuals.)

3. Information about Sontek profilers is available at http://www.sontek.com.

4. The Nortek Knowledge Center http://www.nortekusa.com/en/knowledge-center may be of help if problems arise in dealing with data from Nortek instruments.

See Also

The documentation for adp-class explains the structure of ADP objects, and also outlines the other functions dealing with them.

Examples

Run this code
library(oce)
# A day sampled at 1/2 hour interval.  Note the timezone.
dir <- "/data/archive/sleiwex/2008/moorings/"
f <- paste(dir, "m09/adp/rdi_2615/raw/adp_rdi_2615.000", sep="")
d <- read.oce(f, from=as.POSIXct("2008-06-26", tz="UTC"),
                 to=as.POSIXct("2008-06-27", tz="UTC"), by="30:00")
summary(d)
plot(d)

Run the code above in your browser using DataLab