SEG‑D Monitor Download

Lessons › Lesson 11

Reading the gun controller's header: GunLink1

On every shot the gun controller hands the recorder a page of notes about every gun: when it was told to fire, when it fired, how deep it hung, how much air it had. In a GunLink record that page is the GunLink1 header, and it sits inside the SEG‑D record. This lesson takes it apart byte by byte - and shows what SEG‑D Monitor reads from it.

  • about 40 minutes
  • three live demos
  • a 10-question quiz at the end

1Where the header lives

Lesson 2 opened a SEG‑D record: a row of headers, then the traces. The general header says what the record is; the channel set descriptors say how each group of channels was recorded; the extended header holds the recording system's own parameters. Then comes the external header. In SEG‑D revision 1's words, it "is used to record additional user supplied information in the header".

On a vessel whose air guns are fired by a Seamap GunLink controller, the user that supplies it is the gun controller, and what it supplies on every shot is the GunLink1 header. GunLink's release notes date it to version 4.0.0 of the controller's software, in September 2013: a new SEG‑D header format that "supports GunLink's new firing modes".

A SEG-D record as a row of blocks: general headers, channel set descriptors, extended header, external header, traces. The external header is opened out below: the GunLink1 header's first block, its descriptors, its data blocks, its checksum and CR LF, and filler to the end of the last 32-byte block. Generalheaders Channel setdescriptors Extendedheader Externalheader Traces - one for every channelheader, extensions, samples First block154 bytes Descriptors20 bytes each Data blocks, in the descriptors' orderSTRING · G_FIRE · PHONES · … Checksum+ CR LF filler The GunLink1 header: printed characters, read from left to right - a few thousand of them on a big source.
The GunLink1 header is the SEG‑D record's external header. It is counted in blocks of 32 bytes, like every SEG‑D header; the header itself is not, so its last block has room left over.

Finding it

  1. General Header Block #1, byte 32 holds the number of 32-byte external header blocks - two BCD digits, 0 to 99. A GunLink1 header for a big source is several thousand bytes: more than 99 blocks. Then, the standard says, "these bytes are set to FF".
  2. In that case General Header Block #2, bytes 8 and 9, hold the count instead, as a two-byte unsigned binary number.
  3. The external header starts after the general header blocks, the channel set descriptors (and any skew blocks) and the extended header - all counted in 32-byte blocks. Its first six characters are *GLNK1.

The external header is a whole number of 32-byte blocks; a GunLink1 header is as long as it needs to be. In the records SEG‑D Monitor reads, the room left in the last block is filled with zero bytes. A reader stops where the header says it ends - not where the blocks do.

The idea to keepThe GunLink1 header is the external header of a GunLink SEG‑D record. Its length in blocks is in General Header Block #1 byte 32 - or, when that reads FF, in Block #2 bytes 8 and 9.

2Written as text

SEG‑D's own headers are packed BCD and binary: a byte can hold two decimal digits, or part of a number. The GunLink1 header is different. Every byte is a printed character - a digit, a letter, a space, a sign. Open a record in a text viewer and the header can be read by eye: *GLNK1C02486… is a GunLink1 header, version C, 2,486 bytes long.

The document that defines it, Seamap's GunLink1 header format, writes each field's width as A followed by a number of characters - A6 is six characters, A1 one - and sets a few rules for all of them:

  • Every field has a fixed width. A reader cuts the text at fixed places; nothing separates one field from the next.
  • Numbers are padded with leading zeros. A gun at 6.0 m is written 060.
  • Text is padded with trailing spaces. A line name of nine characters in a 16-character field is followed by seven spaces.
  • Most times are in tenths of a millisecond, with no decimal point. 000523 is 52.3 ms. Depths are in tenths of a metre, pressures in psi, volumes in cubic inches.
  • A minus sign takes a character. So a negative value has less room than a positive one: in the document's example, a four-digit field covers −99.9 ms (-999) to 999.9 ms (9999).

A reading that comes from a sensor carries a one-letter status beside it, saying how it was obtained:

CodeMeaning
VValid: a measured value.
HHeld over from the last good reading - mainly the atmospheric pressure, while its data is lost for a while.
IInterpolated or averaged from more than one reading: the transducer it needs is faulty, or there is none.
KKilled: the operator has switched the transducer off because it is faulty.
DDead: the transducer is not working.
MManual: a value the operator typed in.
NNominal: there is no way to derive a reading.

