.if n .ds Q \&"
.if t .ds Q ``
.if n .ds U \&"
.if t .ds U ''
.TH nav_hdg 1 "CODAS Utilities" "GFI"
.tr \&
.nr bi 0
.nr ll 0
.nr el 0
.de DS
..
.de DE
..
.de Pp
.ie \\n(ll>0 \{\
.ie \\n(bi=1 \{\
.nr bi 0
.if \\n(t\\n(ll=0 \{.IP \\(bu\}
.if \\n(t\\n(ll=1 \{.IP \\n+(e\\n(el.\}
.\}
.el .sp
.\}
.el \{\
.ie \\nh=1 \{\
.LP
.nr h 0
.\}
.el .PP
.\}
..
.SH NAME

.Pp
\fBnav_hdg\fP - Generates heading correction from navigation files

.SH USAGE

.Pp
\fBnav_hdg\fP \fIcontrol_file\fP

.SH DESCRIPTION

.Pp
This utility scans the NMEA navigation files and an ADCP CODAS database
to generate an ASCII output file with the following columns:

.nr ll +1
.nr el +1
.nr t\n(ll 1
.nr e\n(el 0 1
.af e\n(el \*(f\n(el
.if \n(ll>1 .RS
.nr bi 1
.Pp
ADCP profile time in decimal days
.nr bi 1
.Pp
Database heading - Navigation mean heading
.nr bi 1
.Pp
Database heading
.nr bi 1
.Pp
Navigation mean heading
.nr bi 1
.Pp
Standard deviation of navigation heading
.nr bi 1
.Pp
Number of points used to calculate the navigation heading

.if \n(ll>1 .RE
.nr el -1
.nr ll -1


.Pp
This file is for input in parameter \fBANGLE_FILE\fP for the
\fBrotate\fP utility which corrects heading values stored in a
CODAS database. This utility was written for a dataset collected
during a cruise where GPS heading from a Seapath 200 (HDT string)
was logged at a high sampling rate separately together with all other
navigation NMEA messages, while heading logged together with ADCP
data was from a gyro compass.

.SH PARAMETERS

.Pp
The control file must define the following parameters:

.nr ll +1
.nr t\n(ll 2
.if \n(ll>1 .RS
.IP "\fBdbname:\fP \fIname\fP"
.nr bi 1
.Pp
Name of database (with path) containing heading data to be
corrected.

.IP "\fBnav_list:\fP \fIfile\fP"
.nr bi 1
.Pp
Name of file (with path) containing list of all navigation files
to parse sequentially for heading data. Comments following the
C-syntax are allowed in this file.

.IP "\fBout_file:\fP \fIfile\fP"
.nr bi 1
.Pp
Name of output file, with path.

.IP "\fBfirst_time\fP \fIYYYY/MM/DD\fP \fIhh:mm:ss\fP"
.nr bi 1
.Pp
This parameter is required because some NMEA messages containing
time information, such as the GGA message, do not provide the
full date. The given year is taken as the year base for
conversion of time into decimal days. Furthermore, it is assumed
that database profile times are given for the end of profiles.
Hence, full first time information is required to perform
heading statistics for the first ensemble.
as

.IP "\fBdb_hdg_from:\fP \fIkeyword\fP
"
.nr bi 1
.Pp
Heading information can be stored in different variables within
a CODAS database. This parameter specifies which variable to
read for heading corrections. The following keywords are
implemented:

.nr ll +1
.nr t\n(ll 2
.if \n(ll>1 .RS
.IP "\fBmean_heading\fP"
.nr bi 1
.Pp
Read heading data from element \fBmn_heading\fP in the
\fBANCILLARY_1\fP structure.

.IP "\fBlast_heading\fP"
.nr bi 1
.Pp
Read heading data from element \fBlast_heading\fP in the
\fBANCILLARY_2\fP structure.

.if \n(ll>1 .RE
.nr ll -1


.if \n(ll>1 .RE
.nr ll -1


.SH OPTIONS

.Pp
In addition to the parameters listed above, the following options
are available:

.nr ll +1
.nr t\n(ll 2
.if \n(ll>1 .RS
.IP "\fBOPTIONS:\fP \fI\fP"
.nr bi 1
.Pp
This key word can be used to improve the clarity of the control
file and specify the beginning of options. It has no effect.

.IP "\fBnav_messages:\fP \fI\fP"
.nr bi 1
.Pp
Select which navigation messages to parse. One should mention
at least one message containing time and another one
with heading information. All other messages are not necessary.
Unselected messages will be considered as bad navigation lines.
Possible keywords are:

.nr ll +1
.nr t\n(ll 2
.if \n(ll>1 .RS
.IP "\fBTRANSECT\fP \fI\fP"
.nr bi 1
.Pp
.IP "\fBZDA\fP \fI\fP"
.nr bi 1
.Pp
.IP "\fBGGA\fP \fI\fP"
.nr bi 1
.Pp
.IP "\fBHDT\fP \fI\fP"
.nr bi 1
.Pp
.IP "\fBPRDID\fP \fI\fP"
.nr bi 1
.Pp
.IP "\fBVTG\fP \fI\fP"
.nr bi 1
.Pp
.IP "\fBend\fP \fI\fP"
.nr bi 1
.Pp
This keyword is mandatory and closes the selected list of
NMEA messages to parse.

.if \n(ll>1 .RE
.nr ll -1


.Pp
In addition, the keyword \fBALL\fP will select all the keywords
appearing in the above list. To deselect some specific parameters,
prefix the undesired keyword with character \fB!\fP.
.Pp
WARNING:

.br
.po 0.75i
.ll 6.0i
.nr LL 6.0i
.LP
Avoid specifying more than one message containing time
information, because these do sometime differ slightly. In the
case of \fBZDA\fP and \fBGGA\fP messages, if the latter
has a slightly earlier time, the whole date will be set to the
next day.

.br
.po 0.25i
.ll 7.0i
.nr LL 7.0i
.LP


.IP "\fBskip_nav_lines:\fP \fIn\fP"
.nr bi 1
.Pp
Number of navigation lines to skip when a bad input navigation
line is encountered. This is mainly for situations where the
navigation device hangs up and needs a reset: time and position
information is usually wrong during a couple of seconds
(typically 30 to 60 seconds). Hence, the number of line to skip
in such a situation will depend on the navigation sampling
frequency.

.IP "\fBend\fP \fI\fP"
.nr bi 1
.Pp
This keyword is mandatory and terminates the list of selected
options.

.if \n(ll>1 .RE
.nr ll -1


.SH TIME RANGES

.Pp
Finally, the control file is terminated by a list of time ranges.
See \fBtime_rng\fP(5) for the syntax of these.

.SH OUTPUT FILES

.Pp
The file specified in parameter \fBout_file\fP.

.SH AUTHOR

.Pp
Pierre Jaccard, Geophysical Institute, University of Bergen, 1999
