processSHOALSdepths
Description
processSHOALSdepths is a specialized utility designed to process Optech SHOALS LASER Bathymetry waveforms and derive various depth types (PIM depth, opaque depth, extinction depth). These derived depths, along with a “depth-to-grid” flag indicating the recommended depth to use, are stored back into the OMG_HDCS_beam structure of the merged file.
The tool aims to provide a more refined depth estimate by analyzing the full waveform, accounting for different water column conditions (e.g., clear, turbid, deep water) and the characteristics of PMT (Photo-Multiplier Tube) and GAPD (Green Avalanche Photodiode) channels.
Usage
processSHOALSdepths <OMG_HDCS_datafile(s)> [-v] [-area <array.file>] [-scan_range <first> <last>]
Arguments
| Option | Description | |
|---|---|---|
<OMG_HDCS_datafile(s)> | Required. One or more paths to input OMG-HDCS merged files (with associated .waveform files). These files are modified in place. | |
-v | Enable verbose output. | |
-area <array.file> | Only process beams within the geographical area defined by the map sheet (.r4 file). | |
-scan_range <first_scan> <last_scan> | Process profiles (scans) only within this range. | All scans |
How It Works
- Initialization: Initializes ratio tracking structures (
PMT_ratio,GAPD_ratio), depth structures (PMT_depths,GAPD_depths), and defines aPMT_GAPD_depth_diff_ratio. - File Opening: Opens input merged files and corresponding
.waveformfiles. - Summary Header Reading: Reads the summary header from the merged file.
- Scan Iteration: Loops through each scan (profile) in the merged file (from
first_scantolast_scan):- Reads the profile header and raw beams.
- Waveform Data Extraction: For each beam
kthat hasobservedDepth:- Locates the beam’s geographic position (lat/lon).
- Extracts
ellipsoidal_heightfrombeams[k].observedDepth. - Seeks to the beam’s waveform data in the
.waveformfile and reads the rawWF_tracefor PMT, GAPD, IR, and RAMAN channels. - Waveform Processing (
pm_Process_Wave,classify_Wave): Callspm_Process_Waveandclassify_Wave(external functions) for both PMT and GAPD waveforms. This analyzes the waveform shape to derive parameters likes_50_bot(50% bottom start),s_end_bot(bottom end),s_start_sur(surface start),s_sink(sink depth),s_extinct(extinction depth), andvalid(waveform validity flag), andreturn_type(WEAK, DEEP_WATER). - Land/Water Detection: Uses the RAMAN waveform’s
i_start_surto determine if the return is from water or land. Only water returns are processed further. - Setback Ratio Calculation: Calculates a dynamic
setback_ratiofor both PMT and GAPD channels using a moving buffer ofBUF_SIZEvalues ofs_50_bot / s_end_bot. This ratio is used in deriving opaque and extinction depths. - Depth Derivation: Calculates
pimDepth,opaqueDepth, andextinctionDepthfor both PMT and GAPD channels based on the processed waveform parameters and thesetback_ratio. These values are scaled and stored in thebeams[k]structure. ThePMT_GAPD_depth_diff_ratiois applied to PMT-derived depths. - “Depth-to-Grid” Flag: Determines the optimal depth to use for gridding (
depth_to_grid) based on the validity and return type of PMT and GAPD waveforms. This flag (1to6for various depth types,7for land return) is stored inbeams[k].prim_depth_conf. - Updates
beams[k].statusto0for valid water returns, and7for land returns.
- Write Back: The modified
beamsandprofile(with updated depth fields and flags) are written back to the merged file.
Output Files
The input merged files are modified in-place, with updated OMG_HDCS_beam structures containing derived depth types and prim_depth_conf flags.
Dependencies
OMG_HDCS_jversion.h: For OMG-HDCS data structures.support.h: For general utility functions and error handling.j_proj.h: For coordinate projection functions.Optech_waveform.h: For Optech waveform data structures and processing functions (pm_Process_Wave,classify_Wave).
Notes
processSHOALSdepths performs complex waveform analysis to extract more accurate and robust depth estimates than simple first-arrival detection. By considering multiple depth types (PIM, opaque, extinction) and classifying returns (land/water, weak/deep), it significantly enhances the quality and interpretability of SHOALS data. The derived depth-to-grid flag provides an automated recommendation for which depth to use in subsequent gridding operations. The tool modifies files in-place, so backups are recommended.