Two ways of counting bytes

The document's tables number a field's bytes from 1: the format identifier is bytes 1-6. Its offsets - "from start of header" - count from 0: the first byte is at offset 0. So byte n is at offset n − 1. Lesson 3 met the same trap with sample numbers; here, read the wrong way, it moves every field by one character.

For the curious: why text?

Text has no byte order to get wrong, no floating-point format to agree on, and it can be checked by eye in any viewer. The cost is room: a six-digit time takes six bytes where binary would need three. On a header of a few thousand bytes in a record of several megabytes, that cost is small.

The idea to keepRead a GunLink1 field as text cut at a fixed width. Count bytes from 1 and offsets from 0.

3A map with pointers

The header has four parts: a first block of fixed layout, a descriptor for each kind of data block that follows, the data blocks themselves - each kind a run of blocks of one fixed length, one per string or one per gun - and a trailer: an XOR checksum written as two hex characters, then a carriage return and a line feed. Pick a part:

The first block - 154 bytes in revision C. The shot as a whole: the line and shot point, which strings fired, how the shot was triggered and fired, the aim point time, the source, how many guns there are and how they did, the volumes, the pressures, the array's limits - and, at its end, how many descriptors follow and how long each is. Part 4 reads it field by field.
The descriptors - 20 bytes each, one for every kind of block recorded. Each names its kind of block, its revision, the size of one block, how many there are, and the offset of the first from the start of the header. They are the header's table of contents: part 5.
SUBSRC - only in sub-source firing mode. One block for each sub-source: its mode (a fixed delay, a random delay between limits, or a delay that walks from shot to shot), its limits, its depth and the offset it fired at on this shot.
MULTIP - only in Multi Point firing mode. One block for the shot: a 12-byte head with the sequence number and the jitter, then 15 bytes for every gun - its programmed aim-point offset and the one actually used. SUBSRC and MULTIP never appear together; in conventional firing neither does.
STRING - always there. One 7-byte block for each string: its number, its pressure in psi and the status of that reading. It was kept from the older GCS90 header, for readers that know only that.
G_FIRE - always there, and most of the header. One 64-byte block for every gun in the configuration, whether it fired or not: where it hangs, its volume, its source, whether it was asked to fire, its aim point, its fire time and error, its depth and its pressure. On a 60-gun array that is 3,840 bytes.
PRESSR - the operator's option. One 19-byte block for each pressure transducer: the main manifold, each string's, each cluster's - where it is along the string and what it reads.
PHONES - always there in revision C. One 44-byte block for each hydrophone: its sensitivity, temperature and capacitance, its serial number, its calibration figures and its status. Revision B is the same header without this block.
The trailer - 4 bytes. Two hex characters: the XOR of every byte of the header before them. Then a carriage return and a line feed, which end the header.

Pointers, not positions

The header does not expect a reader to know where things are. It says so itself:

  • Bytes 8-12: the total number of bytes, CR LF included.
  • Bytes 13-17: the offset, from the start of the header, of the descriptor count. In revision C the count is byte 151 of the first block - offset 150.
  • The count says how many descriptors follow, and the next two bytes how long each one is.
  • Each descriptor gives the size of its blocks, how many there are, and the offset of the first one.

Why go to this trouble? Because the format is meant to grow. New fields of the first block "will be inserted" just before the descriptor count. New kinds of block may be added, and "can be ignored by code that does not understand them". And a revised block is meant to add its new data at its end, so that older readers keep working - although, the document warns, "this cannot be guaranteed".

Rules for a reader that lasts

  1. Check that the first six characters are *GLNK1, and note the version letter after them.
  2. Find the descriptor count through the offset in bytes 13-17 - never assume it is at byte 151.
  3. Take every block's size and place from its descriptor, never from a table: step from one block to the next by the descriptor's size.
  4. Skip a descriptor whose kind you do not know.
  5. Within a block, read the fields you understand and ignore any bytes after them.
  6. Check the checksum, and stop at the CR LF.

The idea to keepA GunLink1 header carries its own map. Follow its pointers - byte 13, the count, the descriptors - and a reader written today still reads a header that has grown.

4The first 154 bytes

The first block describes the shot as a whole. In the document's table its fields run without a gap from byte 1 to byte 154:

