merge_PPK

Description

merge_PPK is a utility designed to merge Post-Processed Kinematic (PPK) height data (derived from GPS observations) into OMG-HDCS merged files. It interpolates ellipsoidal heights from a binary PPK file to the timestamps of each ping in the merged file. It then uses known antenna-to-transducer offsets and interpolated vessel attitude (roll and pitch) to calculate the height of the transducer (Tx) at the reference point (RP).

This calculated RTK_at_RP height is then stored in the merged file, providing a precise vertical reference that accounts for both vessel motion and antenna offsets.

Usage

merge_PPK <OMG_HDCS_datafile(s)> -ppk <bin-file> [OPTIONS]

Arguments

Option Description  
<OMG_HDCS_datafile(s)> Required. One or more paths to input OMG-HDCS merged files. These files are modified in place.  
-ppk <bin-file> Required. Path to the binary PPK file (generated by binPPK).  
-verbose Enable verbose output.  
-longperiod <val> (Present in code but not implemented in main) Intended for filtering.  
-area <array.file> (Present in code but not implemented in main) Intended for area filtering.  
-merid <val> (Present in code but not implemented in main) Intended for UTM projection.  

How It Works

  1. Initialization: Defines OffsetX, OffsetY, OffsetZ as antenna-to-transducer offsets. Initializes PPK data structures.
  2. File Opening: Opens the binary PPK file (-ppk) for reading. Loops through each input OMG-HDCS merged file (<OMG_HDCS_datafile(s)>) and opens it for reading and writing (r+).
  3. Summary Header Reading: Reads the summary header from the merged file.
  4. PPK Data Processing:
    • For each ping in the merged file:
      • Reads the profile header to get its timestamp (time_merged_file).
      • Seeks through the ppk_file to find the two PPK records that bracket time_merged_file.
      • Height Interpolation: If time_merged_file falls between two PPK records, it calls do_interpolation to linearly interpolate the ellipsoidal height at time_merged_file.
      • Antenna-to-Transducer Height Calculation: It calls rotateZ to calculate Zant, the vertical distance from the antenna to the transducer, accounting for the vessel’s roll and pitch at the time of the ping.
      • RTK at RP Calculation: The RTK_at_RP is calculated as (interpolated_height - Zant). This value (scaled by 100) is stored in profile.RTK_at_RP.
      • The profile.Lowpass_RTK_at_RP is currently set to 0.
      • Write Back: The modified profile header (with updated RTK_at_RP) is written back to the merged file.
  5. Cleanup: Closes all open files.

Output Files

The input merged files are modified in-place, with the RTK_at_RP field in each profile header updated.

Helper Functions

  • ppk_read(): Reads a PPK_structure from the binary PPK file at a specified record number, handling byte-swapping.
  • rotateZ(): Calculates the vertical offset (Zant) between the antenna and the transducer, considering the antenna’s static offsets (OffsetX, OffsetY, OffsetZ) and the vessel’s dynamic roll and pitch.
  • do_interpolation(): Performs linear interpolation of height between two PPK records based on their timestamps.

Dependencies

  • OMG_HDCS_jversion.h: For OMG-HDCS data structures.
  • support.h: For general utility functions and error handling.
  • PPK_nav.h: For PPK data structures and ppk_read function.

Notes

Merging PPK data is essential for accurate vertical control in hydrographic surveys, especially for correcting for dynamic vessel motion and antenna offsets. The calculated RTK_at_RP provides a precise ellipsoidal height reference for the sonar transducer. This tool modifies merged files in place, so backups are recommended. The longperiod, area, and merid options are listed in the usage but not implemented in the current code.