read.adp {oce} | R Documentation |
Read an adp File
Description
Read an ADP data file, producing an adp object.
Usage
read.adp(
file,
from,
to,
by,
tz = getOption("oceTz"),
longitude = NA,
latitude = NA,
manufacturer,
encoding = NA,
monitor = FALSE,
despike = FALSE,
processingLog,
debug = getOption("oceDebug"),
...
)
Arguments
file |
a connection or a character string giving the name of the file
to load. (For |
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 timezone). See “Examples”, and make
careful note of the use of the |
to |
an optional indication of the last profile to read, in a
format as described for |
by |
an optional indication of the stride length to use while walking through
the file. If this is an integer, then |
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. |
manufacturer |
an optional character string indicating the manufacturer, used by
the general function |
encoding |
ignored. |
monitor |
boolean value indicating whether to indicate the progress
of reading the file, by using |
despike |
if |
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.) |
debug |
a flag that turns on debugging. Set to 1 to get a moderate amount of debugging information, or to 2 to get more. |
... |
optional additional arguments that some (but not all)
|
Details
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()
.
Value
An adp object.
The contents of that object make sense for the particular instrument
type under study, e.g. if the data file contains
NMEA strings, then navigational data will be stored in an item
called nmea
in the data
slot).
How the binary file is decoded
This file type, like other acoustic-Doppler types, is read with a hybrid R/C++ system, for efficiency. The processing steps are sketched below, for users who want to inspect the code or build upon it.
In R,
readBin()
is used to insert the file contents into a vector of typeraw
.In C++, this raw vector is scanned byte by byte, to find the starting indices of data "chunks", or subsections of the data that correspond to individual sampling times. Checksum computations are also done at this stage, to detect possible data corruption. Warnings are issued for any bad chunks, and they are skipped in further processing. The valid starting points are then passed back to R as a vector of type
integer
.In R,
readBin()
is used to read the components of each chunk. For speed, this is done in a vectorized fashion. For example, all the velocities in the whole file are read in a single call toreadBin()
. This process is done for each of the data fields that are to be handled. Importantly, thesereadBin()
calls are tailored to the data, using values of thesize
,endian
andsigned
parameters that are tailored to the structure of the given component. Scaling factors are then applied as required, to convert the components to physical units.Finally, in R, the acquired items are inserted into the
data
ormetadata
slot of the return value, according to oce convention.
Author(s)
Dan Kelley and Clark Richards
See Also
Other things related to adp data:
[[,adp-method
,
[[<-,adp-method
,
ad2cpCodeToName()
,
ad2cpHeaderValue()
,
adp-class
,
adpAd2cpFileTrim()
,
adpConvertRawToNumeric()
,
adpEnsembleAverage()
,
adpFlagPastBoundary()
,
adpRdiFileTrim()
,
adp_rdi.000
,
adp
,
applyMagneticDeclination,adp-method
,
as.adp()
,
beamName()
,
beamToXyzAdpAD2CP()
,
beamToXyzAdp()
,
beamToXyzAdv()
,
beamToXyz()
,
beamUnspreadAdp()
,
binmapAdp()
,
enuToOtherAdp()
,
enuToOther()
,
handleFlags,adp-method
,
is.ad2cp()
,
plot,adp-method
,
read.adp.ad2cp()
,
read.adp.nortek()
,
read.adp.rdi()
,
read.adp.sontek.serial()
,
read.adp.sontek()
,
read.aquadoppHR()
,
read.aquadoppProfiler()
,
read.aquadopp()
,
rotateAboutZ()
,
setFlags,adp-method
,
subset,adp-method
,
subtractBottomVelocity()
,
summary,adp-method
,
toEnuAdp()
,
toEnu()
,
velocityStatistics()
,
xyzToEnuAdpAD2CP()
,
xyzToEnuAdp()
,
xyzToEnu()
Other functions that read adp data:
read.adp.ad2cp()
,
read.adp.nortek()
,
read.adp.rdi()
,
read.adp.sontek.serial()
,
read.adp.sontek()
,
read.aquadoppHR()
,
read.aquadoppProfiler()
,
read.aquadopp()