BytesWidthFieldHow to read it
What the header and the shot are
1-66Format identifierAlways *GLNK1: how a reader tells this header from the older GCS90 family.
71Version codeA letter; C for the revision this lesson follows.
8-125Total bytesThe whole header, CR LF included.
13-175Offset to the descriptor countFrom the start of the header, counting from 0.
18-3316Line nameText, space-padded. A longer name keeps its last 16 characters.
34-4310Shot pointA whole number, zero-padded.
44-474Active string maskFour hex characters, 16 bits. Bit 0 is string 1; a bit is set when some guns on that string fired (part 7).
How the shot was fired
481Trigger modeI internal, E external - always E when the navigation system starts the shot.
491Fire time modeC closure, G GPS time from the navigation system.
50-534Nominal fire time to the aim pointTenths of a ms, for a gun with no offsets.
541Array firing modeC conventional: every gun aimed at the aim point, perhaps with beam-steering offsets. S sub-source: sub-sources fire on their own, offset from it. M Multi Point: each gun or cluster has its own offset from a programmed sequence.
55-562Number of sub-sources0 when not in sub-source mode.
57-582Multi Point sequence number1 to n, 0 when not in use. Over 99, the Base54/64 code of part 7.
59-8224Shot aim point timeYY/MM/DD:HH:MM:SS.ssssss - GPS time when there is one. A two-digit year.
83-842Current sequence (source) numberThe source the navigation system asked for. Only that source's guns fire.
How many guns, and how they did
85-862Installed stringsThe number of sub-arrays.
87-893Guns in total
90-923Guns firedOn this shot.
93-953Guns with fire errors outside specification
96-983Guns with auto-fire reportsSince the previous header.
99-1013Guns misfiredFire not detected.
102-1043Total error spreadTenths of a ms, always positive: the latest error minus the earliest - or, when every gun was late or every gun early, from the aim point to the latest or the earliest.
105-1095Volume firedCubic inches.
110-1145Ideal volumeThe source's volume if every gun fires correctly.
115-1195Average absolute errorMilliseconds, written with its point: NN.NN.
120-1245Standard deviation of the errorsMilliseconds, with its point: N.NNN. Guns that fired.
The air and the atmosphere
125-1284Main manifold pressurepsi.
1291Its statusV, I, K or N.
130-1356Atmospheric pressureMillibar, with its point: NNNN.N.
1361Its statusV, H or M.
The limits - 0 means "no single limit for the whole array"
137-1382Gun error limitTenths of a ms.
139-1402Shallow depth toleranceTenths of a metre from the nominal depth.
141-1422Deep depth toleranceTenths of a metre from the nominal depth.
143-1464Low pressure limitpsi.
147-1504High pressure limitpsi.
What follows
151-1522Number of descriptorsThe offset in bytes 13-17 points here.
153-1542Size of a descriptor20.

Four fields to read with care

  • The line name keeps the end of a name longer than 16 characters, not the start.
  • The active string mask is hexadecimal, and its bits count from the right: 000C is bits 2 and 3 - strings 3 and 4.
  • The aim point time has a two-digit year and a date written year/month/day.
  • The limits read 0 when the array has no single limit - then each gun's own block, not the first block, is the place to look.

The idea to keepThe first block is the shot in summary - who, where, how many, how well - with the limits of the whole array, and at its end the way into the rest of the header.

5The descriptors

After the first block come the descriptors, one for each kind of data block in the header, each 20 bytes:

BytesWidthFieldHow to read it
1-66Data typeThe kind of block: STRING, G_FIRE …
71Format revisionThe revision of that kind of block, starting at A.
8-125Size of one blockBytes.
13-153Number of blocks1 to n.
16-205Offset of the first blockFrom the start of the header, counting from 0.

The document defines six kinds of block. Two are always there; the rest come with a firing mode or an option:

Data typeWhat it holdsWhen it is there
SUBSRCThe sub-sourcesAutomatically, in sub-source firing mode
MULTIPThe Multi Point sequenceAutomatically, in Multi Point firing mode
STRINGOne block a stringAlways
G_FIREOne block a gunAlways
PRESSROne block a pressure transducerThe operator's option
PHONESOne block a hydrophoneAlways, in revision C

The descriptors - and the blocks after them - come in that order. A header in conventional firing mode, without pressure transducers, has three: STRING, G_FIRE, PHONES.

