edReject
Description
edReject is a specialized utility for automatically flagging spurious soundings within OMG-HDCS merged files using “Ed’s method”. This method focuses on detecting various types of “spikes” or sudden discontinuities in the depth profile across the swath, such as simple spikes, or flat-topped/bottomed spikes.
The tool calculates depth gradients (delta) between adjacent beams and flags beams where these gradients exceed a user-defined threshold (eps) or show specific patterns indicative of spikes.
Usage
edReject <mergefile(s)> [-v] [-eps <value>]
Arguments
| Option | Description | |
|---|---|---|
<mergefile(s)> | Required. One or more paths to OMG-HDCS merged files to be processed. These files are modified in place. | |
-v | Enable verbose output (present in the main function arguments but not explicitly used in the provided code snippet). | |
-eps <value> | (Present in USAGE but commented out in main’s argument parsing) Intended to specify the epsilon threshold for depth gradients. Default 0.1 is hardcoded in the Eds_method function. | 0.1 |
How It Works
- File Processing: The tool iterates through each provided merged file.
- Summary Header Reading: Reads the summary header for basic file information.
- Profile and Beam Iteration: For each profile (ping) in the file:
- Reads the current
profileheader and rawbeams. - Data Preparation: Populates an
abeamarray (allbeams) with theacrossTrackandobservedDepthvalues (converted to meters) for each beam. - Ed’s Method Application: Calls the
Eds_methodfunction to perform the core spike detection logic:- Gradient Calculation: For each beam
i(from 1 tonodepths - 1), it calculatesallbeams[i].deltaas the depth difference betweenallbeams[i]andallbeams[i-1], divided by the absolute across-track difference. - Spike Detection Rules: It then iterates through the beams and applies various rules based on
allbeams[i].deltaand its neighbors to identify spikes:- Spikes close to zero: Flags beams adjacent to zero-depth readings if their
deltaexceedseps. - Simple spikes: Flags
beam_flags[i](using bitwise OR) ifallbeams[i].deltais positive andallbeams[i+1].deltais negative (spike up then down), or vice-versa. - Spikes with high flat: Flags
beam_flags[i]ifallbeams[i].deltais a strong positive/negative gradient, followed by a flat section, and then a strong negative/positive gradient.
- Spikes close to zero: Flags beams adjacent to zero-depth readings if their
- Target Detection (Commented Out): There’s a section for “Target detection” that attempts to set
*profile_flag = 'T'if anybeam_flags[i]is non-zero and has adjacent non-zero flags. This part is currently not fully implemented or utilized to update theprofile.edflag.
- Gradient Calculation: For each beam
- Flagging & Storing: The flags generated by
Eds_method(stored inflagsarray) are assigned tobeams[i].calibratedBackscatter. Theprofile.edflagis also updated. - Write Back: The modified
profileheader andbeamsare written back to the merged file.
- Reads the current
Output Files
- The input merged files are modified in-place.
- The
profile.edflagfield in the merged file’s profile header is set to ‘T’ if targets are detected, otherwise it is ‘0’. - The
beams[i].calibratedBackscatterfield is used to store individual beam flags (0 for good, non-zero for flagged).
Dependencies
OMG_HDCS_jversion.h: For OMG-HDCS data structures.support.h: For general utility functions and error handling.
Notes
“Ed’s method” is a heuristic approach to spike detection that relies on local depth gradients and specific patterns. While the eps threshold is hardcoded in the function, it’s designed to be effective for specific types of data artifacts. Repurposing calibratedBackscatter for storing flags suggests this tool is used for diagnostic or intermediate flagging purposes, and these flags might be reset or further processed by other tools. The -eps option is listed in the usage but not actively parsed, meaning the default value is always used.