hypack2nav
Description
hypack2nav converts ASCII HYPACK singlebeam/multibeam raw survey logs (.RAW) into the standard 48-byte binary OMG navigation format (.nav, jcu_nav_rec).
It parses HYPACK TND (Time and Date) header lines to establish the survey dayβs UTC epoch (stdtime_from_dmy) and extracts time-of-day and geographic coordinates from RAW (Raw Position) sentences, converting packed NMEA-style DDDMM.MMMM coordinates into decimal degrees via GGA2NAV().
Usage
hypack2nav [-v] <infile> <navfile>
Common Workflow Examples
1. Convert a HYPACK .RAW log file to an OMG binary .nav file:
hypack2nav 001_1430.RAW 001_1430.nav
2. Convert and inspect the resulting binary navigation file:
hypack2nav -v survey_line1.RAW survey_line1.nav
navedit -check survey_line1.nav
Arguments
| Option | Description | Default |
|---|---|---|
<infile> | Required. Input ASCII HYPACK .RAW log file containing TND and RAW records. | None |
<navfile> | Required. Output binary .nav filename (jcu_nav_rec format, opened as "wb+"). Must immediately follow <infile>. | None |
-v | Increment verbose flag (verbose_flag++). | Disabled |
[!NOTE] Positional arguments
<infile>and<navfile>are parsed as a pair in a single loop iteration: the first non-flag argument is assigned toinnameand the immediately following argument is assigned tonavname. Place-vbefore<infile> <navfile>.
Input & Output Formats
Input HYPACK .RAW ASCII Records
hypack2nav scans each line (up to 255 characters) for two HYPACK record identifiers:
-
TND(Time and Date Header):TND HH:MM:SS MM/DD/YYYY- Characters at fixed offsets
&date[13](month),&date[16](day), and&date[19](year) are converted viaatoi()and passed tostdtime_from_dmy(day, month, year)to compute the base Unix timestamp (seconds) at00:00:00 UTCof the survey date.
- Characters at fixed offsets
-
RAW(Raw Device Position Record):RAW <dev_id> <sec_of_day> <num_vals> <lat_DDDMM_MMMM> <lon_DDDMM_MMMM> ...- Tokenized by spaces (
strtok(string, " ")):- Token
i == 1(3rd field overall):sec_of_day(integer seconds since midnight). - Token
i == 3(5th field overall): packed latitude (DDDMMSS/100 * DDMM.MMMMconvention). - Token
i == 4(6th field overall): packed longitude (DDDMMSS/100 * DDDMM.MMMMconvention).
- Token
- Tokenized by spaces (
Output Binary .nav (jcu_nav_rec)
For each unique 1-second timestamp (sec_of_day != time_test || sec_of_day == 0), a 48-byte jcu_nav_rec is written:
lat,lon: Decimal degrees converted byGGA2NAV().time:seconds + sec_of_day(Unix epoch seconds since Jan 1, 1970).centisecs,azi,depth,velocity,flag[0..3]: Initialized to0.
How It Works
- Date Initialization (
TND): Reads the input file line by line withfgets(). Whenever aTNDsubstring is encountered, updatesseconds = stdtime_from_dmy(day, month, year). - Coordinate Unpacking (
GGA2NAV): When aRAWsubstring is encountered, extracts the packed latitude and longitude values and converts them to decimal degrees:- Degrees are extracted as
a = (int)(value / 10000). - Whole minutes are extracted as
b = (int)(((value / 10000) - deg) * 100). - Fractional minutes are extracted as
(value / 100) - (int)(value / 100)and combined withb, divided by60.0, and added to (or subtracted from, for negative longitudes wheresign == 1)deg.
- Degrees are extracted as
- 1-Hz Deduplication Filter: Compares
sec_of_dayagainst the previous recordβstime_test. Only writes a newjcu_nav_recvianav_write()whensec_of_day != time_test(orsec_of_day == 0), filtering sub-second duplicate timestamps to 1-Hz intervals.