How long a header is

Every part has a known size, so the length of a header can be worked out before it is read:

total = 154 + 20 × descriptors + Σ (block size × number of blocks) + 4

The document works two examples for an array of 6 strings and 60 guns:

  • Conventional firing, no options: 154 + 2 × 20 + 6 × 7 + 60 × 64 + 4 = 4,080 bytes.
  • Three sub-sources and 37 pressure transducers (a main manifold and six a string): 154 + 4 × 20 + 3 × 25 + 6 × 7 + 60 × 64 + 37 × 19 + 4 = 4,898 bytes.

Neither example has a PHONES block: they are worked for revision B, which has none. In revision C, with one hydrophone for each gun, the first header grows by 20 + 60 × 44 = 2,660 bytes, to 6,740 bytes - 211 blocks of 32 bytes, with 12 bytes left over. Far more than 99 blocks: General Header Block #1 byte 32 reads FF.

The idea to keepThe descriptors are the header's table of contents: a kind, a size, a count and an offset. Block n of a kind starts at offset first + (n − 1) × size.

6The data blocks

G_FIRE: one block for every gun

The biggest part of the header. There is a block for every gun in the configuration - whether it was asked to fire on this shot or not. Guns are numbered from the head-end cluster of string 1, which should be the starboard-most string, along that string, then on along string 2 and so on; so a gun's number is also its block's place in the run.

BytesWidthFieldHow to read it
Which gun
1-33Gun number1 to n, as above.
4-52String1 to n, starboard to port.
6-72Cluster on the stringThe head end is cluster 1.
81Gun on the cluster1 to n.
91SpareS or a space. It says nothing about whether the gun fires; it keeps the array's volume right.
10-112Detection modeHow the fire is picked on the gun's sensor: 1 to 8, listed below.
12-154VolumeCubic inches.
16-172Sequence (source) numberThe source the gun belongs to - the lowest, if more than one. 0: the gun can never fire.
18-192Sub-source number0 when sub-source mode is not in use.
Asked to fire, and when
201Auto-fire detectedY or N, since the last header: the gun fired without being told to.
211TriggeredY or N: the gun was required to fire on this shot.
22-276Gun aim pointTenths of a ms after the navigation trigger: the ideal firing time, after any beam-steering, sub-source or programmed offset.
28-303Sensor delayTenths of a ms: how late the sensor and the pick show the tuning point. Already corrected for in the fire time.
31-344Beam-steer delayTenths of a ms the fire time was moved on purpose, for beam-steering or depth.
35-373Gun delayTenths of a ms from the solenoid to the detected fire. 0 on a misfire.
38-436Measured fire timeTenths of a ms from the navigation trigger. 0 on a misfire.
44-463Gun errorTenths of a ms: fire time minus aim point. As early as −9.9 ms.
Depth and air
47-493Gun depthTenths of a metre.
50-523Nominal depthTenths of a metre.
531Depth statusV, I or N.
541Depth errorE or a space - always clear when the gun was not triggered.
55-584Gun pressurepsi.
59-624Nominal pressurepsi.
631Pressure statusV, I or N.
641Pressure errorE or a space - always clear when the gun was not triggered.

The eight detection modes say which point of the gun sensor's signal is taken as the fire: 1, the signal rising through the positive threshold; 2, falling through the negative threshold; 3, falling back through the positive threshold; 4, rising back through the negative threshold; 5 and 6, the zero crossing after the positive or the negative threshold; 7 and 8, the positive peak after the positive threshold or the negative peak after the negative one.

Two flags are easy to confuse. Triggered N means the gun was not asked to fire - another source's gun, or a spare: its fire time is 0 and nothing is wrong. Triggered Y with a fire time of 0 is a misfire: it was asked and no fire was detected.

STRING: one block for every string

BytesWidthFieldHow to read it
1-22String number1 to n, starboard to port.
3-64String pressurepsi.
71Pressure statusV, I or N.

The pressure comes, in order of preference, from the string's in-water transducers (averaged if there are several), its transducer on board, the average of other in-water transducers, or the main manifold.

PRESSR: one block for every pressure transducer

