Ray
Description
Ray is a ray tracing utility that takes a sound velocity profile (SVP) and builds Time-Angle (TA) lookup tables. These tables contain the across-track distance and depth for each ray at constant time intervals. The core functionality is based on Snell’s Law, tracing rays through a layered water column where each layer has a constant sound velocity.
The generated lookup tables (.Time_LUT, .ACROSS_LUT) are crucial for converting raw sonar measurements (like one-way travel time and beam angle) into georeferenced positions (across-track and depth). This is fundamental for multibeam data processing and image rectification.
Usage
Ray -pro <svp_handle> [-fishdep <val>] [-layerthick <val>] [-spacing <step> <start> <finish>] [-verbose]
Arguments
| Option | Description | |—|—| | -pro <svp_handle> | Required. Base name for the sound velocity profile file and output lookup tables. * Input: <svp_handle>.RAWPROF. * Output: <svp_handle>.Time_LUT and <svp_handle>.ACROSS_LUT. | | -fishdep <val> | Depth of the transducer/fish (meters). | 2.5 | | -layerthick <val> | Thickness of the constant velocity layers in the water column model (meters). | 0.1 | | -spacing <step> <start> <finish> | Defines the angular spacing for ray tracing: * step: Angular step (degrees). * start: Starting beam angle (degrees). * finish: Finishing beam angle (degrees). | 0.1 0 75 | | -verbose | Enable verbose output. | |
How It Works
- Initialization: Parses command-line arguments, setting various ray tracing and output parameters.
- SVP Reading (
read_in_raw()):- Opens the input SVP file (
<svp_handle>.RAWPROF). - Reads depth-velocity pairs (
rawdep,rawvel) and determinesfishdep(transducer depth),maxdepth, andmaxrange. - Based on
maxdepth, it setstimestep(time interval for sampling ray paths) andlayerthick. - Calculates
num_time_samplesbased onmaxslantrangeandtimestep.
- Opens the input SVP file (
- Equi-spaced SVP (
make_equisvp()):- Interpolates the raw SVP data into an equi-spaced layered model (
veldep) based onlayerthick.
- Interpolates the raw SVP data into an equi-spaced layered model (
- Ray Tracing (
do_raytrace()):- Iterates through
outanglefromstartangletofinishanglewithanglestep. - For each
outangle:- Initializes
posx,posz,ttime, andrangle. - Layer-by-Layer Propagation: Traces the ray through the water column layers:
- Updates
posx,posz, andttimebased on the ray’s path through the current layer’s velocity. - Stores
posx,posz, andttimefor this ray and layer inacross[raynum][i],deep[raynum][i], andTtime[raynum][i]. - Applies Snell’s Law to calculate the new
ranglefor the next layer. - Handles cases where the ray goes beyond
maxrangeor becomes horizontal.
- Updates
- Initializes
- Iterates through
- Time Sampling (
get_time_sampling_positions()):- Resamples the ray paths at constant
timestepintervals along each ray. - Interpolates
deepandacrossvalues at these constant time intervals and stores them inLUT_DepthandLUT_Across.
- Resamples the ray paths at constant
- Dump Time-Angle LUTs (
dump_time_LUT()):- Initializes a
JHC_headerfor the output files. - Opens two binary files:
<svp_handle>.Time_LUTand<svp_handle>.ACROSS_LUT. - Writes the
JHC_headerto each file. - Writes the
LUT_DepthandLUT_Acrossarrays to their respective files.
- Initializes a
- Cleanup: Frees allocated memory and closes all files.
Output Files (JHC .r4 Array Format)
<svp_handle>.Time_LUT: A 2D floating-point array (raster) where each cell contains the depth for a given time and outgoing beam angle.<svp_handle>.ACROSS_LUT: A 2D floating-point array (raster) where each cell contains the across-track distance for a given time and outgoing beam angle. Each output file contains aJHC_headerfollowed by the raw float data.
Helper Functions
read_in_raw(): Reads SVP data in a raw format (depth, velocity pairs).make_equisvp(): Interpolates raw SVP data to create an equi-spaced layered velocity profile (veldep).
Dependencies
support.h: For general utility functions.array.h: ForJHC_headerstructure.j_watercolumn.h: For water column structures and ray tracing functions.math.h: For mathematical functions.
Notes
The lookup tables generated by Ray are essential for correcting multibeam sonar data for refraction effects. By converting measured two-way travel times and beam angles into accurate across-track positions and depths, the tool contributes to the precise georeferencing of bathymetric soundings. The tool creates new files, preserving the original SVP data. The fishdep, layerthick, and spacing options allow for fine-tuning of the ray tracing model.