Learn R Programming

oce (version 0.2-1)

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"),
  latitude=NA, longitude=NA,
  manufacturer=c("rdi", "nortek", "sontek"),
  debug=getOption("oceDebug"), monitor=TRUE, despike=FALSE, history,
  ...)
read.adp.rdi(file, from=1, to, by=1, tz=getOption("oceTz"),
  latitude=NA, longitude=NA,
  type=c("workhorse"),
  debug=getOption("oceDebug"), monitor=TRUE, despike=FALSE, history,
  ...)
read.adp.nortek(file, from=1, to, by=1, tz=getOption("oceTz"),
  latitude=NA, longitude=NA,
  type=c("aquadopp high resolution"),
  debug=getOption("oceDebug"), monitor=TRUE, despike=FALSE, history,
  ...)
read.adp.sontek(file, from=1, to, by=1, tz=getOption("oceTz"),
  latitude=NA, longitude=NA,
  type=c("adp","pcadp"),
  debug=getOption("oceDebug"), monitor=TRUE, despike=FALSE, history,
  ...)
read.adp.sontek.serial(file, from=1, to, by=1, tz=getOption("oceTz"),
                      latitude=NA, longitude=NA,
                      type=c("adp", "pcadp"),
                      beamAngle=25, orientation,
                      monitor=TRUE, history,
                      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.
tz
character string indicating time zone to be assumed in the data.
latitude
optional signed number indicating the latitude in degrees North.
longitude
optional signed number indicating the longitude in degrees East.
debug
a flag that turns on debugging. Set to 1 to get a moderate amount of debugging information, or to 2 to get more.
beamAngle
angle between instrument axis and beams, in degrees.
orientation
optional string, which over-rides the value inferred from the data file. Possible values are "upward" and "downward". This is only used for read.adp.sontek.serial.
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.
history
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.)
...
additional arguments, passed to called routines.

Value

  • An object of class "adp", which contains measurements made with an ADP device. The value of metadata$coordinate is set to "beam", a fact that is used in other steps in processing. For information on data stored in the object, see Details.

    There are three types of element stored in the result's data, namely space-series, time-series, and matrix. These are contained within lists named data$ss, data$ts and data$ma, respectively, with contents as follows. [object Object],[object Object],[object Object] In addition to the data entry, the metadata entry holds general information about such things as beam geometry, etc.

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$ts$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-HR files.Page 38 of the Nortek System Integrator Guide says to offset 53 bytes in profile records to get the first velocity, but experiments on files drived from a Dalhousie University profiler require an offset of 54 to recover data that match the manufacturer's (*.v1, *.v2, *.v3) files. Also, the beam angle is hard-wired at 25 degrees in the code, since it is not documented as being part of the headers. (Actually, the beam angle is in the header, in bytes 23 to 30 of the beam-header, but it is not documented, and sample code that Nortek provided to me in 2009 gives the scale incorrectly, as compared with files created with a Dalhousie aquadopHR.)

Details

Reads a binary-format ADP file. Three types can be handled at the moment: the Teledyne-RDI Workhorse instrument using firmware version 16.30 (and, to some extent, also firmware 16.28 and 16.21), the NorTek Aquadopp High Resolution profiler, and SonTek PCADP.

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

See Also

The generic function read.oce provides an alternative to this. An adp object may be summarized with summary.adp, and plotted with plot.adp.

Several functions are provided to manipulate adp objects. For example, in many research applications, the records are stored in beam coordinates, instead of the further-processed forms such as instrument or enu coordinates. Accordingly, beamToXyzAdp is provided, convert the velocity portions of adp objects from beam coordinates to xyz-based (also called ship-based or instrument-based) coordinates. Similarly, xyzToEnuAdp converts from xyz to enu coordinates, taking into account the varying orientation of an instrument attached to a ship or a mobile mooring. For applications in which enu-based coordinates are not desired (e.g. if a coordinate is to be aligned with the local coastline or a mean current), enuToOtherAdp is provided, to convert from enu coordinates to another coordinate system.

Another convenience function is beamAttenuateAdp, which performs a correction for $r^2$ beam spreading.

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