BytesWidthFieldHow to read it
1-33Transducer number1 is the main manifold, if there is one; then the string transducers, then the cluster transducers.
4-52String number0: the main manifold.
6-72Cluster on the string0: a reading for the whole string.
8-103Gun indexThe gun it serves - typically one behind a shut-off valve - or 0.
11-144In-line offsetTenths of a metre from the head of the string; -001 for a transducer on board.
15-184Pressurepsi.
191Pressure statusV, K or D.

PHONES: one block for every hydrophone

BytesWidthFieldHow to read it
1-33Hydrophone number1 to n; also the block's place in the run.
4-85SensitivityIn ten-thousandths. Five characters - see part 8.
9-124TemperatureTenths of a °C.
13-164Compensated capacitanceHundredths of a nF.
17-204Effective sensitivityHundredths of a mV/bar.
21-3010Serial numberOf the hydrophone in use.
311Source of the figuresE: the hydrophone's own memory (EEPROM). C: the configuration.
32-354Nominal capacitanceHundredths of a nF, from calibration.
36-394Nominal sensitivityHundredths of a mV/bar, from calibration.
40-434Calibration temperatureTenths of a °C.
441StatusV, K or D.

SUBSRC and MULTIP: the firing modes

BytesWidthSUBSRC field - one block a sub-sourceHow to read it
1-22Sub-source number1 to n.
31Sub-source mode1 a fixed delay; 2 a random delay between limits; 3 walking - the offset grows or shrinks each shot to a limit, then resets.
41Random distribution1: equal probability across the range.
5-106Lower limit, or the fixed delayTenths of a ms.
11-166Upper limit, or the fixed delayTenths of a ms.
17-193Nominal depthTenths of a metre, when all its guns are at one depth.
20-256Actual offset on this shotTenths of a ms from the navigation trigger. 0: none of its guns fire.
BytesWidthMULTIP field - one block a shotHow to read it
1-22Pulse sequence number1 to n; over 99, the Base54/64 code.
31Per gun or per clusterG or C: how the operator wrote the sequence. The data is always per gun.
4-74Maximum random jitterTenths of a ms; may be 0.
8-103Number of entriesThe number of guns in the first block.
11-122Size of an entryBytes.
Then, for every gun
1-33Gun numberIts G_FIRE block.
4-96Programmed aim-point offsetTenths of a ms, before any jitter.
10-156Actual aim-point offsetTenths of a ms - which beam-steering may still move before the gun's aim point.

A MULTIP block is 12 + 15 bytes for every gun: 912 bytes on a 60-gun array.

The header explorer needs JavaScript; the tables above are everything it reads.

The idea to keepG_FIRE lists every gun, fired or not; Triggered says which ones were asked. Read a gun's fire, depth and air from its own block - each in its own units.

7Three small codes

The active string mask: hex and bits

Bytes 44-47 of the first block are four hexadecimal characters - 0 to 9 and A to F - that make one 16-bit number. Each bit stands for a string: "Bit 0 represents string 1", and a bit is set when some guns on that string fired. Each hex character is four bits, and the last character holds the first four strings: 0001 is string 1, 0008 string 4, 000C strings 3 and 4, 0030 strings 5 and 6.

The sequence number: Base54/64

A Multi Point sequence number has two characters. Up to 99 they are plain decimal digits. Over 99 the document switches to a "hybrid" code: if the first character is a digit, read the field as decimal; if not, find the first character in a table of 54 characters, multiply its place by 64, add the place of the second character in a table of 64 characters - and add 99.

The 64-character table is the alphabet of Base64: A-Z, a-z, 0-9, + and /. The 54-character table is the same without the ten digits - which is how a reader can tell: a field that starts with a digit is decimal, any other is the hybrid code. The document's own examples: AB = (0 × 64) + 1 + 99 = 100, and B3 = (1 × 64) + 55 + 99 = 218. The largest, //, is 53 × 64 + 63 + 99 = 3,554.

This demo needs JavaScript; the worked examples above are what it works out.

The checksum: XOR

The header ends with the "ASCII representation of hexadecimal exclusive-or checksum of all previous bytes in header", then CR LF. XOR - exclusive or - of two bits is 1 when exactly one of them is 1. XOR a whole run of bytes together and each bit of the answer says whether an odd number of the bytes had that bit set: a parity bit for each of the eight bit positions. The writer works it out over everything it wrote and puts it in as two hex characters; the reader works it out again over everything it read, and compares.

