filterPPK
Description
filterPPK is a utility designed to process and filter RTK (Real-Time Kinematic) heave data, specifically the RTK_at_RP (RTK height at Reference Point) field stored in OMG-HDCS merged files. It applies a low-pass filter (cosine-squared tapered weighted average) to this RTK height data to extract the long-period heave component.
The tool aims to separate the short-period heave (swell) from the long-period heave (tide and any residual vertical datum issues) for more accurate data processing. The filtered long-period heave is then outputted, and the high-pass filtered component could theoretically represent the swell heave.
Usage
filterPPK <OMG_HDCS_datafile(s)> [-out <ASCII_filename>] [-longperiod <val>] [-verbose]
Arguments
| Option | Description | Default / Example |
|---|---|---|
<OMG_HDCS_datafile(s)> | Required. One or more paths to input OMG-HDCS merged files. | survey_data.merged |
-out <ASCII_filename> | Required. The path for the output ASCII file (contains filtered RTK heights and timestamps). | filtered_rtk.txt |
-longperiod <val> | Specifies the half-width of the cosine-squared tapered low-pass filter (in seconds). This effectively controls the cutoff frequency of the filter. | 15.0 |
-verbose | Enable verbose output. |
How It Works
- File Processing: The tool iterates through each provided merged file.
- Summary Header Reading: Reads the summary header from the merged file.
- Memory Allocation: Allocates memory for
longperiod_heave,RTK_at_RP,filtRTKatRP,heave,highpassHeave,TtimE(timestamps), andweightarrays. - Data Extraction & Filtering: Loops through each profile (ping) in the merged file:
- Reads the
profileheader. - Extracts
profile.RTK_at_RP(scaled by 100.0) intoRTKatRP[k]. - Extracts the Unix timestamp (
TtimE[k]) from the profile. - Low-Pass Filter Application: Applies a cosine-squared tapered weighted average filter to
RTKatRPvalues:- For each ping
k, it calculates a weighted sum ofRTKatRPvalues from surrounding pings within thelongperiod(time window) using a cosine-squared taper. - This weighted sum, divided by the total weight, gives the
filtRTKatRP[k], which represents the low-pass filtered (long-period) heave. - The
highpassHeave[k](swell component) is calculated asheave[k] - longperiod_heave[k](thoughheave[k]andlongperiod_heave[k]aren’t clearly populated from original merged file data in the provided snippet, implying they might be internal calculations or zero-initialized).
- For each ping
- Reads the
- Output to ASCII File: For each ping, it prints the Unix timestamp (
TtimE[k]) and the low-pass filtered RTK height (filtRTKatRP[k]) to the output ASCII file. - Cleanup: Frees allocated memory and closes files.
Output Files
<ASCII_filename>: An ASCII file containing timestamps and filtered RTK heights.
Dependencies
OMG_HDCS_jversion.h: For OMG-HDCS data structures.support.h: For general utility functions and error handling.math.h: For mathematical functions.
Notes
The RTK_at_RP field often contains high-frequency heave noise along with the desired long-period tide component. This tool separates these components using a spectral filter, which is crucial for applying accurate vertical datum corrections in hydrographic surveys. The terms heave and highpassHeave in the code are noted as potentially confusing; RTKatRP (from profile.RTK_at_RP) is the primary input.