parse_Bscorr
Description
parse_Bscorr is a tool designed to read and parse a standard Bscorr file (specifically for EM710 sonars) into an OMG beam pattern file format. It also includes functionality for interpolating the beam pattern values for angles between the reported values, ensuring a smooth and complete representation of the angular response.
The primary use case is to convert manufacturer-provided backscatter correction tables into a format compatible with OMG tools for further analysis or application.
Usage
parse_Bscorr <file.Bscorr_XXX> [-EM710] [-interpolate <val>] [-out <outname>] [-v]
Arguments
| Option | Description | |
|---|---|---|
<file.Bscorr_XXX> | Required. The path to the input Bscorr file (e.g., CalibEM710.txt). | |
-EM710 | Specifies that the input Bscorr file is in the EM710 format. | |
-interpolate <val> | Interpolates the beam pattern values for every <val> degree interval. | 1 (implicitly, as it iterates in 1-degree steps after interpolation setup). |
-out <outname> | The base name for the output file(s). | Input filename (without extension). |
-v | Enable verbose output. |
How It Works
- Input Reading: Reads the specified
Bscorrfile line by line, ignoring comment lines starting with#. - EM710 Format Parsing: If
-EM710is specified, it parses the file according to the EM710Bscorrformat, which typically includes:- Depth Mode, Swath Number, Number of Sectors per Swath.
- Source Level (SL) for each sector.
- Number of angle-vs-BP (Beam Pattern) value pairs for each sector.
- Angle and corresponding BP value pairs.
- Data Storage: The parsed data is stored in a multi-dimensional array structure (
EM710_Bscorr) indexed by depth mode, swath number, sector number, and angle. Source levels are stored separately. - Interpolation:
- For each depth mode, swath, and sector combination, it collects the available angle-vs-BP pairs.
- It then uses the GSL (GNU Scientific Library) spline interpolation to create a continuous curve from these discrete points.
- The interpolated values are then used to fill in the BP values for every 1-degree interval between the observed angles.
- Output Writing: The processed and interpolated beam pattern data is written to one or more output files.
- The output format attempts to mimic the input
Bscorrfile structure, including comments for human readability. - It generates separate files for each depth mode and swath combination (e.g.,
.Bscorr_1_0,.Bscorr_1_1for mode 1, single and dual swath 1 respectively).
- The output format attempts to mimic the input
Output Files
The output files will be named using the -out prefix (or the input filename if -out is not specified) followed by .<mode_id>_<swath_number>. For example:
<outname>.Bscorr_<mode>_<swath>: ASCII files containing the parsed and interpolated beam patterns.
Dependencies
parse_Bscorr.h: ForEM710_Bscorrstructure and related definitions.support.h: For general utility functions and error handling.gsl/gsl_spline.h: For GSL spline interpolation.
Notes
This tool is crucial for preparing custom beam patterns for use in KMALL sonars, allowing for fine-tuning of backscatter calibration based on empirical data rather than manufacturer defaults. The interpolation ensures a smooth and complete beam pattern even if the input data is sparse. It creates new output files without modifying the original Bscorr input.