mergeAltitude
Description
mergeAltitude is a utility designed to merge external ASCII altitude data (e.g., from an aerial survey or kinematic GPS) into OMG-HDCS merged files, specifically linking altitude measurements to the geographic positions of individual multibeam soundings.
The tool interpolates altitude values from the ASCII altitude file to match the timestamp of each beam’s bottom strike in the merged file and outputs these merged geographic and altitude data to an ASCII file.
Usage
mergeAltitude -in <merged_file(s)> -alt <altitude_file.ascii(s)> -out <ASCII_filename> [-v]
Arguments
| Option | Description | |
|---|---|---|
-in <merged_file(s)> | Required. One or more paths to input OMG-HDCS merged files. | |
-alt <altitude_file.ascii(s)> | Required. One or more paths to ASCII altitude files. Each file is expected to contain two columns: timestamp (double) and altitude (double). | |
-out <ASCII_filename> | Required. The path for the output ASCII file, which will contain merged geographic (lat/lon) and altitude data. | |
-v | Enable verbose output. |
How It Works
- Initialization: Initializes global variables, including
verbose_flag, file handles, and counters. - Argument Parsing: Parses command-line arguments to get input merged filenames, altitude filenames, and the output filename.
- Altitude Data Reading:
- Iterates through each specified ASCII altitude file (
-alt). - Reads
timestampandaltitudevalues from each line and stores them into a 2D arrayalt[2][...]. - Calculates the mean altitude (
mean_alt) from all altitude data.
- Iterates through each specified ASCII altitude file (
- Merged File Processing: Loops through each input merged file (
-in):- Opens the merged file for reading (
r+). - Reads the summary header.
- Profile and Beam Iteration: Loops through each profile (ping) in the merged file, and then through each beam within that profile:
- Reads the current profile header and raw beams.
- If
beams[k].observedDepthis valid:- Timestamp Calculation: Calculates a precise timestamp (
pasted) for the current beam’s bottom strike usingprofile.laser_timestampRefandbeams[k].timestampOffset. - Geographic Positioning: Locates the beam’s geographic position (
lat,lon) usinglocate_beam. - Altitude Interpolation/Lookup: Iterates through the loaded altitude data (
altarray) to find the two altitude records that bracketpasted. - Output to ASCII: If bracketing altitude records are found, it prints the
lat,lon, and interpolated/closestaltitude(alt[1][n]) to the output ASCII file.
- Timestamp Calculation: Calculates a precise timestamp (
- Opens the merged file for reading (
- Cleanup: Closes all open files.
Output Files
<ASCII_filename>: An ASCII file containinglatitude,longitude, andaltitudefor each beam with a valid altitude lookup.
Dependencies
OMG_HDCS_jversion.h: For OMG-HDCS data structures.support.h: For general utility functions and error handling.j_proj.h: For coordinate projection functions.
Notes
This tool is used to integrate external altitude data with multibeam soundings, providing a comprehensive vertical reference. This is critical for applications that require precise heights, such as mapping features above or near the water surface using laser bathymetry. The interpolation ensures that altitude values are accurately synchronized with each individual sounding.