<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><title>Read an adv File — read.adv.nortek • oce</title><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/font-awesome-6.4.2/css/all.min.css" rel="stylesheet"><link href="../deps/font-awesome-6.4.2/css/v4-shims.min.css" rel="stylesheet"><script src="../deps/headroom-0.11.0/headroom.min.js"></script><script src="../deps/headroom-0.11.0/jQuery.headroom.min.js"></script><script src="../deps/bootstrap-toc-1.0.1/bootstrap-toc.min.js"></script><script src="../deps/clipboard.js-2.0.11/clipboard.min.js"></script><script src="../deps/search-1.0.0/autocomplete.jquery.min.js"></script><script src="../deps/search-1.0.0/fuse.min.js"></script><script src="../deps/search-1.0.0/mark.min.js"></script><!-- pkgdown --><script src="../pkgdown.js"></script><meta property="og:title" content="Read an adv File — read.adv.nortek"><meta name="description" content="Read an ADV data file, producing an object of type adv. This
function works by transferring control to a more specialized function,
e.g. read.adp.nortek() and read.adp.sontek(),
and in many cases users will find it preferable to either use these or
the several even more specialized functions, if the file type is
known."><meta property="og:description" content="Read an ADV data file, producing an object of type adv. This
function works by transferring control to a more specialized function,
e.g. read.adp.nortek() and read.adp.sontek(),
and in many cases users will find it preferable to either use these or
the several even more specialized functions, if the file type is
known."></head><body>
    <a href="#main" class="visually-hidden-focusable">Skip to contents</a>


    <nav class="navbar navbar-expand-lg fixed-top bg-light" data-bs-theme="light" aria-label="Site navigation"><div class="container">

    <a class="navbar-brand me-2" href="../index.html">oce</a>

    <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">1.8-4</small>


    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>

    <div id="navbar" class="collapse navbar-collapse ms-3">
      <ul class="navbar-nav me-auto"><li class="active nav-item"><a class="nav-link" href="../reference/index.html">Reference</a></li>
<li class="nav-item dropdown">
  <button class="nav-link dropdown-toggle" type="button" id="dropdown-articles" data-bs-toggle="dropdown" aria-expanded="false" aria-haspopup="true">Articles</button>
  <ul class="dropdown-menu" aria-labelledby="dropdown-articles"><li><a class="dropdown-item" href="../articles/A_oce.html">1. Introduction to Oce</a></li>
    <li><a class="dropdown-item" href="../articles/B_ctd.html">2. Analysis of CTD data</a></li>
    <li><a class="dropdown-item" href="../articles/C_adp.html">3. Analysis of acoustic-Doppler data</a></li>
    <li><a class="dropdown-item" href="../articles/D_map_projections.html">4. Using map projections</a></li>
    <li><a class="dropdown-item" href="../articles/E_flags.html">5. Dealing with data-quality flags</a></li>
    <li><a class="dropdown-item" href="../articles/F_subclassing.html">6. Subclassing oce objects</a></li>
    <li><a class="dropdown-item" href="../articles/G_altering_defaults.html">7. Altering oce Defaults</a></li>
    <li><a class="dropdown-item" href="../articles/H_tides.html">8. Tidal Analysis</a></li>
  </ul></li>
<li class="nav-item"><a class="nav-link" href="../news/index.html">Changelog</a></li>
      </ul><ul class="navbar-nav"><li class="nav-item"><form class="form-inline" role="search">
 <input class="form-control" type="search" name="search-input" id="search-input" autocomplete="off" aria-label="Search site" placeholder="Search for" data-search-index="../search.json"></form></li>
<li class="nav-item"><a class="external-link nav-link" href="https://github.com/dankelley/oce/" aria-label="GitHub"><span class="fa fab fa-github fa-lg"></span></a></li>
      </ul></div>


  </div>
</nav><div class="container template-reference-topic">
<div class="row">
  <main id="main" class="col-md-9"><div class="page-header">

      <h1>Read an adv File</h1>
      <small class="dont-index">Source: <a href="https://github.com/dankelley/oce/blob/HEAD/R/adv.nortek.R" class="external-link"><code>R/adv.nortek.R</code></a></small>
      <div class="d-none name"><code>read.adv.nortek.Rd</code></div>
    </div>

    <div class="ref-description section level2">
    <p>Read an ADV data file, producing an object of type <code>adv</code>. This
