j_sb2100 — SeaBeam Instruments SB2100 Series (2112 / 2120 / 2136) Format I/O Library

Overview & Purpose in the OMG Architecture

j_sb2100 (code/subr/j_sb2100.c, code/subr/j_sb2100.h), authored by John E. Hughes Clarke on November 1, 1998, implements the stream synchronizer, fixed-width ASCII/binary hybrid record parsers, and diagnostic printers for SeaBeam Instruments (SBI) SeaBeam 2100 series (SB2112, SB2120, SB2136) multibeam echosounders.

The SeaBeam 2100 data format frames each record with a 10-byte Start-of-Frame (SOF) sequence ("SB2100xx\r\n", where "xx" is a 2-character record type code such as "DR" for Depth Record, "SS" for Sidescan Record, "PR" for Parameter Record, or "TR" for Text Record). While header metadata and beam soundings are encoded in fixed-column ASCII fields terminated by \r\n, the high-volume sidescan amplitude/along-track pixel arrays (SB2100_sidescan_record) are stored as big-endian 16-bit binary integers. j_sb2100 handles byte-by-byte frame synchronization, fixed-column string slicing, unit scaling, endianness swapping (INTEL), and epoch timestamp conversion (stdtime_from_jul_day).


Key Data Structures & Globals (code/subr/j_sb2100.h)

Globals

  • int override_abort: If non-zero, suppresses ping abortion when a beam record is missing its trailing \r\n delimiter.

Core Structs

  • SB2100_asciit: Parsed timestamp containing year, jday, hour, min, millisec, and double time1970 (Unix epoch seconds with millisecond precision).
  • SB2100_ll: Parsed geographic coordinates containing hemisphere characters (NShemi, EWhemi), integer degrees (latdeg, londeg), minutes (latmin, lonmin), ten-thousandths of minutes (latminfrac, lonminfrac), and signed decimal degrees (double lat, lon).
  • SB2100_beam: Per-beam bathymetry and backscatter attributes:
    • char data_source, signal_quality ('0' indicates an empty/rejected beam slot, which is automatically zeroed).
    • float range, vert_angle (deg), forw_angle (deg), depth (m), across (m), along (m), amplitude.
    • short SNR, echo_length.
  • SB2100_depth_record: Complete swath bathymetry ping containing SB2100_asciit asciit, SB2100_ll ll, speed, nobeams (up to 151), SVPcorr, freq[2], TX_heave, range_scale ('D' $\rightarrow 1.0$, 'I' $\rightarrow 10.0$, 'S' $\rightarrow 100.0$), scale_factor, SSV, SSV_source, depth_gate_mode, ping_gain, ping_pulse_width, TX_atten, TX_pitch, TX_roll, TX_heading, no_algorithms, algo_order[4], and SB2100_beam beam[151].
  • SB2100_pixel_data & SB2100_sidescan_record: Sidescan trace record containing ping header metadata, pixel_size_scale, pixel_scale_factor, pixel_intensity_algorithm, no_pixels (up to 4096), pixel_size, and SB2100_pixel_data data[4096] (unsigned short amplitude, short along).
  • SVpair & SB2100_parameter_record: System parameter and Sound Velocity Profile record storing roll_bias, pitch_bias, ships_draft, noSVPvals (up to 100), and SVpair sv[100] (float depth, float speed).
  • SB2100_text_record: Timestamped operator comment/text block (SB2100_asciit asciit).

Public Functions & Signatures

Frame Synchronization & Field Scanners

  • int jSB2100_find_next_SOF(FILE *file, char *SOF) Scans forward through file byte-by-byte until it locates a valid 10-byte "SB2100xx\r\n" Start-of-Frame header, copies the 2-character record identifier into SOF, rewinds the file pointer to the start of the frame, and returns the number of bytes advanced (or 0 at EOF).
  • int jSB2100_scan_asciit(char *data, SB2100_asciit *asciit) Extracts year, jday, hour, min, and millisec from bytes 10..25 of a record buffer and computes asciit->time1970 via stdtime_from_jul_day().
  • int jSB2100_scan_ll(char *data, SB2100_ll *ll) Extracts latitude and longitude hemispheres, degrees, minutes, and fractional minutes from bytes 26..44 and computes signed decimal degrees ll->lat and ll->lon.

Record Readers

  • int jSB2100_read_depth_record(FILE *file, SB2100_depth_record *dr) Reads the 107-byte ASCII depth header, scales speed, TX_heave, SSV, TX_pitch, TX_roll, and TX_heading, determines scale_factor from range_scale, and loops over dr->nobeams (reading 45 bytes per beam) to populate dr->beam[].
  • int jSB2100_read_sidescan_record(FILE *file, SB2100_sidescan_record *sr) Reads the 111-byte ASCII sidescan header, allocates a temporary buffer of (sr->no_pixels * 4) + 2 bytes, reads the binary (amplitude, along) short pairs, and performs swap_short() byte-swapping on INTEL little-endian hosts.
  • int jSB2100_read_parameter_record(FILE *file, SB2100_parameter_record *pr) Reads the 49-byte parameter header (roll_bias, pitch_bias, noSVPvals, ships_draft) followed by noSVPvals * 15 bytes of ASCII (depth, speed) SVP pairs.
  • int jSB2100_read_text_record(FILE *file, SB2100_text_record *tr) Reads the 25-byte timestamp header of a text comment block.

Diagnostic Printers

  • void jSB2100_print_asciit(SB2100_asciit *asciit) / void jSB2100_print_ll(SB2100_ll *ll)
  • void jSB2100_print_depth_record(SB2100_depth_record *dr)
  • void jSB2100_print_sidescan_record(SB2100_sidescan_record *sr)
  • void jSB2100_print_parameter_record(SB2100_parameter_record *pr) / void jSB2100_print_text_record(SB2100_text_record *tr)

How It Fits Into the OMG Architecture

j_sb2100 powers the SeaBeam 2100 ingestion pipeline (sb2100toOMG), translating raw SBI multibeam bathymetries, sidescan traces, and sound velocity profiles into OMG_HDCS files and .svp water-column casts.