compareTwoSVPs
Description
compareTwoSVPs is a utility designed to compare the ray tracing results of two different Sound Velocity Profiles (SVPs) or a single SVP under varying conditions (e.g., with bulk sound speed shifts or surface sound speed errors). It calculates the predicted ray paths and associated times/distances for a given “calc_depth” (bottom depth) and then outputs the across-track position and depth for each ray.
This tool is useful for visualizing the impact of SVP uncertainty, sound speed errors, or specific sonar steering mechanisms on the actual bottom detection locations. It can help assess the sensitivity of bathymetric measurements to sound speed variations.
Usage
compareTwoSVPs -wc1 <ref_jWC_file> -wc2 <comp_jWC_file(s)> -out <output_file> [OPTIONS]
Arguments
| Option | Description | |
|---|---|---|
-wc1 <ref_jWC_file> | Required. Path to the reference SVP file in jWC format. | |
-wc2 <comp_jWC_file(s)> | Required. One or more paths to comparison SVP files in jWC format. | |
-out <output_file> | Required. Path for the output ASCII file containing across-track position and depth. | |
-calc_depth <val> | The bottom depth (meters) at which to compare ray paths. | 30.0 |
-draft <val> | Transducer draft (meters). | 0.0 |
-max_angle <val> | Maximum beam angle to trace (degrees). | 75.0 |
-angle_range <max_angle> <angle_step> | Defines the range and step for tracing beam angles. | 75 (max angle), 1 (step) |
-bulk_SV_shift <val> | Applies a bulk sound velocity shift (m/s) to the comparison SVP(s). | |
-frac_depth <val> | Fraction of the profile depth (calc_depth) over which to apply the bulk SV shift. | 1.0 |
-equal_opposite | Applies a surface sound speed error equal and opposite to the bulk shift. | |
-surf_SV_shift <val> | Applies a surface sound speed shift (m/s) to the assumed sound speed for ingoing beam steering. | |
-SV_shift_range <start> <end> <step> | Creates multiple comparison SVPs by ranging surf_SV_shift or bulk_SV_shift. | |
-just_surface | Applies SV_shift_range only to surf_SV_shift. | |
-roll <val> | Simulates a constant vessel roll (degrees). | 0.0 |
-line / -elac / -em3000d / -isis / -em1000 | Specifies the sonar type for steering angle calculations. | LINE_ARRAY |
-v | Enable verbose output. |
How It Works
- Initialization: Parses command-line arguments to set input/output filenames, comparison parameters (
calc_depth,draft,max_angle,roll), and various sound speed shift/sonar type options. - SVP Loading:
- Loads the reference SVP (
-wc1) intowc1usingjWC_read()andjWC_sort_async(). - Determines
surface_sound_speedfrom the reference SVP at thedraftdepth. - If
bulk_SV_shiftandequal_oppositeare set, it applies the bulk shift to the reference SVP. - Loads each comparison SVP (
-wc2) intowc[i]. Ifbulk_SV_shiftis set, it applies the shift to these comparison SVPs. - Performs
jWC_interp_zv()on all loaded SVPs to create finely layered velocity profiles.
- Loads the reference SVP (
- Ray Tracing & Comparison:
- Loop through comparison SVPs/shifts: The main loop iterates through all comparison SVPs (or generated shifts if
-SV_shift_rangeis used). - Loop through angles: For each comparison SVP/shift, it traces rays for
angle_to_use[i]from-max_angletomax_anglewithangle_step.- Steering Calculation: If
surf_SV_shiftis active, it callssteering()to calculatetrue_steered_angleandangle_error, simulating the effect of surface sound speed error on beam steering. - Reference Ray Trace: Performs a ray trace (
raypath()) through the referencewc1using theactual_angle_to_use(which may include steering errors) and thesurface_sound_speed + surf_SV_shift. This calculates the across-track position (equiv_radial) and one-way travel time (time_to_use) tocalc_depth. - Comparison Ray Trace: Performs another ray trace (
raytrace()) through the current comparisonwc[j]using the calculatedtime_to_use[j][i]and the originalangle_to_use[i]. This determines thenewradial(across-track) andnewdepthat which the ray reaches the sametime_to_use. - The
equiv_radialanddepthfrom the reference ray trace (first part of the main loop) are written to theoutfile. - The
newradialandnewdepthfrom the comparison ray trace (second part of the main loop) are also written to theoutfile.
- Steering Calculation: If
- Loop through comparison SVPs/shifts: The main loop iterates through all comparison SVPs (or generated shifts if
- Cleanup: Frees allocated memory for
watercolumnstructures and closes the output file.
Output Files
<output_file>: An ASCII file containing multiple columns of across-track positions and depths, representing the ray path predictions for the reference and comparison SVPs/shifts.
Helper Functions
steering(int type, double roll, double angle): Calculates the steered angle based on sonartype,roll, andangle. This function is primarily brought in fromsvpSonar.cand models different sonar geometries.jWC_init(),jWC_read(),jWC_sort_async(),jWC_interp_zv(),raypath(),raytrace(),jWC_free(): External functions fromj_watercolumn.hfor managing sound velocity profiles and ray tracing.
Dependencies
support.h: For general utility functions.j_watercolumn.h: Forwatercolumnstructures and ray tracing functions.svpSonar.h: For sonar steering models.
Notes
compareTwoSVPs is a powerful diagnostic tool for assessing the impact of sound velocity profile variations on multibeam bathymetry. It helps visualize how different SVPs or sound speed errors translate into positional and depth discrepancies on the seafloor. The various options for applying shifts and specifying sonar types make it flexible for simulating different scenarios. The tool creates new output files, preserving the original SVP data.