ea400: Kongsberg Simrad EA400 Single-Beam Hydrographic Echosounder Parser

Overview & Purpose

ea400 (ea400.c / ea400.h) is a binary datagram parser for Kongsberg Simrad EA400 single-beam hydrographic echosounder files (.out / .raw). It decodes the 16-byte datagram framing header (EA400_DatagramHeader, containing the 4-character datagram type and Windows NT 64-bit FILETIME timestamp) and the EA400_Echogram payload, which stores dual-window 16-bit acoustic trace samples separated into a pelagic (water-column) window and a bottom-locked window around the detected seafloor depth.


Key Constants & Data Structures

EA400_DatagramHeader

#define EA400_DATAGRAM_HEADER_SIZE 16

typedef struct {
    unsigned int length;          /* Byte length of the datagram */
    char         type[5];         /* 4-char ASCII datagram identifier + null terminator */
    unsigned int low_date_time;   /* Lower 32 bits of Windows FILETIME (100-ns ticks since 1601-01-01) */
    unsigned int high_date_time;  /* Upper 32 bits of Windows FILETIME */
} EA400_DatagramHeader;

EA400_Echogram

#define EA400_ECHOGRAM_HEADER_SIZE 44

typedef struct {
    char         type;                 /* Echogram telegram type character */
    char         channel;              /* Transducer channel number */
    char         sep1;                 /* Separator byte 1 */
    char         time[9];              /* 8-char ASCII timestamp string + null terminator */
    char         sep2;                 /* Separator byte 2 */
    unsigned int tvg_type;             /* Applied TVG law (e.g., 20logR or 40logR) */
    float        depth;                /* Detected bottom depth (meters) */
    float        pelagic_upper;        /* Start depth of pelagic sample window (meters) */
    float        pelagic_lower;        /* End depth of pelagic sample window (meters) */
    unsigned int pelagic_count;        /* Number of 16-bit samples in pelagic window */
    float        bottom_upper;         /* Start depth of bottom-locked sample window (meters) */
    float        bottom_lower;         /* End depth of bottom-locked sample window (meters) */
    unsigned int bottom_count;         /* Number of 16-bit samples in bottom window */

    signed short pelagic_data[10000];  /* Pelagic window echo trace samples */
    signed short bottom_data[10000];   /* Bottom window echo trace samples */

    /* Extra housekeeping fields */
    unsigned int length;               /* Leading datagram byte length */
    unsigned int total_count;          /* pelagic_count + bottom_count */
    unsigned int end_length;           /* Trailing datagram byte length check */
} EA400_Echogram;

Public Functions & Signatures

int parse_EA400_DatagramHeader(FILE *infile, EA400_DatagramHeader *header)

Reads 16 bytes (EA400_DATAGRAM_HEADER_SIZE) from infile and decodes length, the 4-byte ASCII type tag (null-terminated at header->type[4]), low_date_time, and high_date_time using little-endian byte extraction (get_LE_int from jb_endian.h).

  • Returns: 0 on success, 1 on EOF.

int print_EA400_DatagramHeader(EA400_DatagramHeader *header)

Prints a formatted summary of length, type, low_date_time, and high_date_time to stdout.

  • Returns: 0.

int parse_EA400_Echogram(FILE *infile, EA400_Echogram *echogram)

Parses a complete EA400 echogram record from infile:

  1. Reads the leading 32-bit little-endian record length (echogram->length).
  2. Reads the 44-byte EA400_ECHOGRAM_HEADER_SIZE block and extracts type, channel, time[8], tvg_type, depth, pelagic_upper, pelagic_lower, pelagic_count, bottom_upper, bottom_lower, and bottom_count.
  3. Computes echogram->total_count = echogram->pelagic_count + echogram->bottom_count.
  4. Reads pelagic_count 16-bit signed integers into echogram->pelagic_data and bottom_count 16-bit signed integers into echogram->bottom_data (fread_LE_short).
  5. Reads the trailing 4-byte length echogram->end_length and verifies that echogram->length == echogram->end_length.
    • Returns: 0 on success, 1 on EOF or framing length mismatch.

int print_EA400_Echogram(EA400_Echogram *echogram)

Prints the parsed EA400 echogram metadata (channel, time, TVG type, detected depth, and pelagic/bottom depth bounds and sample counts) to stdout.

  • Returns: 0.

How It Fits Into the OMG Architecture

ea400 is used by read_ea400 (code/jonnyb/gom_stuff/read_ea400.c) to extract single-beam bathymetry and water-column/bottom echogram traces from Kongsberg EA400 files for Gulf of Mexico gas-plume and seafloor backscatter studies.