mvp2hips
Overview
mvp2hips (code/hips_goodies/mvp2hips.c) is a command-line sound velocity profile conversion utility authored by Jason Bartlett (Canadian Hydrographic Service, Burlington, March 2005). It reads a calculated Moving Vessel Profiler (MVP) ASCII cast file (conventionally named with a c suffix, such as jul08.001c) and converts it into a CARIS HIPS .svp Version 2 sound velocity profile file.
During underway multibeam hydrographic surveys, an MVP free-fall fish measures pressure/depth, sound velocity, and temperature while the survey vessel is steaming. The MVP controller software outputs a calculated profile header containing the cast date (CALC, DATE, TIME), a tabular block of depth, sound speed, and temperature observations, and a trailing NMEA $GPGGA sentence recording the geographic coordinates of the cast. mvp2hips extracts these metadata fields and sound speed samples and formats them into a CARIS HIPS Section record.
Usage
mvp2hips <input.001c> <output.svp>
[!WARNING] Command-Line Argument Check Quirk (
argc != 2): Incode/hips_goodies/mvp2hips.c(line 23), the argument count check is written asif (argc != 2)before opening bothargv[1](input file) andargv[2](output file). Becauseargcincludes the program name (argv[0]), passing two filename arguments results inargc == 3, which triggers the usage message and exits unlessmvp2hips.cis patched toif (argc != 3).
Internal Parsing Pipeline & Data Structures
mvp2hips allocates three static 2,000-element floating-point arrays on the stack to buffer the cast:
| Buffer / Variable | Type | Description |
|---|---|---|
depth[2000] | float[2000] | Sample depth in meters parsed via atof(&string[0]) from column 1 of each cast row. |
speed[2000] | float[2000] | Calculated sound velocity in m/s parsed from token 1 (strtok(string, " ")). |
temp[2000] | float[2000] | Water temperature in °C parsed from token 2 (strtok(0, " ")). |
year, JD, time | int | Cast year (offset +16 after "CALC" on line 1), Julian Day (offset +7 after "DATE" on line 3), and HHMM timestamp (offset +5 after "TIME" on line 3). |
Lat, Long | double | Raw NMEA $GPGGA latitude (DDMM.MMMM, token 1) and longitude (DDDMM.MMMM, token 3) from the $-prefixed trailer line. |
Step-by-Step Conversion Logic
- Header Date & Time Extraction:
- Reads line 1 (
fgets), locates"CALC"viastrstr(), advances 16 bytes, and parsesyear = atoi(tester). - Skips line 2, reads line 3, locates
"DATE"(+7 bytes) forJD(Julian Day) and"TIME"(+5 bytes) fortime(HHMM), splittingtimeinto hours (a = time / 100) and minutes (c = (int)b + 1).
- Reads line 1 (
- Depth / Sound Speed Table Scan:
- Skips 2 additional header lines and loops until a line starting with
'$'(the NMEA$GPGGAtrailer) is encountered. - Populates
depth[j],speed[j], andtemp[j]for up to 2,000 depth levels.
- Skips 2 additional header lines and loops until a line starting with
- NMEA
$GPGGACoordinate Conversion:- Tokenizes the
$-prefixed line on commas (,) to extractLatandLongin NMEADDMM.MMMMformat, then decomposes them into integer degrees, minutes, and seconds (e:g:lfor Latitude,f:h:kfor Longitude, withf = -(int)Long / 100for West longitude).
- Tokenizes the
- CARIS
.svpOutput Generation:- Writes the header
SVP_VERISON_2(note the historic spelling in source line 99),F:, andSection <year>-<JD> <HH>:<MM>:00 <LatD>:<LatM>:<LatS> <LonD>:<LonM>:<LonS>, followed by%0.2f %0.2fdepth and sound speed pairs for all non-zero sound speed samples.
- Writes the header
Architectural Fit
Alongside heli2caris, mvp2hips supports multi-software hydrographic processing environments where MVP casts collected during OMG/UNB multibeam operations must also be imported into CARIS HIPS project vessel configurations.