function works by transferring control to a more specialized function,
e.g. <code><a href="read.adp.nortek.html">read.adp.nortek()</a></code> and <code><a href="read.adp.sontek.html">read.adp.sontek()</a></code>,
and in many cases users will find it preferable to either use these or
the several even more specialized functions, if the file type is
known.</p>
    </div>

    <div class="section level2">
    <h2 id="ref-usage">Usage<a class="anchor" aria-label="anchor" href="#ref-usage"></a></h2>
    <div class="sourceCode"><pre class="sourceCode r"><code><span><span class="fu">read.adv.nortek</span><span class="op">(</span></span>
<span>  <span class="va">file</span>,</span>
<span>  from <span class="op">=</span> <span class="fl">1</span>,</span>
<span>  <span class="va">to</span>,</span>
<span>  by <span class="op">=</span> <span class="fl">1</span>,</span>
<span>  tz <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/options.html" class="external-link">getOption</a></span><span class="op">(</span><span class="st">"oceTz"</span><span class="op">)</span>,</span>
<span>  header <span class="op">=</span> <span class="cn">TRUE</span>,</span>
<span>  longitude <span class="op">=</span> <span class="cn">NA</span>,</span>
<span>  latitude <span class="op">=</span> <span class="cn">NA</span>,</span>
<span>  encoding <span class="op">=</span> <span class="cn">NA</span>,</span>
<span>  type <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"vector"</span>, <span class="st">"aquadopp"</span><span class="op">)</span>,</span>
<span>  haveAnalog1 <span class="op">=</span> <span class="cn">FALSE</span>,</span>
<span>  haveAnalog2 <span class="op">=</span> <span class="cn">FALSE</span>,</span>
<span>  debug <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/options.html" class="external-link">getOption</a></span><span class="op">(</span><span class="st">"oceDebug"</span><span class="op">)</span>,</span>
<span>  monitor <span class="op">=</span> <span class="cn">FALSE</span>,</span>
<span>  processingLog <span class="op">=</span> <span class="cn">NULL</span></span>
<span><span class="op">)</span></span></code></pre></div>
    </div>

    <div class="section level2">
    <h2 id="arguments">Arguments<a class="anchor" aria-label="anchor" href="#arguments"></a></h2>


<dl><dt id="arg-file">file<a class="anchor" aria-label="anchor" href="#arg-file"></a></dt>
<dd><p>a connection or a character string giving the name of the file
to load.  It is also possible to give <code>file</code> as a vector of filenames,
to handle the case of data split into files by a data logger.  In the
multi-file case, <code>header</code> must be <code>FALSE</code>, <code>start</code> must be a
vector of times, and <code>deltat</code> must be provided.</p></dd>


<dt id="arg-from">from<a class="anchor" aria-label="anchor" href="#arg-from"></a></dt>
<dd><p>index number of the first profile to be read, or the time of
that profile, as created with <code><a href="https://rdrr.io/r/base/as.POSIXlt.html" class="external-link">as.POSIXct()</a></code> (hint: use
<code>tz="UTC"</code>).  This argument is ignored if <code>header==FALSE</code>. See
“Examples”.</p></dd>


<dt id="arg-to">to<a class="anchor" aria-label="anchor" href="#arg-to"></a></dt>
<dd><p>indication of the last profile to read, in a format matching that
of <code>from</code>.  This is ignored if <code>header==FALSE</code>.</p></dd>


<dt id="arg-by">by<a class="anchor" aria-label="anchor" href="#arg-by"></a></dt>
<dd><p>an indication of the stride length to use while walking through
the file.  This is ignored if <code>header==FALSE</code>.  Otherwise, if this is
an integer, then <code>by-1</code> profiles are skipped between each pair of
profiles that is read. This may not make much sense, if the data are not
equi-spaced in time.  If <code>by</code> is a string representing a time interval,
in colon-separated format, then this interval is divided by the sampling
interval, to get the stride length. <em>BUG:</em> <code>by</code> only partially
works; see “Bugs”.</p></dd>


<dt id="arg-tz">tz<a class="anchor" aria-label="anchor" href="#arg-tz"></a></dt>
<dd><p>character string indicating time zone to be assumed in the data.</p></dd>


<dt id="arg-header">header<a class="anchor" aria-label="anchor" href="#arg-header"></a></dt>
<dd><p>A logical value indicating whether the file starts with a header.
(This will not be the case for files that are created by data loggers that
chop the raw data up into a series of sub-files, e.g. once per hour.)</p></dd>