It is a quick check, and a partial one. One wrong character is always caught: it flips at least one bit, so that column's parity changes. But XOR does not care about order, so two characters swapped pass unseen; and two characters wrong in the same bit cancel each other out.

This demo needs JavaScript; the two paragraphs above say what it shows.

The idea to keepThe mask is bits written in hex, read from the right. The sequence code is decimal when it starts with a digit. The checksum catches any one wrong character - and not every pair.

8When the document and the bytes disagree

A format document is written by people, and read closely it can disagree with itself. The GunLink1 document does, in small ways - and each one teaches how to read any format:

  • A width written twice. In the PHONES table the sensitivity's format is written "A4", while its byte count says 5. The next field starts at byte 9, and the block is 44 bytes in all - both add up only if the sensitivity is five characters. So it is five; and the records' own descriptors say 44 too.
  • Decimal points counted. The general notes say only two values in the first block carry an explicit decimal point. The table writes three with a point: the average error (NN.NN), the standard deviation (N.NNN) and the atmospheric pressure (NNNN.N). Read every number with something that accepts a point, and none of them is lost.
  • Examples from the revision before. The PHONES block is listed as "Always present", yet neither worked example has it: they were worked for revision B. The descriptors in a real header, not the examples, say what is there.

The way through is the same each time. Trust what adds up - byte numbers, widths, block totals - over a single word in a table. Trust the header over the document: its descriptors say how long its blocks are. And when you can, check against a real record.

The idea to keepWhen two parts of a format document disagree, believe the one that adds up - and then look at a real record.

9What SEG‑D Monitor reads

SEG‑D Monitor reads the GunLink1 header of every record the moment the file lands. Here is what it takes from it, and what it does with it.

  • It finds the header as part 1 does: General Header Block #1 byte 32, and Block #2 bytes 8 and 9 when that reads FF.
  • From the first block: the line name and shot point, under which every reading is stored; the active string mask, which tells it which source fired - sub-array N is bit N − 1, and a mask that is only part of a source's own, when a string is switched off, still belongs to that source; the volume fired and the ideal volume; and the five limits - gun error, shallow and deep depth tolerance, low and high pressure - that each gun's readings are judged against.
  • From every G_FIRE block: the gun's string and cluster, its volume, whether it was triggered and whether it auto-fired, its aim point, measured fire time and gun error, its depth and its pressure. Tenths become milliseconds and metres once, as the rows are stored. Every gun is stored, fired or not; the Triggered flag decides which guns a shot is judged on.
  • The aim point is the time zero of every trace it reads: each trace is shifted so that the aim point falls at 50 ms.
  • The STRING blocks' pressures, with the time and the shot point, are what its Drop Test reads when no gun is firing.
  • Its Header Viewer lists every block it finds - STRING, G_FIRE, PHONES, PRESSR, SUBSRC and MULTIP - field by field.

The idea to keepThe gun controller's header is where an app like SEG‑D Monitor learns which source fired, which guns were asked to, and how each one did - against the limits written beside them.

10Interesting facts

Born in 2013

GunLink's software release 4.0.0, of 6 September 2013, brought in the GunLink1 header, recording "much more of the status information" than before, "including full recording of all pressure and depth transducers".

Seamap, GunLink release notes

The checksum of a GPS sentence

An NMEA 0183 sentence - what a GPS receiver sends - ends with a star and two hex digits: the XOR of every character between the $ and the star. The same check as the GunLink1 trailer.

Wikipedia: NMEA 0183

Digits that are their own numbers

In ASCII the characters 0 to 9 are 011 followed by their own value in binary: "5" is 011 0101. A text number is never far from a binary one.

Wikipedia: ASCII

Two moves for a new line

CR LF is two characters because a printing teletype needed two motions to start a new line: the carriage back to the start, and the paper up one line.

Wikipedia: Newline

Base64's alphabet

The 64-character table of the sequence code is exactly the Base64 alphabet of RFC 4648: A-Z, a-z, 0-9, + and /. Its 54-character table drops the digits.

RFC 4648 · GunLink1 header format

Every gun, every shot

A G_FIRE block is written for every gun in the configuration on every shot - so on a source that fires in turn, most of the blocks on any one shot belong to guns that were not asked to fire.

GunLink1 header format

11Quiz: what stayed?

