plotDelayHeave
Description
plotDelayHeave is a specialized plotting utility designed to visualize delayed heave data, typically generated from post-processing POS/MV output (e.g., Applanix). It processes various time-series heave data (real-time, post-processed, high-pass filtered, and their differences) and plots them, along with indicating the extent of associated multibeam merged files.
The tool calculates and displays differences between different heave measurements, performs trend removal, and can apply high-pass filters, all crucial for analyzing and correcting vertical motion in hydrographic surveys. It is designed to handle large datasets by dumping intermediate results to disk.
Usage
plotDelayHeave -infile <base_name> [-outfile <filename.meta>] [-size <dx> <dy>] [-start <yr> <jday> <hr> <min>] [-end <yr> <jday> <hr> <min>] [-xrange <min> <max>] [-dep] [-atten <val>] [-delay <val>] [-skip <val>] <merged_file(s)...>
Arguments
| Option | Description | |
|---|---|---|
-infile <base_name> | Required. Specifies a base name for binary time series files (e.g., rt_hv_base_name.out, vp_base_name.out, etc.). | |
-outfile <filename.meta> | Specifies the output PostScript metafile name. | plot.meta |
-size <dx> <dy> | Specifies the plot size in centimeters. | 20.0 18.0 |
-start <yr> <jday> <hr> <min> | Sets the start time (X-axis minimum) for the plot. | |
-end <yr> <jday> <hr> <min> | Sets the end time (X-axis maximum) for the plot. | |
-xrange <min> <max> | Sets the X-axis range (seconds from epoch). Overrides -start and -end. | |
-dep | (Present in USAGE, but not used in provided snippet.) Intended for displaying depths. | |
-atten <val> | Attenuation factor to apply to heave data. | 1.0 |
-delay <val> | Time delay in minutes to apply to heave data. | 0.0 |
-skip <val> | Skip factor for plotting data points. | 5 |
<merged_file(s)...> | (Optional) One or more merged files. Their time extents will be indicated on the plot. |
Data Files Generated/Used by -infile <base_name>
rt_hv_<base_name>.out: Real-time heave data.vp_<base_name>.out: Vertical position data.pp_hv_<base_name>.out: Post-processed heave data.deri_<base_name>.rt-pp: Difference between real-time and post-processed heave.deri_<base_name>.rt-pp_detrend: Detrended difference between real-time and post-processed heave.deri_<base_name>.hpf_of_vp: High-pass filtered vertical position.deri_<base_name>.rt-hpf_of_vp: Real-time heave minus high-pass filtered vertical position.deri_<base_name>.vp_detrend: Detrended vertical position.
How It Works
- Initialization: Parses command-line arguments, setting input/output filenames, plot ranges, and processing flags.
- File Naming: Constructs filenames for various heave data streams based on the
-infilebase name. - Plot Setup: Initializes the
plotlibPostScript output (plot.meta). Sets up the overall plot dimensions (xlength,ylength,xoff). - Plot Areas: Divides the plotting area into 8 vertical subplots, each for a different heave data type.
- Heave Data Processing Loop: For each of the 8 plots:
- Data Loading (
suck_in_data): Reads binary time-series data (timestamp and value) from the respective file intoheave_data[i]. - Data Derivation:
- Plot 3 (
deri_...rt-pp): Calculates the difference betweenheave_data[0](real-time heave) andheave_data[2](post-processed heave). Applies a least-squares detrending toheave_data[2]before differencing. - Plot 4 (
deri_...rt-pp_detrend): Calculates the difference betweenheave_data[3](detrended post-processed heave) andheave_data[0](real-time heave), with an alignment shift. - Plot 5 (
deri_...hpf_of_vp): Applies a simple 1500-point boxcar high-pass filter toheave_data[1](vertical position). - Plot 6 (
deri_...rt-hpf_of_vp): Calculates the difference betweenheave_data[5](high-pass filtered vertical position) andheave_data[0](real-time heave). - Plot 7 (
deri_...vp_detrend): Applies a least-squares detrending toheave_data[1](vertical position).
- Plot 3 (
- Data Dumping (
dump_out_data): Writes processed data to intermediate binary files. - X-axis Range Determination: Sets
xminandxmaxbased on the time extents of the data, or user-provided-start,-end, or-xrange. - Y-axis Range Determination: Calculates
ymin[i]andymax[i]from the loaded data and then prompts the user for interactive input. - Plotting Data: Plots the time-series data for the current plot
i.
- Data Loading (
- Merged File Extent Plotting: If merged files (
.merged) are provided, it reads their summary headers, extracts their time extents, and indicates these extents as rectangular boxes on the plot. - Cleanup: Frees allocated memory and closes all files.
Output Files
<outfile_name>: A PostScript metafile (.meta) containing time-series plots of heave data.- Multiple intermediate binary files (e.g.,
rt_hv_<base_name>.out,deri_<base_name>.rt-pp, etc.) storing processed heave data.
Helper Functions
suck_in_data(int i, int *num): Reads a binary time-series (double timestamp, double value) fromname[i]intoheave_data[i].suck_in_quarter_data(int i, int *num): Reads data fromname[i], taking only every 4th record (not actively used inmainas written).dump_out_data(int i, int num): Writes a binary time-series (double timestamp, double value) fromheave_data[i]toname[i].
Dependencies
plotlib.h: Forplotlibfunctions.support.h: For general utility functions.stdtime.h: For time conversion.OMG_HDCS_jversion.h: For merged file structures.
Notes
plotDelayHeave is a critical tool for quality control and analysis of vertical motion data, particularly for assessing the performance of different heave measurement systems (e.g., real-time vs. post-processed). The ability to visualize differences and apply filters helps in identifying residual errors that can affect bathymetric accuracy. The tool relies on specific binary data formats for the heave components.