<dt id="arg-longitude">longitude<a class="anchor" aria-label="anchor" href="#arg-longitude"></a></dt>
<dd><p>optional signed number indicating the longitude in degrees
East.</p></dd>


<dt id="arg-latitude">latitude<a class="anchor" aria-label="anchor" href="#arg-latitude"></a></dt>
<dd><p>optional signed number indicating the latitude in degrees
North.</p></dd>


<dt id="arg-encoding">encoding<a class="anchor" aria-label="anchor" href="#arg-encoding"></a></dt>
<dd><p>ignored.</p></dd>


<dt id="arg-type">type<a class="anchor" aria-label="anchor" href="#arg-type"></a></dt>
<dd><p>A string indicating which type of Nortek device produced the data file, <code>vector</code>
or <code>aquadopp</code>.</p></dd>


<dt id="arg-haveanalog-">haveAnalog1<a class="anchor" aria-label="anchor" href="#arg-haveanalog-"></a></dt>
<dd><p>A logical value indicating whether the data file has 'analog1' data.</p></dd>


<dt id="arg-haveanalog-">haveAnalog2<a class="anchor" aria-label="anchor" href="#arg-haveanalog-"></a></dt>
<dd><p>A logical value indicating whether the data file has 'analog2' data.</p></dd>


<dt id="arg-debug">debug<a class="anchor" aria-label="anchor" href="#arg-debug"></a></dt>
<dd><p>a flag that turns on debugging.  The value indicates the depth
within the call stack to which debugging applies.  For example,
<code>read.adv.nortek()</code> calls <code>read.header.nortek()</code>, so that
<code>read.adv.nortek(...,debug=2)</code> provides information about not just the
main body of the data file, but also the details of the header.</p></dd>


<dt id="arg-monitor">monitor<a class="anchor" aria-label="anchor" href="#arg-monitor"></a></dt>
<dd><p>boolean value indicating whether to indicate the progress
of reading the file, by using <code><a href="https://rdrr.io/r/utils/txtProgressBar.html" class="external-link">txtProgressBar()</a></code> or otherwise.  The value
of <code>monitor</code> is changed to <code>FALSE</code> automatically, for non-interactive
sessions.</p></dd>


<dt id="arg-processinglog">processingLog<a class="anchor" aria-label="anchor" href="#arg-processinglog"></a></dt>
<dd><p>if provided, the action item to be stored in the log.
This parameter is typically only provided for internal calls; the default
that it provides is better for normal calls by a user.</p></dd>

</dl></div>
    <div class="section level2">
    <h2 id="value">Value<a class="anchor" aria-label="anchor" href="#value"></a></h2>
    <p>An <a href="adv-class.html">adv</a> object that contains measurements made with an ADV device.</p>
<p>The <code>metadata</code> contains information as given in the following table.
The <code>Nortek name'' is the name used in the Nortek System Integrator Guide (reference 1) and the </code>Sontek name” is the name used in the relevant
Sontek documentation.  References are given in square brackets.</p>
<table class="table table"><tr><td><strong><code>metadata</code> name</strong></td><td><strong>Nortek name</strong></td><td><strong>Sontek name</strong></td><td><strong>Meaning</strong></td></tr><tr><td><code>manufacturer</code></td><td>-</td><td>-</td><td>Either <code>"nortek"</code> or <code>"sontek"</code></td></tr><tr><td><code>instrumentType</code></td><td>-</td><td>-</td><td>Either <code>"vector"</code> or <code>"adv"</code></td></tr><tr><td><code>filename</code></td><td>-</td><td>-</td><td>Name of data file(s)</td></tr><tr><td><code>latitude</code></td><td>-</td><td>-</td><td>Latitude of mooring (if applicable)</td></tr><tr><td><code>longitude</code></td><td>-</td><td>-</td><td>Longitude of mooring (if applicable)</td></tr><tr><td><code>numberOfSamples</code></td><td>-</td><td>-</td><td>Number of data samples in file</td></tr><tr><td><code>numberOfBeams</code></td><td>NBeams (reference 1, p18)</td><td>-</td><td>Number of beams (always 3)</td></tr><tr><td><code>numberOfBeamSequencesPerBurst</code></td><td>NPings</td><td>-</td><td>number of beam sequences per burst</td></tr><tr><td><code>measurementInterval</code></td><td>MeasInterval (reference 1 p31)</td><td>-</td><td></td></tr><tr><td><code>samplingRate</code></td><td>512/(AvgInterval) (reference 1 p30; reference 4)</td><td>- #'</td><td></td></tr></table><p>The <code>data</code> list contains items with names corresponding to <code>adp</code>
objects, with an exception for Nortek data.  Nortek instruments report some
things at a time interval that is longer than the velocity sampling, and
these are stored in <code>data</code> as <code>timeSlow</code>, <code>headingSlow</code>,
<code>pitchSlow</code>, <code>rollSlow</code>, and <code>temperatureSlow</code>; if burst
sampling was used, there will also be items <code>recordsBurst</code> and
<code>timeBurst</code>.</p>
<p>The <code>processingLog</code> is in the standard format.</p>
    </div>
    <div class="section level2">
    <h2 id="details">Details<a class="anchor" aria-label="anchor" href="#details"></a></h2>
    <p>Files <em>without</em> headers may be created in experiments in which a data
