traceBP
Description
traceBP is a utility designed to analyze sidescan (SS) trace intensities as a function of incidence angle, primarily for EM710 and EM1000 multibeam sonars. It calculates the intensities for individual trace samples, bins them by incidence angle, and then performs a quadratic least-squares fit on the averaged backscatter response of the first and last beams.
The primary outputs are:
- A
tracepattfile containing coefficients of quadratic equations to normalize outer traces (used bymakess -traceBP). - Optionally, a verbose output suitable for plotting traces intensities versus launch angles (for all beams or individual beams).
Usage
traceBP <merged_file(s)> [OPTIONS]
Arguments
| Option | Description | |
|---|---|---|
<merged_file(s)> | Required. One or more paths to OMG-HDCS merged files (with associated .ss_data files). | |
-v | Enable verbose output. | |
-draft <val> | Specifies the draft (in meters) to subtract from observed depths. | Auto-calculated from .param or VESSEL_DRAFT (3.46m) |
-yoffset <val> | Specifies the Y-offset (in meters) to subtract from across-track distances. | Auto-calculated from .param or VESSEL_YOFFSET (0.0m) |
-plot_log | Output backscatter in logarithmic units (dB). | |
-plot_linear | Output backscatter in linear units. | |
-plot_dn | Output backscatter in raw Digital Number (DN) units. | |
-depth_range <min_m> <max_m> | Only process beams within this water depth range (in meters). | 0 to 1000 |
How It Works
- Initialization: Initializes various parameters, including
draft,offset_y,min_depth,max_depth, and arrays for accumulating backscatter and counts. - File Iteration: Loops through each input merged file:
- Opens the merged file (
infile) and its corresponding sidescan data file (.ss_data). - Loads sonar parameters from the
.paramfile to determinedraftandoffset_yif not overridden. - Reads the summary header.
- Ping Iteration: Loops through each profile (ping) in the merged file:
- Reads the current profile header and raw beams.
- Calculates
sample_length(pixel size in the sidescan trace). - Adjusts depth for
draftandacrosstrackforoffset_y. - Beam and Sample Iteration: For each valid beam within the current ping:
- Reads the raw sidescan
Scandata for the beam from the.ss_datafile. - Calculates the
incAng_centre_trace[j](incidence angle of the center sample of the beam’s trace). - For each sample
kwithin the beam’s sidescan trace:- Calculates the
incidence_anglefor that specific sample (Pythagorean theorem using depth and across-track offset, referencing the center sample’s incidence angle). - Determines
diff_incidence_angle(difference from the center incidence angle) and adivision_indexto bin the sample’s backscatter. - Accumulates
dn_value(Digital Number from the sidescan sample) intosum[j][division_index]and incrementscount[j][division_index]. - Calculates
avg_BS[j][division_index].
- Calculates the
- Reads the raw sidescan
- Opens the merged file (
- Quadratic Least-Squares Fit:
- After processing all pings, it identifies the
min_sectorandmax_sector(angle bins with sufficient data) for the first and last valid beams. - It then performs a least-squares fit to a quadratic equation (
y = c*x^2 + b*x + a) using theavg_BSvalues asyand binned incidence angles asx. This is done separately for the first and last beams. - The coefficients (
a,b,c,d,e,f) are printed to standard output.
- After processing all pings, it identifies the
- Output to
tracepatt: The calculated coefficients for the first and last beams are written to thetracepattfile. - Plotting Output (if plot flags are used): Prints a formatted table to standard output for plotting, including beam number, file sequence, launch angle, angle offset, average backscatter (converted to log, linear, or DN as requested), and count.
Output Files
tracepatt: An ASCII file containing quadratic coefficients for beam pattern normalization.- Standard Output: Formatted table for plotting (if plot flags are used).
Dependencies
OMG_HDCS_jversion.h: For OMG-HDCS data structures.support.h: For general utility functions and error handling.math.h: For mathematical functions.
Notes
This tool is used to derive empirical corrections for sidescan data based on the angular response of individual trace samples. The quadratic fit provides a smooth representation of this response, which can then be applied by other tools (e.g., makess) to normalize sidescan imagery. The verbose output is useful for diagnosing the angular response of the sonar.