misc_omg
Description
misc_omg (code/jonnyb/misc_omg.c) is Jonathan Beaudoinβs reference C template for reading and iterating through an OMG-HDCS .merged multibeam file using the rationalized profile and beam structures (OMG_rational_profile and OMG_rational_beam from OMG_HDCS_jversion.h).
When executed on a .merged file, misc_omg reads the OMG_HDCS_summary_header, allocates an array of summary.numDepths beam structures, loops over all summary.numProfiles pings, and prints each beamβs integer depth, across (across-track offset), and along (along-track offset) to stdout.
Usage
misc_omg -in <filename.merged>
Example
misc_omg -in merged/JD120/0001_line.merged | head -n 20
Arguments
| Option | Description | Default |
|---|---|---|
-in <filename.merged> | Input OMG-HDCS .merged multibeam file (opened in "rb+" mode). | Required |
How It Works
- Summary Header Read: Opens
<filename.merged>in"rb+"mode and callsOMG_HDCS_read_summary(infile, &summary)to determinesummary.numProfiles(total pings) andsummary.numDepths(maximum beams per ping). - Dynamic Beam Buffer Allocation: Allocates
beams = calloc(summary.numDepths, sizeof(OMG_rational_beam)). - Ping & Beam Iteration: For every ping $i \in [0, \text{numProfiles}-1]$:
- Calls
OMG_get_rational_profile(infile, i, &profile)to read the ping header. - Calls
OMG_get_rational_beams(infile, i, &num_beams, beams)to unpack the beam array. -
Iterates over $j \in [0, \text{numDepths}-1]$ and prints:
<beams[j].depth> <beams[j].across> <beams[j].along>
- Calls
- Cleanup: Frees
beamsand closesinfile.