-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathread.adp.Rd
195 lines (178 loc) · 7.33 KB
/
read.adp.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/adp.R
\name{read.adp}
\alias{read.adp}
\title{Read an adp File}
\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{
\item{file}{a connection or a character string giving the name of the file
to load. (For \code{read.adp.sontek.serial}, this is generally a list of
files, which will be concatenated.)}
\item{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 \dQuote{Examples}, and make
careful note of the use of the \code{tz} argument. If \code{from} is not
supplied, it defaults to 1.}
\item{to}{an optional indication of the last profile to read, in a
format as described for \code{from}. As a special case, \code{to=0} means
to read the file to the end. If \code{to} is not supplied, then it defaults
to 0.}
\item{by}{an optional indication of the stride length to use while walking through
the file. If this is an integer, then \code{by-1} profiles are skipped
between each pair of profiles that is read, e.g. the default \code{by=1}
means to read all the data. (For RDI files \emph{only}, there are some
extra features to avoid running out of memory; see \dQuote{Memory considerations}.)}
\item{tz}{character string indicating time zone to be assumed in the data.}
\item{longitude}{optional signed number indicating the longitude in degrees
East.}
\item{latitude}{optional signed number indicating the latitude in degrees
North.}
\item{manufacturer}{an optional character string indicating the manufacturer, used by
the general function \code{read.adp} to select a subsidiary function to use. If this
is not given, then \code{\link[=oceMagic]{oceMagic()}} is used to try to infer the type. If this
is provided, then the value \code{"rdi"} will cause \code{\link[=read.adp.rdi]{read.adp.rdi()}}
to be used, \code{"nortek"} will cause \code{\link[=read.adp.nortek]{read.adp.nortek()}} to be used,
and \code{"sontek"} will cause \code{\link[=read.adp.sontek]{read.adp.sontek()}} to be used.}
\item{encoding}{ignored.}
\item{monitor}{boolean value indicating whether to indicate the progress
of reading the file, by using \code{\link[=txtProgressBar]{txtProgressBar()}} or otherwise. The value
of \code{monitor} is changed to \code{FALSE} automatically, for non-interactive
sessions.}
\item{despike}{if \code{TRUE}, \code{\link[=despike]{despike()}} will be used to clean
anomalous spikes in heading, etc.}
\item{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.)}
\item{debug}{a flag that turns on debugging. Set to 1 to get a moderate
amount of debugging information, or to 2 to get more.}
\item{\dots}{optional additional arguments that some (but not all)
\verb{read.adp.*()} functions pass to lower-level functions.}
}
\value{
An \linkS4class{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 \code{nmea} in the \code{data} slot).
}
\description{
Read an ADP data file, producing an \linkS4class{adp} object.
}
\details{
Several file types can be handled. Some of
these functions are wrappers that map to device names, e.g.
\code{read.aquadoppProfiler} does its work by calling
\code{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 \code{\link[=read.adv]{read.adv()}}.
}
\section{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.
\enumerate{
\item In R, \code{\link[=readBin]{readBin()}} is used to insert the file contents into
a \link{vector} of type \code{raw}.
\item 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 \link{vector} of
type \code{integer}.
\item In R, \code{\link[=readBin]{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
to \code{\link[=readBin]{readBin()}}. This process is done for each of the data
fields that are to be handled. Importantly, these \code{\link[=readBin]{readBin()}}
calls are tailored to the data, using values of
the \code{size}, \code{endian} and \code{signed} 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.
\item Finally, in R, the acquired items are inserted into the \code{data} or
\code{metadata} slot of the return value, according to oce convention.
}
}
\seealso{
Other things related to adp data:
\code{\link{[[,adp-method}},
\code{\link{[[<-,adp-method}},
\code{\link{ad2cpCodeToName}()},
\code{\link{ad2cpHeaderValue}()},
\code{\link{adp}},
\code{\link{adp-class}},
\code{\link{adpAd2cpFileTrim}()},
\code{\link{adpConvertRawToNumeric}()},
\code{\link{adpEnsembleAverage}()},
\code{\link{adpFlagPastBoundary}()},
\code{\link{adpRdiFileTrim}()},
\code{\link{adp_rdi.000}},
\code{\link{applyMagneticDeclination,adp-method}},
\code{\link{as.adp}()},
\code{\link{beamName}()},
\code{\link{beamToXyz}()},
\code{\link{beamToXyzAdp}()},
\code{\link{beamToXyzAdpAD2CP}()},
\code{\link{beamToXyzAdv}()},
\code{\link{beamUnspreadAdp}()},
\code{\link{binmapAdp}()},
\code{\link{enuToOther}()},
\code{\link{enuToOtherAdp}()},
\code{\link{handleFlags,adp-method}},
\code{\link{is.ad2cp}()},
\code{\link{plot,adp-method}},
\code{\link{read.adp.ad2cp}()},
\code{\link{read.adp.nortek}()},
\code{\link{read.adp.rdi}()},
\code{\link{read.adp.sontek}()},
\code{\link{read.adp.sontek.serial}()},
\code{\link{read.aquadopp}()},
\code{\link{read.aquadoppHR}()},
\code{\link{read.aquadoppProfiler}()},
\code{\link{rotateAboutZ}()},
\code{\link{setFlags,adp-method}},
\code{\link{subset,adp-method}},
\code{\link{subtractBottomVelocity}()},
\code{\link{summary,adp-method}},
\code{\link{toEnu}()},
\code{\link{toEnuAdp}()},
\code{\link{velocityStatistics}()},
\code{\link{xyzToEnu}()},
\code{\link{xyzToEnuAdp}()},
\code{\link{xyzToEnuAdpAD2CP}()}
Other functions that read adp data:
\code{\link{read.adp.ad2cp}()},
\code{\link{read.adp.nortek}()},
\code{\link{read.adp.rdi}()},
\code{\link{read.adp.sontek}()},
\code{\link{read.adp.sontek.serial}()},
\code{\link{read.aquadopp}()},
\code{\link{read.aquadoppHR}()},
\code{\link{read.aquadoppProfiler}()}
}
\author{
Dan Kelley and Clark Richards
}
\concept{functions that read adp data}
\concept{things related to adp data}