logger was set up to monitor the serial data stream from an instrument.  The
lack of header information places a burden on the user, who must supply such
basic information as the times of observations, the instrument orientation,
the instrument coordinate system, etc.  Example 3 below shows how to deal
with such files.  Three things should be noted.</p><ol><li><p>The user must choose the appropriate <code>read.adv</code> variant
corresponding to the instrument in question.  (This is necessary because
<code><a href="oceMagic.html">oceMagic()</a></code>, which is used by the generic <code><a href="read.oce.html">read.oce()</a></code>
routine, cannot determine the type of instrument by examining a file that
lacks a header.)</p></li>
<li><p>The call to the <code>read</code> function must include a start time
(<code>start</code>) and the number of seconds between data (<code>deltat</code>),
again, because the instrument data stream may lack those things when the
device is set to a serial mode.  Also, of course, it is necessary to set
<code>header=FALSE</code> in the function call.</p></li>
<li><p>Once the file has been read in, the user will be obliged to specify
other information, for the object to be well-formed.  For example, the
<code>read</code> function will have no way of knowing the instrument orientation,
the coordinate system being used, the transformation matrix to go from
<code>"beam"</code> to <code>"xyz"</code> coordinates, or the instrument heading, pitch,
and roll, to go from <code>"xyz"</code> coordinates to <code>"enu"</code> coordinates.
Such things are illustrated in example 3 below.</p></li>
</ol><p>In ADV 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 ADV object name <code>d</code>
with <code>d[["velocityMaximum"]]</code> and <code>d[["velocityResolution"]]</code>.</p>
    </div>
    <div class="section level2">
    <h2 id="nortek-files">Nortek files<a class="anchor" aria-label="anchor" href="#nortek-files"></a></h2>



