8k2omg
Description
8k2omg is a utility designed to convert older Reson SeaBat 8000 series data (.81x files) into the OMG-HDCS (Ocean Mapping Group - Hydrographic Data Conversion System) merged file format. It extracts bathymetry and snippet data from the .81x files and maps them to the corresponding structures in the OMG-HDCS format.
This tool provides a bridge for older Reson data to be processed and integrated within the modern OMG toolkit. It handles various aspects of the conversion, including time synchronization, quality flags, and basic sonar calibration parameters.
Usage
8k2omg -81x <input_name> -omg <omg_prefix> [-v] [-debug] [-ER]
Arguments
| Option | Description | |—|—| | -81x <input_name> | Required. Path to the input Reson SeaBat 8000 series (.81x) file. | | -omg <omg_prefix> | Required. Prefix for the output OMG-HDCS files. The tool will generate: * <omg_prefix>.merged: The main OMG-HDCS merged file. * <omg_prefix>.merged.ss_data: Snippet side-scan data. | | -v | Enable verbose output. | | -debug | Enable debug output. | | -ER | Indicates an Extended Range projector (affects source level calculation). |
How It Works
- Initialization: Parses command-line arguments, setting input/output filenames and various flags (e.g.,
verbose,debug,extended_range). Initializes Reson 8000 series data structures (RESON_PEEKER,RESON_BATHY,RESON_SNIPPET,SNP1) and OMG-HDCS structures (OMG_HDCS_summary_header,OMG_HDCS_profile_header,OMG_HDCS_beam). - File Opening: Opens the input
.81xfile for reading. Creates the output OMG-HDCS merged file (.merged) and snippet data file (.merged.ss_data). - Initial Bathy Record Scan: Performs a preliminary scan to find the first valid bathymetry record, which is used to initialize the
OMG_HDCS_summary_header(e.g.,sonar_type,base_time,refTime). - OMG Summary Header Initialization:
- Determines
sonar_typebased onbathy.sonar_model. - Initializes an
OMG_HDCS_summary_headerstructure, settingfileVersion,toolType,refTime,numDepths, etc. - Writes this summary header to the
.mergedfile. - Allocates memory for
OMG_HDCS_beamstructures.
- Determines
- Record Processing Loop: Rewinds the input
.81xfile and processes it record by record:- Sync Search: Calls
seek_next_8K_sync()(an external function) to find the next Reson 8k synchronization pattern. - Record Type Identification: Reads
RESON_PEEKERto determine the packet type (Bathy or Snippet). - Data Reading:
- If it’s a Bathy record (
RESON_8K_SYNC_PATTERN), readsRESON_BATHYdata (bathy). - If it’s a Snippet record (
SNIPPET_ID_SNP0), readsRESON_SNIPPETdata (snippet).
- If it’s a Bathy record (
- Ping Matching: Continues until a Bathy record and a Snippet record with matching
ping_numberare found. - OMG Profile Header Population: Populates an
OMG_HDCS_profile_headerstructure from thebathydata:timeOffsetis calculated relative tosummary.refTime.- Sonar settings like
samp_rate,power,TVG,pulseLength,rx_gain_reduction,tx_power_reduction,max_swath_widthare set. - Source level (
profile.params[0].txLevel) is estimated based onsonar_typeandextended_range. - Projector beam width (
profile.params[0].txBeamAngle) and projector angle (profile.params[1].txPulseLength) are set.
- OMG Beam Structure Population: For each beam:
beams[i].rangeis set frombathy.range[i].- Preliminary
beams[i].observedDepthandbeams[i].acrossTrackare calculated using simplified geometry (angle derived from beam index, slant range frombathy.range[i]). beams[i].statusandbeams[i].Q_factorare derived frombathy.quality[i].beams[i].calibratedBackscatterandbeams[i].reflectivityare derived frombathy.intensity.- Snippet Data Processing:
beams[i].centre_no,beams[i].no_samplesare derived frombathy.range[i]andsnippetdata.beams[i].offsetis set to the current file pointer inoutfile_snippets.- Snippet samples are written to
outfile_snippets. beams[i].reflectivityis recalculated from the average snippet amplitude.
- Write to Merged File:
OMG_HDCS_write_profile()andOMG_HDCS_put_raw_beams()write the populated profile header and beam data to the.mergedfile.
- Sync Search: Calls
- Cleanup: Closes all open files and frees allocated memory.
Output Files
<omg_prefix>.merged: Standard OMG-HDCS merged file.<omg_prefix>.merged.ss_data: Snippet side-scan data (binary, raw short intensities). ``` — layout: default title: 8k2omg parent: Reson Tools nav_order: 182 —8k2omg
Description
8k2omg is a utility designed to convert older Reson SeaBat 8000 series data (.81x files) into the OMG-HDCS (Ocean Mapping Group - Hydrographic Data Conversion System) merged file format. It extracts bathymetry and snippet data from the .81x files and maps them to the corresponding structures in the OMG-HDCS format.
This tool provides a bridge for older Reson data to be processed and integrated within the modern OMG toolkit. It handles various aspects of the conversion, including time synchronization, quality flags, and basic sonar calibration parameters.
Usage
8k2omg -81x <input_name> -omg <omg_prefix> [-v] [-debug] [-ER]
Arguments
| Option | Description | |—|—| | -81x <input_name> | Required. Path to the input Reson SeaBat 8000 series (.81x) file. | | -omg <omg_prefix> | Required. Prefix for the output OMG-HDCS files. The tool will generate: * <omg_prefix>.merged: The main OMG-HDCS merged file. * <omg_prefix>.merged.ss_data: Snippet side-scan data. | | -v | Enable verbose output. | | -debug | Enable debug output. | | -ER | Indicates an Extended Range projector (affects source level calculation). |
How It Works
- Initialization: Parses command-line arguments, setting input/output filenames and various flags (e.g.,
verbose,debug,extended_range). Initializes Reson 8000 series data structures (RESON_PEEKER,RESON_BATHY,RESON_SNIPPET,SNP1) and OMG-HDCS structures (OMG_HDCS_summary_header,OMG_HDCS_profile_header,OMG_HDCS_beam). - File Opening: Opens the input
.81xfile for reading. Creates the output OMG-HDCS merged file (.merged) and snippet data file (.merged.ss_data). - Initial Bathy Record Scan: Performs a preliminary scan to find the first valid bathymetry record, which is used to initialize the
OMG_HDCS_summary_header(e.g.,sonar_type,base_time,refTime). - OMG Summary Header Initialization:
- Determines
sonar_typebased onbathy.sonar_model. - Initializes an
OMG_HDCS_summary_headerstructure, settingfileVersion,toolType,refTime,numDepths, etc. - Writes this summary header to the
.mergedfile. - Allocates memory for
OMG_HDCS_beamstructures.
- Determines
- Record Processing Loop: Rewinds the input
.81xfile and processes it record by record:- Sync Search: Calls
seek_next_8K_sync()(an external function) to find the next Reson 8k synchronization pattern. - Record Type Identification: Reads
RESON_PEEKERto determine the packet type (Bathy or Snippet). - Data Reading:
- If it’s a Bathy record (
RESON_8K_SYNC_PATTERN), readsRESON_BATHYdata (bathy). - If it’s a Snippet record (
SNIPPET_ID_SNP0), readsRESON_SNIPPETdata (snippet).
- If it’s a Bathy record (
- Ping Matching: Continues until a Bathy record and a Snippet record with matching
ping_numberare found. - OMG Profile Header Population: Populates an
OMG_HDCS_profile_headerstructure from thebathydata:timeOffsetis calculated relative tosummary.refTime.- Sonar settings like
samp_rate,power,TVG,pulseLength,rx_gain_reduction,tx_power_reduction,max_swath_widthare set. - Source level (
profile.params[0].txLevel) is estimated based onsonar_typeandextended_range. - Projector beam width (
profile.params[0].txBeamAngle) and projector angle (profile.params[1].txPulseLength) are set.
- OMG Beam Structure Population: For each beam:
beams[i].rangeis set frombathy.range[i].- Preliminary
beams[i].observedDepthandbeams[i].acrossTrackare calculated using simplified geometry (angle derived from beam index, slant range frombathy.range[i]). beams[i].statusandbeams[i].Q_factorare derived frombathy.quality[i].beams[i].calibratedBackscatterandbeams[i].reflectivityare derived frombathy.intensity.- Snippet Data Processing:
beams[i].centre_no,beams[i].no_samplesare derived frombathy.range[i]andsnippetdata.beams[i].offsetis set to the current file pointer inoutfile_snippets.- Snippet samples are written to
outfile_snippets. beams[i].reflectivityis recalculated from the average snippet amplitude.
- Write to Merged File:
OMG_HDCS_write_profile()andOMG_HDCS_put_raw_beams()write the populated profile header and beam data to the.mergedfile.
- Sync Search: Calls
- Cleanup: Closes all open files and frees allocated memory.
Output Files
<omg_prefix>.merged: Standard OMG-HDCS merged file.<omg_prefix>.merged.ss_data: Snippet side-scan data (binary, raw short intensities).