deTVG
Description
deTVG removes Kongsberg Maritime’s real-time Time-Varying Gain (TVG) flattening and empirical seafloor backscatter angular response model ($BS_n$, $BS_o$, normal-incidence crossover angle, and Lambert’s Law compensation) from the 8-bit snippet imagery file (<line>.merged.ss_data), applies a true seafloor ensonified area correction (incorporating pulse length, beamwidth, and local seafloor grazing angle), and writes a radiometrically un-normalized snippet file named <line>.merged.ss_data_deTVG.
In the Kongsberg .all unraveling script (bunravel with -d), deTVG is run immediately before calling makess -use_deTVG:
deTVG -digitizer_sample_shift $DETVG_SHIFT -in merged/$SUBDIRS/$OUTFILE_PREFIX.merged
makess -use_deTVG merged/$SUBDIRS/$OUTFILE_PREFIX.merged ss/$SUBDIRS/$OUTFILE_PREFIX.ss_detvg
This two-step process restores the natural angular response of the seafloor and removes the notorious Kongsberg nadir “bright/dark stripe” artifact caused by real-time TVG switching between normal-incidence ($R_0$) and oblique-incidence regimes.
Usage
deTVG [OPTIONS] -in <filename.merged>
Common Examples
1. Standard deTVG processing on a Kongsberg .all merged file (with digitizer sample shift):
deTVG -digitizer_sample_shift 4 -in merged/JD100/0001_line.merged
makess -use_deTVG merged/JD100/0001_line.merged ss/JD100/0001_line.ss_detvg
2. deTVG on a Kongsberg .kmall merged file using true Two-Way Travel Time (OWTT) and recalculated normal incidence:
deTVG -iskmall_use_realowtt -recalc_NormalIncid -in merged/JD100/0001_line.merged
makess -use_deTVG merged/JD100/0001_line.merged ss/JD100/0001_line.ss_detvg
3. deTVG using a gridded bathymetric DTM (.r4) for true 3D seafloor slope / grazing angle calculation:
deTVG -use_dtm_for_grazing area_bathy.r4 -try_sector_pulse_lengths -in merged/JD100/0001_line.merged
Arguments
| Option | Description | Default |
|---|---|---|
-in <filename.merged> | Required. Input OMG-HDCS .merged file. Automatically opens <filename.merged>.ss_data, <prefix>.sectors, and <prefix>.param, and writes <filename.merged>.ss_data_deTVG. | None |
-digitizer_sample_shift <N> | Shifts the snippet sample index by <N> samples when calculating one-way travel time (OWTT) per sample, overcoming timing offsets where Kongsberg’s real-time water column / normal-incidence TVG ramp is misaligned at nadir. | 0 |
-iskmall_use_realowtt | For .kmall data: uses the floating-point beam twtt / 2.0 stored in the .merged file (adh_get_OWTT_for_each_sample_from_twtt) rather than integer sample count divided by sample rate. | Disabled |
-recalc_NormalIncid | Overrides the profile header’s range_to_normal_incidence ($R_0$) and crossover OWTT by recalculating them directly from the valid beam travel times (recalc_owtt_normal_incidence_crossover). Recommended when using -iskmall_use_realowtt. | Disabled |
-recalc_range_to_normal_incidence | Experimental option to recalculate $R_0$ from integer beam range measurements (adh_recalc_range_to_normal_incidence). | Disabled |
-use_dtm_for_grazing <dtm.r4> | Calculate true seafloor grazing angles by intersecting beams with a floating-point bathymetry grid (<dtm.r4>). | Across-swath profile slope |
-use_ADH_GRZ <N_pings> <N_beams> | Compute local 3D grazing angles using a $(2 N_{\text{pings}} + 1) \times (2 N_{\text{beams}} + 1)$ neighborhood window of surrounding soundings. | Disabled |
-read_GRA <.ext.r4> | Read pre-computed grazing angles from <prefix><.ext.r4> (generated by get_GRA). | Disabled |
-flat_seafloor | Ignore local seabed slope and use sonar-relative depression angles for ensonified area correction. | Disabled |
-refract | Read <prefix>.depression (dumped by newMergeAtt -dump_depression) to account for ray-bending refraction in grazing angle calculations. | Disabled |
-try_sector_pulse_lengths | For multi-sector sonars (EM2040, EM710/712, EM302/304, EM122/124): read sector-specific pulse lengths from <prefix>.sectors instead of using the profile-wide nominal pulse length. | Disabled |
-try_sector_tx_offsets | Apply transmit sector time offsets from <prefix>.sectors. | Disabled |
-try_new_BTS | Compute ensonified area at nadir using the beamwidth-limited footprint equation for the Bottom Target Strength (BTS) removal step. | Disabled |
-try_new_BTS_per_beam | Use a single BTS value (computed at the beam’s center sample OWTT) across all snippet samples within that beam. Implies -try_new_BTS. | Disabled |
-try_only_pulse_length_correction | Only apply pulse-length ensonified area correction. | Disabled |
-no_pulse_corr | Disable pulse-length ensonified area correction during adh_take_out_BTS_and_correct_for_area. | Enabled (1) |
-try_along_track_slope | Subtract $10 \log_{10}(1 / \cos \theta_{\text{along}})$ to compensate for along-track seabed slope. | Disabled |
-AUV_draft | Ignore Zloc + WLZ draft offset for AUV surveys. | Disabled |
-BSx10 | Divide BSo and BSn by 10.0. Only for debugging files unravelled by RTlite without -rescale_BSN (re-unraveling with -rescale_BSN is strongly preferred). | Disabled |
-debug | Print detailed per-ping and per-beam TVG parameters ($R_0$, crossover, $BS_n$, $BS_o$, sample rates, pulse lengths). | Disabled |
-debug_ensonification | Print ensonified area calculation diagnostics. | Disabled |
How It Works
- Reads Metadata & Grazing Angles: Loads
<prefix>.param,<prefix>.sectors, and each ping profile from<filename.merged>. Computes the true seafloor grazing angle for every beam (from across-track beam depths, a neighborhood patch via-use_ADH_GRZ, or a reference.r4DTM via-use_dtm_for_grazing). - Reconstructs Kongsberg Real-Time TVG (
get_TVG_params&compute_BTS): Using the ping’s normal-incidence backscatter ($BS_n$), oblique backscatter ($BS_o$), normal-incidence range ($R_0$), crossover angle (tvg_crossover), transmit/receive beamwidths, and effective pulse length,deTVGreconstructs the exact empirical Bottom Target Strength (BTS[k]) curve that Kongsberg SIS subtracted in real time at each snippet sample’s one-way travel time (owtt[k]). - Backs Out Real-Time BTS & Applies True Ensonified Area (
adh_take_out_BTS_and_correct_for_area): Converts each 8-bit snippet byte from<filename.merged>.ss_datainto decibels ((byte - 255.0) / 2.0dB), removes the Kongsberg real-timeBTS[k]flattening, and applies the physical pulse-length / beamwidth ensonified area correction using the local grazing angle. - Writes
.ss_data_deTVG: Encodes the corrected dB values back into 8-bit unsigned chars (255.0 + 2.0 * deTVG_BS[k]) at the exact byte offset (beams[j].offset) in<filename.merged>.ss_data_deTVG, which can then be mosaicked viamakess -use_deTVG.