<p><strong>Sampling-rate and similar issues</strong></p>
<p>The data format is inferred from the System Integrator Guide (reference 1A) and System
Integrator Manual (reference 1B).  These document lacks clarity in spots, and so
<code>read.adv.nortek</code> contains some assumptions that are noted here, so
that users will be aware of possible problems.</p>
<p>A prominent example is the specification of the sampling rate, stored in
<code>metadata$sampingRate</code> in the return value.  Repeated examination of
the System Integrator Guide (reference 1) failed to indicate where this value is
stored in the various headers contained in Vector datasets.  After some
experimentation with a few data files, <code>read.adv.nortek</code> was set up to
calculate <code>metadata$samplingRate</code> as <code>512/AvgInterval</code> where
<code>AvgInterval</code> is a part of the <code>User Configuration'' header (reference 1 p30), where the explanation is </code>average interval in seconds”).  This formula was
developed through trial and error, but it was confirmed later on the Nortek
discussion group, and it should appear in upcoming versions of (reference 1).</p>
<p>Another basic issue is the determination of whether an instrument had
recorded in continuous mode or burst mode.  One might infer that
<code>TimCtrlReg</code> in the <code>User Configuration'' header (reference 1 p30) determines this, in bits 1 and 2.  However, this was the case in test files available to the author.  For this reason, `read.adv.nortek` infers the mode by reverse engineering of data files of known configuration.  The present version of `read.adv.nortek` determines the sampling mode from the ```NRecords`'' item of the </code>Vector Velocity Data” header, which seems
to be 0 for data collected continuously, and non-zero for data collected in
bursts.</p>
<p>Taking these things together, we come upon the issue of how to infer
sampling times for Nortek instruments.  There do not seem to be definitive
documents on this, and so <code>read.adv.nortek</code> is based partly on
information (of unknown quality) found on Nortek discussion boards.  The
present version of <code>read.adv.nortek</code> infers the times of velocity
observations differently, depending on whether the instrument was set to
record in burst mode or continuous mode.  For burst mode, times stated in
the burst headers are used, but for continuous mode, times stated in the
“vector system data” are used.  On the advice found on a Nortek discussion
board, the burst-mode times are offset by 2 seconds to allow for the
instrument warm-up period.</p>
<p><strong>Handling IMU (inertial measurement unit) data</strong></p>
<p>Starting in March
2016, <code>read.adv.nortek</code> has offered some support for handling IMU
(inertial measurement unit) data incorporated into Nortek binary files. This
is not described in the Nortek document named <code>System Integrator Guide'' (reference 1A) but it appeared in </code>System Integrator Manual” (reference 1B;
reference 1C). Confusingly, 1B described 3 varieties of data, whereas 1C does not
describe any of these, but describes instead a fourth variety. As of March
2016, <code>read.adv.nortek</code> handles all 4 varieties, because files in the
various schemes appear to exist. In <code>oce</code>, the varieties are named
after the byte code that flags them.  (Variety <code>c3</code> is the one
described in (reference 1C); the others were described in (reference 1B).)
The variety is stored in the <code>metadata</code> slot of the returned object as
a string named <code>IMUtype</code>.</p>
<p>For each variety, the reader is cautioned that strong tests have not been
performed on the code.  One way to test the code is to compare with textual
data files produced by the Nortek software.  In March 2016, an <code>oce</code>
user shared a dataset of the <code>c3</code> variety, and this permitted detailed
comparison between the text file and the values inferred by
<code>read.adv.nortek</code>. The test suggested agreement (to within the
resolution printed in the text file) for velocity (<code>v</code> in the
<code>data</code> slot), signal amplitude (<code>a</code>), correlation (<code>q</code>),
pressure (<code>p</code>), the three components of IMU delta angle
(<code>IMUdeltaAngleX</code> etc), and all components of the rotation matrix
(<code>IMUrotation</code>).  However, the delta velocity signals did not match,
with <code>IMUdeltaVelocityX</code> disagreeing in the second decimal place,
<code>IMUdeltaVelocityY</code> component disagreeing in the first, and
<code>IMUdeltaVelocityZ</code> being out by a factor of about 10. This is github
issue 893 (<code>https://github.com/dankelley/oce/issues/893</code>).</p><ul><li><p>Variety <code>c3</code> (signalled by byte 5 of a sequence being
<code>0xc3</code>) provides information on what Nortek calls DeltaAngle,
DeltaVelocity and Orientation Matrix. (Apart from the orientation matrix,
Nortek provides no documentation on what these quantities mean.) In the
object returned by <code>read.adv.nortek</code>, these are stored in the
<code>data</code> slot as <code>IMUdeltaAngleX</code>, <code>IMUdeltaAngleY</code>,
<code>IMUdeltaAngleZ</code>, <code>IMUdeltaVelocityX</code>, <code>IMUdeltaVelocityY</code>,
<code>IMUdeltaVelocityZ</code>, and <code>IMUrotation</code>, all vectors except the
last, which is a 3D array. In addition to these, <code>IMUtimestamp</code> is a
time-stamp, which is not defined in the Nortek documents but seems, from IMU
documents (reference 5), to be defined based on a clock that ticks once per 16
microseconds. Caution may be required in dealing with this timestamp, since
it seemed sensible in one test case (variety <code>d3</code>) but kept reseting to
zero in another (variety <code>c3</code>). The lack of Nortek documentation on
most of these quantities is a roadblock to implementing <code>oce</code> functions
dealing with IMU-enabled datasets</p></li>
<li><p>Variety <code>cc</code> (signalled by byte 5 of a sequence being
<code>0xcc</code>) provides information on acceleration, angular rotation rate,
magnetic vector and orientation matrix.  Each is a timeseries. Acceleration
is stored in the <code>data</code> slot as <code>IMUaccelX</code>, <code>IMUaccelY</code>,
<code>IMUaccelz</code>. The angular rotation components are <code>IMUngrtX</code>,
<code>IMUngrtY</code> and <code>IMUngrtz</code>. The magnetic data are in
<code>IMUmagrtx</code>, <code>IMUmagrty</code> and <code>IMUmagrtz</code>. Finally,
<code>IMUmatrix</code> is a rotation matrix made up from elements named
<code>M11</code>, <code>M12</code>, etc in the Nortek documentation.  In addition to all
of these, <code>IMUtime</code> stores time in seconds, with an origin whose
definition is not stated in reference 1B.</p></li>
<li><p>Variety <code>d2</code> (signalled by byte 5 being <code>0xd2</code>) provides
information on gyro-stabilized acceleration, angular rate and magnetometer
vectors.  The data stored <code>MUaccelX</code>, <code>IMUangrtX</code>,
<code>IMUmagrtX</code>, with similar for <code>Y</code> and <code>Z</code>.  Again, time is in
<code>IMUtime</code>. This data type has not been tested as of mid-March 2016,
because the developers do not have a test file with which to test.</p></li>
<li><p>Variety <code>d3</code> (signalled by byte 5 being <code>0xd3</code>) provides
information on DeltaAngle, DeltaVelocity and magnetometer vectors, stored in
<code>IMUdeltaAngleX</code>, <code>IMUdeltaVelocityX</code>, and
<code>IMUdeltaMagVectorX</code>, with similar for <code>Y</code> and <code>Z</code>. Again,
time is in <code>IMUtime</code>. This data type has not been tested as of
mid-March 2016, because the developers do not have a test file with which to
test.</p></li>
</ul></div>
    <div class="section level2">
    <h2 id="how-the-binary-file-is-decoded">How the binary file is decoded<a class="anchor" aria-label="anchor" href="#how-the-binary-file-is-decoded"></a></h2>