Ten questions. Pick an answer and it is marked at once, with a line on why. Nothing you answer leaves this page.

  1. 1. Where in a SEG‑D record is the GunLink1 header written?
    Answer

    In the external header - the part of a SEG‑D record kept for "additional user supplied information". The gun controller is the user that supplies it.

  2. 2. Byte 32 of General Header Block #1 reads FF. What does that mean?
    Answer

    More than 99 blocks. Byte 32 holds two BCD digits, 0 to 99; above that it is set to FF, and General Header Block #2 bytes 8 and 9 hold the count as a binary number. A GunLink1 header for a big source is several thousand bytes.

  3. 3. A gun's aim point field reads 000523. What time is that?
    Answer

    52.3 ms. Times in the GunLink1 header are in tenths of a millisecond, zero-padded, with no decimal point: 523 tenths is 52.3 ms after the navigation trigger.

  4. 4. Why should a reader find the descriptor count through the offset in bytes 13-17, and not simply go to byte 151?
    Answer

    The first block may grow. New fields "will be inserted" just before the descriptor count. A reader that follows the offset still finds the count; one that assumes byte 151 reads the wrong bytes.

  5. 5. The active string mask reads 000C. On which strings did guns fire?
    Answer

    Strings 3 and 4. C is 1100 in binary: bits 2 and 3 are set, and bit 0 is string 1 - so bits 2 and 3 are strings 3 and 4.

  6. 6. The G_FIRE descriptor reads G_FIREA0006406000256. At what offset does gun 10's block start?
    Answer

    832. Blocks of 00064 bytes, 060 of them, the first at offset 00256: 256 + (10 − 1) × 64 = 832.

  7. 7. A gun's block says Triggered N, and its measured fire time is 000000. What happened?
    Answer

    It was not asked to fire. Every gun in the configuration has a block on every shot; Triggered N means it was not required to fire - another source's gun, or a spare. A misfire is Triggered Y with a fire time of 0.

  8. 8. A Multi Point sequence number field reads B3. What number is it?
    Answer

    218. It starts with a letter, so it is the hybrid code: B is place 1 in the 54 table, 3 is place 55 in the 64 table - (1 × 64) + 55 + 99 = 218.

  9. 9. Which damage to a header does its XOR checksum NOT catch?
    Answer

    Two characters swapped. XOR does not care about order: the same characters give the same bits in every column. Any one wrong character, though, is always caught.

  10. 10. A table writes a field as "A4", gives it 5 bytes, starts the next field 5 bytes later, and the block's total adds up only with 5. How many characters do you read?
    Answer

    5. The byte numbers, the widths and the total all say five; only one word says four. Believe what adds up - and check a real record. It is the PHONES sensitivity of the GunLink1 document.

12Sources and further reading

The GunLink1 layout in this lesson - every field, width, code and example - is from Seamap's document, the first source below. It is not on the internet: GunLink's release notes say its full details are available from GunLink Support. What the records SEG‑D Monitor reads hold - zero bytes after the CR LF, the descriptors' sizes - is what the app finds when it reads them. Every other fact comes from the sources listed. The drawings and the demos' header are the site's own, made up.

  1. Seamap (2021). GunLink software: GunLink1 header format, document 20-00-0142, revision RH - the first block, the descriptors, the SUBSRC, MULTIP, STRING, G_FIRE, PRESSR and PHONES blocks, the status codes, the trailer, the two worked examples and the Base54/64 addendum. From GunLink Support.
  2. Seamap: GunLink release notes 4.4 to 4.0 (archived copy) - release 4.0.0 of 6 September 2013 and its new SEG‑D header format, GunLink1.
  3. SEG Field Tape Standards Subcommittee (1994). Digital field tape standards - SEG‑D, revision 1 (special report). Geophysics 59, 668-684 - the external header, General Header Block #1 byte 32 and Block #2 bytes 8 and 9.
  4. MIND Technology: Seamap GunLink 4000 data sheet - the gun controller.
  5. IETF (2006). RFC 4648: The Base16, Base32, and Base64 Data Encodings - the Base64 alphabet.
  6. Wikipedia: NMEA 0183 - the XOR checksum of a sentence.
  7. Wikipedia: Longitudinal redundancy check - a check byte made by XOR.
  8. Wikipedia: ASCII - the codes of the digits.
  9. Wikipedia: Newline - CR LF and the teletype.
  10. Wikipedia: Hexadecimal - four bits to a hex digit.