splitOMG
Description
splitOMG is a utility designed to extract a subset of profiles (pings) from an OMG-HDCS merged file into a new merged file. It can split files based on either a numerical range of profiles or a time-based range.
Additionally, it has a specialized mode (-into_natural_lines) to analyze the vessel’s speed and change in heading between pings, which can be used to identify natural line breaks in survey data.
Usage
splitOMG <OMG_HDCS_infile> <OMG_HDCS_outfile> [OPTIONS]
Arguments
| Option | Description |
|---|---|
<OMG_HDCS_infile> | Required. The path to the input OMG-HDCS merged file. |
<OMG_HDCS_outfile> | Required. The path for the new output OMG-HDCS merged file containing the subset of data. |
Splitting Options (Choose one or more)
| Option | Description | |—|—| | -first <ping_num> | Specifies the starting ping number (inclusive) for the subset. | | -last <ping_num> | Specifies the ending ping number (inclusive) for the subset. | | -time_start <year> <jday> <hr> <min> <sec> | Specifies a date and time range for the subset. The tool will find the corresponding ping numbers. | | -time_end <year> <jday> <hr> <min> <sec> | Specifies a date and time range for the subset. The tool will find the corresponding ping numbers. |
Analysis Option
| Option | Description | |—|—| | -into_natural_lines | Instead of splitting, this mode calculates and outputs the vessel’s speed (in knots) and change in heading (in degrees) between consecutive pings. The output is an ASCII file (<OMG_HDCS_outfile>) with ping number, speed, and dhead. This option overrides the splitting functionality. | | -minknots | (Present in USAGE but not implemented) Likely intended to filter based on minimum speed. | | -minturn | (Present in USAGE but not implemented) Likely intended to filter based on minimum turn. |
Other Options
| Option | Description | |—|—| | -v | Enable verbose output. | |
How It Works
- Input Reading: Opens the input merged file and reads its summary header.
into_natural_linesMode:- If
-into_natural_linesis specified, the tool allocates memory forspeed_knotsanddheadarrays. - It iterates through each ping (from 1 to
numProfiles - 1):- It reads the current and previous profile headers.
- It locates the transducer position for both pings.
- Calculates the geographic distance and time difference between the two ping positions.
- Computes the vessel’s speed in knots (
speed_knots) and the change in heading (dhead) between the pings.
- It then writes these calculated speed and heading change values (ping number, speed_knots, dhead) to the specified
OMG_HDCS_outfileas an ASCII listing.
- If
- Splitting Mode (Default):
- If
into_natural_linesis not specified, the tool determines thefirstandlastping numbers for the subset. This can be directly from-first/-lastoptions or by performing a time-based search usingOMG_HDCS_time_searchif-time_start/-time_endare provided. - It performs error checks to ensure the
firstandlastping numbers are valid. - A new output merged file (
OMG_HDCS_outfile) is created. - The summary header from the input file is modified to reflect the new
numProfiles(i.e.,last - first) and then written to the output file. - It then iterates from
firsttolast - 1in the input file:- Reads the profile header and raw beams for the current ping.
- Writes these profile and beam data to the new output merged file.
- If
- Cleanup: Closes all open files.
Output Files
<OMG_HDCS_outfile>: A new OMG-HDCS merged file containing the subset of data (if splitting) or an ASCII file with speed and heading change (if-into_natural_linesis used).
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
splitOMG is a versatile tool for managing merged data, allowing for either precise extraction of subsets for further processing or for analysis of survey line characteristics. The -into_natural_lines mode is particularly useful for quality control, helping to identify turns or changes in vessel speed. The tool always creates a new output file, preserving the integrity of the original. The -minknots and -minturn options are listed in the usage but not implemented.