<p>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.</p><ol><li><p>In R, <code><a href="https://rdrr.io/r/base/readBin.html" class="external-link">readBin()</a></code> is used to insert the file contents into
a <a href="https://rdrr.io/r/base/vector.html" class="external-link">vector</a> of type <code>raw</code>.</p></li>
<li><p>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 <a href="https://rdrr.io/r/base/vector.html" class="external-link">vector</a> of
type <code>integer</code>.</p></li>
<li><p>In R, <code><a href="https://rdrr.io/r/base/readBin.html" class="external-link">readBin()</a></code> 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><a href="https://rdrr.io/r/base/readBin.html" class="external-link">readBin()</a></code>. This process is done for each of the data
fields that are to be handled.  Importantly, these <code><a href="https://rdrr.io/r/base/readBin.html" class="external-link">readBin()</a></code>
calls are tailored to the data, using values of
the <code>size</code>, <code>endian</code> and <code>signed</code> 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.</p></li>
<li><p>Finally, in R, the acquired items are inserted into the <code>data</code> or
<code>metadata</code> slot of the return value, according to oce convention.</p></li>
</ol></div>
    <div class="section level2">
    <h2 id="references">References<a class="anchor" aria-label="anchor" href="#references"></a></h2>
    <p>1A. Nortek AS.  System Integrator Guide (paradopp family of products). June
