7k2omg
Description
7k2omg is a utility designed to convert Reson 7k (.s7k) data files into the OMG-HDCS (Ocean Mapping Group - Hydrographic Data Conversion System) merged file format. This tool extracts bathymetry, sonar settings, snippet, and watercolumn data from .s7k files and maps them to the corresponding structures in the OMG-HDCS format.
It supports both old and new 7k bathymetry and snippet packet types, handles various Reson sonar models, and provides options for ignoring specific data types, forcing old packet usage, and dealing with dual-head sonar systems. The output merged file is a foundational format for further processing and visualization within the OMG toolkit.
Usage
7k2omg -s7k <input_name> -omg <omg_file_prefix> [-sonar <type>] [OPTIONS]
Arguments
| Option | Description | |—|—| | -s7k <input_name> | Required. Path to the input Reson 7k .s7k file. | | -omg <omg_file_prefix> | Required. Prefix for the output OMG-HDCS files. The tool will generate: * <omg_file_prefix>.merged: The main OMG-HDCS merged file. * <omg_file_prefix>.merged.ss_data: Snippet side-scan data (if not ignored). * <omg_file_prefix>.sonar_settings: Binary file containing 7k Sonar Settings and Remote Control Settings. * <omg_file_prefix>.watercol: Watercolumn data (if not ignored). | | -sonar [7125|7111|7101|7150|7160|20 (for T20P)] | Specifies the Reson sonar model. | | -v | Enable verbose output. | | -debug | Enable debug output. | | -ignore_flags | Ignores quality flags, treating all beams as valid. | | -ignore_snippets | Skips processing and writing of snippet data. | | -ignore_watercolumn | Skips processing and writing of watercolumn data. | | -dual_head | Stores the system identifier in the profile mode field, useful for dual-head systems. | | -force_old_bathy | Forces the use of old bathymetry packets (7006) even if new ones (7027) are present. | | -force_old_snippets | Forces the use of old snippet packets (7008) even if new ones (7028) are present. |
How It Works
- Initialization: Parses command-line arguments, setting input/output filenames and various flags (e.g.,
ignore_snippets,force_old_bathy,dual_head). Initializes Reson 7k data structures andj_EM_watercolumn. - 7k Indexing: Calls
build_Reson_7K_Index()(an external function) to create an index of all packet types within the.s7kfile. - File Opening: Opens the input
.s7kfile for reading. Creates the output OMG-HDCS merged file (.merged), snippet data file (.merged.ss_data), sonar settings file (.sonar_settings), and watercolumn file (.watercol). - OMG Summary Header Initialization:
- Determines
bathy_id(7006 or 7027) andsnippets_id(7008 or 7028) based on available packets andforce_old_*flags. - Reads the first bathy packet to determine
base_time. - Initializes an
OMG_HDCS_summary_headerstructure, settingfileVersion,toolType(from-sonaroption),refTime,numDepths, etc. - Writes this summary header to the
.mergedfile. - Allocates memory for
OMG_HDCS_beamstructures.
- Determines
- Ping Traversal Loop: Iterates through each Bathy packet (ping) found in the
.s7kindex:- Reads the Bathy packet (
7006or7027) and extractsping_time. - Searches the index for corresponding
7000_Sonar_Settings,7503_Remote_Control_Settings,7004_Beam_Geometry, and snippet/watercolumn records based onping_time. - Reads these associated records.
- OMG Profile Header Population: Populates an
OMG_HDCS_profile_headerstructure:ping_number,multi_ping_sequence,num_beamsare set from bathy data.td_sound_speedis set from sonar settings or bathy.- Various offsets to raw 7k packet headers are stored in the profile header and written to
.sonar_settings. - Snippet sample descriptors are stored in the profile header.
profile.modeis set todrf.system_enumeratorifdual_head.
- OMG Beam Structure Population: For each beam (
j) within the current ping:- Extracts
beam_index. beams[beam_index].Tx_steer,beams[beam_index].twtt,beams[beam_index].range,beams[beam_index].Rc_steer,beams[beam_index].beam_depress_angleare set from bathy and beam geometry data.beams[beam_index].statusandbeams[beam_index].Q_factorare derived from quality flags, respectingignore_flags.beams[beam_index].reflectivityis set from signal strength or calculated from snippets.- Preliminary
beams[beam_index].observedDepthandbeams[beam_index].acrossTrackare calculated. - If snippet data is available:
beams[beam_index].centre_no,beams[beam_index].no_samples,beams[beam_index].offset,beams[beam_index].snippet_first_sample,beams[beam_index].snippet_last_sampleare set.- Snippet samples are written to
.merged.ss_data.
- Extracts
- Watercolumn Data (
-watercolumn): If watercolumn data is present and not ignored:- Calls
convert_7K_watercolumn()to convert 7k watercolumn data to OMG format. - Calls
j_EM_write_watercolumn()to write the OMG watercolumn data to.watercol.
- Calls
- Write to Merged File:
OMG_HDCS_write_profile()andOMG_HDCS_put_raw_beams()write the populated profile header and beam data to the.mergedfile. - Increments
num_bathy_recs.
- Reads the Bathy packet (
- Cleanup: Frees allocated memory and closes all open files.
Output Files
<omg_file_prefix>.merged: Standard OMG-HDCS merged file.<omg_file_prefix>.merged.ss_data: Snippet side-scan data (binary, raw short intensities).<omg_file_prefix>.sonar_settings: Binary file containing 7k Sonar Settings and Remote Control Settings.<omg_file_prefix>.watercol: Watercolumn data (binary).