correctBS
Description
correctBS is a specialized utility designed to correct multibeam backscatter (BS) data for various effects, including seabed slope, refracted path, and aspherical spreading. Its primary goal is to produce accurate, true grazing angle-corrected backscatter values, which can then be used to calculate beam pattern residuals and understand transducer roll effects.
The tool uses a Digital Terrain Model (DTM) for true seabed slope, and can incorporate raytracing-derived look-up tables (LUTs) for grazing angle, aspherical spreading, and beam angles. It can also identify shadowed areas and apply a mock backscatter calculation.
Usage
correctBS <OMG_HDCS_merged_file(s)> -topo <DTM_file(.r4)> [OPTIONS]
Arguments
| Option | Description | |
|---|---|---|
<OMG_HDCS_merged_file(s)> | Required. One or more paths to input OMG-HDCS merged files. These files will be modified in place. | |
-topo <DTM_file(.r4)> | Required. Specifies the input Digital Terrain Model (DTM) file in .r4 (float grid) format. Alternatively, flat can be used for nadir topography only. | |
-image <file.merged> | (Present in USAGE but not implemented) Likely intended to specify an input merged file to process. | |
-water <LUT_prefix> | Specifies a prefix for raytracing-derived Look-Up Table (LUT) files (e.g., .grazing_angle, .aspherical, .beam_angle). | |
-mock | Enable mock backscatter calculation (outputs angle difference). | |
-maxangle <val> | Maximum angle for mock backscatter calculation. | 25 |
-clip_beam <val> | Minimum beam angle to map (masking out beam data inside the beam null). | 45.0 |
-cast_shadow | Enable cast shadow detection. | |
-min <val> | Minimum dB value for the 8-bit output scale. | -90.0 |
-max <val> | Maximum dB value for the 8-bit output scale. | 0.0 |
-nofocus | Disable beam focus correction. | |
-v | Enable verbose output. |
How It Works
- Input Reading & Initialization:
- Opens input merged files and the DTM file (
-topo). - If
-wateris specified, it also opens raytracing-derived LUT files (.grazing_angle,.aspherical,.beam_angle) and loads their data into memory. - Initializes
min_dB,max_dB,draft, and other parameters.
- Opens input merged files and the DTM file (
- DTM & LUT Loading:
- Reads the DTM from the
.r4file into a float array (depths). - Reads grazing angle, aspherical spreading (focus), and beam angle LUTs into memory if
-wateris used. - Initializes Mercator projection based on DTM header.
- Reads the DTM from the
- Profile and Beam Iteration: Loops through each profile (ping) in the merged file and then through each beam within that profile:
- Geographic Positioning: Locates the beam’s geographic position (lat/lon) using
locate_beam. - DTM Lookup: Projects the beam’s lat/lon onto the DTM grid (
xpos,ypos) and retrieves the DTM depth (value) at that location, along with adjacent depths for slope calculation (peast,psouth). - True Grazing Angle Calculation:
- If
flat_flagis used, assumes a flat seafloor. - Otherwise, it uses
vectangle(an external function for 3D vector calculation) to determine thetrue_grazing_anglefrom the DTM, beam elevation, and azimuth.
- If
- Beam Focus & Shadowing:
- Retrieves
beam_focusfrom the aspherical LUT if available. - Performs
cast_shadow_flagchecks to identify shadowed areas. - Applies
clip_beamto mask out data inside the beam null.
- Retrieves
- Backscatter Correction/Calculation:
- Unimageable/Shadowed Areas: If
true_grazing_angleis negative (indicating unimageable seafloor or shadow), it assigns a specific color (RED, GREEN, BLUE, YELLOW) toBeams[j].pseudoAngleIndependentBackscatter. - True Backscatter (
!mock_flag): If not in mock mode,Beams[j].pseudoAngleIndependentBackscatteris set based ontrue_grazing_angle(scaled to 8-bit).Beams[j].freqandBeams[j].sample_intervalare also updated with related parameters (rgraze and insonified area). - Mock Backscatter (
mock_flag): Calculatesangle_diff(rgraze - true_grazing_angle) and scales it toBeams[j].pseudoAngleIndependentBackscatter. - Backscatter Strength (
backscatter_flag, currently not directly used): Contains commented-out logic for calculating backscatter strength based on sonar equation components.
- Unimageable/Shadowed Areas: If
- Geographic Positioning: Locates the beam’s geographic position (lat/lon) using
- In-Place Modification: The
pseudoAngleIndependentBackscatter,freq, andsample_intervalfields of theBeamsstructure are updated in the merged file.
Output Files
The input merged files are modified in-place.
Dependencies
OMG_HDCS_jversion.h: For OMG-HDCS data structures.array.h: ForJHC_headerstructure and DTM data handling.support.h: For general utility functions and error handling.j_proj.h: For coordinate projection functions.backscatter.h: Forvectanglefunction.
Notes
This tool is critical for quantitative backscatter analysis, allowing for the normalization of backscatter values for environmental and geometric effects. The corrected pseudoAngleIndependentBackscatter can then be used for seafloor classification and habitat mapping. The use of raytracing-derived LUTs significantly improves the accuracy of grazing angle and spreading loss corrections.