2008.  (Doc No: PSI00-0101-0608).  (Users may find it helpful to also
examine newer versions of the guide.)</p>
<p>1B. Nortek AS.  System Integrator Manual. Dec 2014.
(<code>system-integrator-manual_Dec2014_jan.pdf</code>)</p>
<p>1C. Nortek AS.  System Integrator Manual. March 2016.
(<code>system-integrator-manual_Mar2016.pdf</code>)</p><ol><li><p>SonTek/YSI ADVField/Hydra Acoustic Doppler Velocimeter (Field) Technical
Documentation (Sept 1, 2001).</p></li>
<li><p>Appendix 2.2.3 of the Sontek ADV operation Manual, Firmware Version 4.0
(Oct 1997).</p></li>
<li><p>Nortek Knowledge Center (http://www.nortekusa.com/en/knowledge-center)</p></li>
<li><p>A document describing an IMU unit that seems to be close to the one named
in (references 1B and C) as being an adjunct to Nortek Vector systems is at
<code>http://files.microstrain.com/3DM-GX3-35-Data-Communications-Protocol.pdf</code></p></li>
</ol></div>
    <div class="section level2">
    <h2 id="see-also">See also<a class="anchor" aria-label="anchor" href="#see-also"></a></h2>
    <div class="dont-index"><p>Other things related to adv data:
<code><a href="sub-sub-adv-method.html">[[,adv-method</a></code>,
<code>[[&lt;-,adv-method</code>,
<code><a href="adv.html">adv</a></code>,
<code><a href="adv-class.html">adv-class</a></code>,
<code><a href="advSontekAdrFileTrim.html">advSontekAdrFileTrim</a>()</code>,
<code><a href="applyMagneticDeclination-adv-method.html">applyMagneticDeclination,adv-method</a></code>,
<code><a href="beamName.html">beamName</a>()</code>,
<code><a href="beamToXyz.html">beamToXyz</a>()</code>,
<code><a href="enuToOther.html">enuToOther</a>()</code>,
<code><a href="enuToOtherAdv.html">enuToOtherAdv</a>()</code>,
<code><a href="plot-adv-method.html">plot,adv-method</a></code>,
<code><a href="read.adv.html">read.adv</a>()</code>,
<code><a href="read.adv.sontek.adr.html">read.adv.sontek.adr</a>()</code>,
<code><a href="read.adv.sontek.serial.html">read.adv.sontek.serial</a>()</code>,
<code><a href="read.adv.sontek.text.html">read.adv.sontek.text</a>()</code>,
<code><a href="rotateAboutZ.html">rotateAboutZ</a>()</code>,
<code><a href="subset-adv-method.html">subset,adv-method</a></code>,
<code><a href="summary-adv-method.html">summary,adv-method</a></code>,
<code><a href="toEnu.html">toEnu</a>()</code>,
<code><a href="toEnuAdv.html">toEnuAdv</a>()</code>,
<code><a href="velocityStatistics.html">velocityStatistics</a>()</code>,
<code><a href="xyzToEnu.html">xyzToEnu</a>()</code>,
<code><a href="xyzToEnuAdv.html">xyzToEnuAdv</a>()</code></p></div>
    </div>
    <div class="section level2">
    <h2 id="author">Author<a class="anchor" aria-label="anchor" href="#author"></a></h2>
    <p>Dan Kelley</p>
    </div>

    <div class="section level2">
    <h2 id="ref-examples">Examples<a class="anchor" aria-label="anchor" href="#ref-examples"></a></h2>
    <div class="sourceCode"><pre class="sourceCode r"><code><span class="r-in"><span><span class="kw">if</span> <span class="op">(</span><span class="cn">FALSE</span><span class="op">)</span> <span class="op">{</span> <span class="co"># \dontrun{</span></span></span>
<span class="r-in"><span><span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">library</a></span><span class="op">(</span><span class="va"><a href="https://dankelley.github.io/oce/">oce</a></span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="co"># A nortek Vector file</span></span></span>
<span class="r-in"><span><span class="va">d</span> <span class="op">&lt;-</span> <span class="fu"><a href="read.oce.html">read.oce</a></span><span class="op">(</span><span class="st">"/data/archive/sleiwex/2008/moorings/m05/adv/nortek_1943/raw/adv_nortek_1943.vec"</span>,</span></span>
<span class="r-in"><span>              from<span class="op">=</span><span class="fu"><a href="https://rdrr.io/r/base/as.POSIXlt.html" class="external-link">as.POSIXct</a></span><span class="op">(</span><span class="st">"2008-06-26 00:00:00"</span>, tz<span class="op">=</span><span class="st">"UTC"</span><span class="op">)</span>,</span></span>
<span class="r-in"><span>              to<span class="op">=</span><span class="fu"><a href="https://rdrr.io/r/base/as.POSIXlt.html" class="external-link">as.POSIXct</a></span><span class="op">(</span><span class="st">"2008-06-26 00:00:10"</span>, tz<span class="op">=</span><span class="st">"UTC"</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/graphics/plot.default.html" class="external-link">plot</a></span><span class="op">(</span><span class="va">d</span>, which<span class="op">=</span><span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="fl">1</span><span class="op">:</span><span class="fl">3</span>,<span class="fl">15</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="op">}</span> <span class="co"># }</span></span></span>
</code></pre></div>
    </div>
  </main><aside class="col-md-3"><nav id="toc" aria-label="Table of contents"><h2>On this page</h2>
    </nav></aside></div>


    <footer><div class="pkgdown-footer-left">
  <p>Developed by Dan Kelley, Clark Richards.</p>
</div>

<div class="pkgdown-footer-right">
  <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.0.9000.</p>
</div>

    </footer></div>





  </body></html>

