refoCustom
Description
refoCustom (code/singlebeam/refoCustom.c) reformats custom hydrographic singlebeam echosounder logs into the OMG_HDCS (.merged) binary format (summary.toolType = SingleBeam, summary.sensorNumber = 1). It supports two agency-specific input formats:
- BCHYDRO (
-BCHydro): Space-delimited ASCII records containing UTM Northing, UTM Easting, Depth (m), and Timestamp. - SDG (
-SDG): 48-byte (LENGTH_SDG = 48) big-endian binary records containing timestamp, raw and processed Easting/Northing, raw and processed depths, tidal correction, sound-velocity correction, draft/heave correction, and a 16-bit bitwise quality status flag.
Usage
refoCustom [-v] [-BCHydro [-local_datum <m>]] [-SDG [-showbits]] <infile> <outfile.merged>
Arguments
| Option | Description | Default |
|---|---|---|
-v | Enable verbose output. | Off |
-BCHydro | Parse the input file as BC Hydro space-delimited ASCII (Northing Easting Depth Time). | â |
-local_datum <value> | Apply a vertical datum offset (in meters) to observed depths when using -BCHydro. | 0.0 |
-SDG | Parse the input file as 48-byte binary SDG singlebeam records. | â |
-showbits | (With -SDG) Print a human-readable breakdown of the 16-bit status_flag bits for every record. | Off |
<infile> | Required. Input custom singlebeam file (BCHYDRO ASCII or SDG binary). | â |
<outfile> | Required. Output OMG_HDCS .merged file. | â |
How It Works
1. Processing BC Hydro ASCII Data (-BCHydro)
- Reads each ASCII line (
Northing Easting Depth Time). - Converts UTM coordinates (
merid = -125.0, Northern Hemisphere) to WGS84 Latitude and Longitude usingutmgeo. - Subtracts
local_datum(if specified via-local_datum) from the observed depth and writes a 1-beamOMG_HDCS_profile_headerandOMG_HDCS_beamrecord to<outfile>.
2. Processing SDG Binary Data (-SDG)
- Reads 48-byte big-endian binary records via
read_SDG(), byte-swapping integer and short fields (get_swapped_int,get_swapped_short):time(seconds),raw_y_pos,raw_x_pos,proc_y_pos,proc_x_posraw_depth,proc_depth,tidal_corr,velo_corr,draft_heave_corrstatus_flag(16-bit bitmask indicating position/depth rejection states; inspectable via-showbits)
- Converts
proc_y_posandproc_x_posto geographic coordinates, populatesprofile.tidefromsdgr.tidal_corr, setsbeams[0].observedDepthfromsdgr.raw_depth, maps rejected status bits tobeams[0].status, and writes each profile to<outfile>.
Example
# Convert a BC Hydro ASCII survey with a 2.45 m local datum offset:
refoCustom -v -BCHydro -local_datum 2.45 reservoir_sb.txt reservoir_sb.merged
# Convert an SDG binary singlebeam file while inspecting status flag bits:
refoCustom -v -SDG -showbits sdg_line04.bin sdg_line04.merged