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.
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".
Finding it
- 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".
- In that case General Header Block #2, bytes 8 and 9, hold the count instead, as a two-byte unsigned binary number.
- 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.
000523is 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:
| Code | Meaning |
|---|---|
| V | Valid: a measured value. |
| H | Held over from the last good reading - mainly the atmospheric pressure, while its data is lost for a while. |
| I | Interpolated or averaged from more than one reading: the transducer it needs is faulty, or there is none. |
| K | Killed: the operator has switched the transducer off because it is faulty. |
| D | Dead: the transducer is not working. |
| M | Manual: a value the operator typed in. |
| N | Nominal: 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:
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
- Check that the first six characters are
*GLNK1, and note the version letter after them. - Find the descriptor count through the offset in bytes 13-17 - never assume it is at byte 151.
- 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.
- Skip a descriptor whose kind you do not know.
- Within a block, read the fields you understand and ignore any bytes after them.
- 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:
| Bytes | Width | Field | How to read it |
|---|---|---|---|
| What the header and the shot are | |||
| 1-6 | 6 | Format identifier | Always *GLNK1: how a reader tells this header from the older GCS90 family. |
| 7 | 1 | Version code | A letter; C for the revision this lesson follows. |
| 8-12 | 5 | Total bytes | The whole header, CR LF included. |
| 13-17 | 5 | Offset to the descriptor count | From the start of the header, counting from 0. |
| 18-33 | 16 | Line name | Text, space-padded. A longer name keeps its last 16 characters. |
| 34-43 | 10 | Shot point | A whole number, zero-padded. |
| 44-47 | 4 | Active string mask | Four 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 | |||
| 48 | 1 | Trigger mode | I internal, E external - always E when the navigation system starts the shot. |
| 49 | 1 | Fire time mode | C closure, G GPS time from the navigation system. |
| 50-53 | 4 | Nominal fire time to the aim point | Tenths of a ms, for a gun with no offsets. |
| 54 | 1 | Array firing mode | C 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-56 | 2 | Number of sub-sources | 0 when not in sub-source mode. |
| 57-58 | 2 | Multi Point sequence number | 1 to n, 0 when not in use. Over 99, the Base54/64 code of part 7. |
| 59-82 | 24 | Shot aim point time | YY/MM/DD:HH:MM:SS.ssssss - GPS time when there is one. A two-digit year. |
| 83-84 | 2 | Current sequence (source) number | The source the navigation system asked for. Only that source's guns fire. |
| How many guns, and how they did | |||
| 85-86 | 2 | Installed strings | The number of sub-arrays. |
| 87-89 | 3 | Guns in total | |
| 90-92 | 3 | Guns fired | On this shot. |
| 93-95 | 3 | Guns with fire errors outside specification | |
| 96-98 | 3 | Guns with auto-fire reports | Since the previous header. |
| 99-101 | 3 | Guns misfired | Fire not detected. |
| 102-104 | 3 | Total error spread | Tenths 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-109 | 5 | Volume fired | Cubic inches. |
| 110-114 | 5 | Ideal volume | The source's volume if every gun fires correctly. |
| 115-119 | 5 | Average absolute error | Milliseconds, written with its point: NN.NN. |
| 120-124 | 5 | Standard deviation of the errors | Milliseconds, with its point: N.NNN. Guns that fired. |
| The air and the atmosphere | |||
| 125-128 | 4 | Main manifold pressure | psi. |
| 129 | 1 | Its status | V, I, K or N. |
| 130-135 | 6 | Atmospheric pressure | Millibar, with its point: NNNN.N. |
| 136 | 1 | Its status | V, H or M. |
| The limits - 0 means "no single limit for the whole array" | |||
| 137-138 | 2 | Gun error limit | Tenths of a ms. |
| 139-140 | 2 | Shallow depth tolerance | Tenths of a metre from the nominal depth. |
| 141-142 | 2 | Deep depth tolerance | Tenths of a metre from the nominal depth. |
| 143-146 | 4 | Low pressure limit | psi. |
| 147-150 | 4 | High pressure limit | psi. |
| What follows | |||
| 151-152 | 2 | Number of descriptors | The offset in bytes 13-17 points here. |
| 153-154 | 2 | Size of a descriptor | 20. |
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:
000Cis 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:
| Bytes | Width | Field | How to read it |
|---|---|---|---|
| 1-6 | 6 | Data type | The kind of block: STRING, G_FIRE … |
| 7 | 1 | Format revision | The revision of that kind of block, starting at A. |
| 8-12 | 5 | Size of one block | Bytes. |
| 13-15 | 3 | Number of blocks | 1 to n. |
| 16-20 | 5 | Offset of the first block | From 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 type | What it holds | When it is there |
|---|---|---|
SUBSRC | The sub-sources | Automatically, in sub-source firing mode |
MULTIP | The Multi Point sequence | Automatically, in Multi Point firing mode |
STRING | One block a string | Always |
G_FIRE | One block a gun | Always |
PRESSR | One block a pressure transducer | The operator's option |
PHONES | One block a hydrophone | Always, 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.
| Bytes | Width | Field | How to read it |
|---|---|---|---|
| Which gun | |||
| 1-3 | 3 | Gun number | 1 to n, as above. |
| 4-5 | 2 | String | 1 to n, starboard to port. |
| 6-7 | 2 | Cluster on the string | The head end is cluster 1. |
| 8 | 1 | Gun on the cluster | 1 to n. |
| 9 | 1 | Spare | S or a space. It says nothing about whether the gun fires; it keeps the array's volume right. |
| 10-11 | 2 | Detection mode | How the fire is picked on the gun's sensor: 1 to 8, listed below. |
| 12-15 | 4 | Volume | Cubic inches. |
| 16-17 | 2 | Sequence (source) number | The source the gun belongs to - the lowest, if more than one. 0: the gun can never fire. |
| 18-19 | 2 | Sub-source number | 0 when sub-source mode is not in use. |
| Asked to fire, and when | |||
| 20 | 1 | Auto-fire detected | Y or N, since the last header: the gun fired without being told to. |
| 21 | 1 | Triggered | Y or N: the gun was required to fire on this shot. |
| 22-27 | 6 | Gun aim point | Tenths of a ms after the navigation trigger: the ideal firing time, after any beam-steering, sub-source or programmed offset. |
| 28-30 | 3 | Sensor delay | Tenths of a ms: how late the sensor and the pick show the tuning point. Already corrected for in the fire time. |
| 31-34 | 4 | Beam-steer delay | Tenths of a ms the fire time was moved on purpose, for beam-steering or depth. |
| 35-37 | 3 | Gun delay | Tenths of a ms from the solenoid to the detected fire. 0 on a misfire. |
| 38-43 | 6 | Measured fire time | Tenths of a ms from the navigation trigger. 0 on a misfire. |
| 44-46 | 3 | Gun error | Tenths of a ms: fire time minus aim point. As early as −9.9 ms. |
| Depth and air | |||
| 47-49 | 3 | Gun depth | Tenths of a metre. |
| 50-52 | 3 | Nominal depth | Tenths of a metre. |
| 53 | 1 | Depth status | V, I or N. |
| 54 | 1 | Depth error | E or a space - always clear when the gun was not triggered. |
| 55-58 | 4 | Gun pressure | psi. |
| 59-62 | 4 | Nominal pressure | psi. |
| 63 | 1 | Pressure status | V, I or N. |
| 64 | 1 | Pressure error | E 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
| Bytes | Width | Field | How to read it |
|---|---|---|---|
| 1-2 | 2 | String number | 1 to n, starboard to port. |
| 3-6 | 4 | String pressure | psi. |
| 7 | 1 | Pressure status | V, 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
| Bytes | Width | Field | How to read it |
|---|---|---|---|
| 1-3 | 3 | Transducer number | 1 is the main manifold, if there is one; then the string transducers, then the cluster transducers. |
| 4-5 | 2 | String number | 0: the main manifold. |
| 6-7 | 2 | Cluster on the string | 0: a reading for the whole string. |
| 8-10 | 3 | Gun index | The gun it serves - typically one behind a shut-off valve - or 0. |
| 11-14 | 4 | In-line offset | Tenths of a metre from the head of the string; -001 for a transducer on board. |
| 15-18 | 4 | Pressure | psi. |
| 19 | 1 | Pressure status | V, K or D. |
PHONES: one block for every hydrophone
| Bytes | Width | Field | How to read it |
|---|---|---|---|
| 1-3 | 3 | Hydrophone number | 1 to n; also the block's place in the run. |
| 4-8 | 5 | Sensitivity | In ten-thousandths. Five characters - see part 8. |
| 9-12 | 4 | Temperature | Tenths of a °C. |
| 13-16 | 4 | Compensated capacitance | Hundredths of a nF. |
| 17-20 | 4 | Effective sensitivity | Hundredths of a mV/bar. |
| 21-30 | 10 | Serial number | Of the hydrophone in use. |
| 31 | 1 | Source of the figures | E: the hydrophone's own memory (EEPROM). C: the configuration. |
| 32-35 | 4 | Nominal capacitance | Hundredths of a nF, from calibration. |
| 36-39 | 4 | Nominal sensitivity | Hundredths of a mV/bar, from calibration. |
| 40-43 | 4 | Calibration temperature | Tenths of a °C. |
| 44 | 1 | Status | V, K or D. |
SUBSRC and MULTIP: the firing modes
| Bytes | Width | SUBSRC field - one block a sub-source | How to read it |
|---|---|---|---|
| 1-2 | 2 | Sub-source number | 1 to n. |
| 3 | 1 | Sub-source mode | 1 a fixed delay; 2 a random delay between limits; 3 walking - the offset grows or shrinks each shot to a limit, then resets. |
| 4 | 1 | Random distribution | 1: equal probability across the range. |
| 5-10 | 6 | Lower limit, or the fixed delay | Tenths of a ms. |
| 11-16 | 6 | Upper limit, or the fixed delay | Tenths of a ms. |
| 17-19 | 3 | Nominal depth | Tenths of a metre, when all its guns are at one depth. |
| 20-25 | 6 | Actual offset on this shot | Tenths of a ms from the navigation trigger. 0: none of its guns fire. |
| Bytes | Width | MULTIP field - one block a shot | How to read it |
|---|---|---|---|
| 1-2 | 2 | Pulse sequence number | 1 to n; over 99, the Base54/64 code. |
| 3 | 1 | Per gun or per cluster | G or C: how the operator wrote the sequence. The data is always per gun. |
| 4-7 | 4 | Maximum random jitter | Tenths of a ms; may be 0. |
| 8-10 | 3 | Number of entries | The number of guns in the first block. |
| 11-12 | 2 | Size of an entry | Bytes. |
| Then, for every gun | |||
| 1-3 | 3 | Gun number | Its G_FIRE block. |
| 4-9 | 6 | Programmed aim-point offset | Tenths of a ms, before any jitter. |
| 10-15 | 6 | Actual aim-point offset | Tenths 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.
Try it: take a header apart
A synthetic header, made up for this page in the GunLink1 layout, revision C: a source of a few strings, one shot. On it one gun fires 1.3 ms late, one misfires, one hangs too deep, one is short of air, and a gun of the other source reports an auto-fire. Each row below is one 32-byte SEG‑D block; a space shows as ·, CR LF as ␍␊, a zero byte of filler as ∙. Click any field - or the coloured map - or walk through the steps a reader takes.
- Where
- -
- Bytes · offset
- -
- Text
- -
- Means
- -
- Header
- -
- SEG‑D blocks of 32 bytes
- -
- Guns listed · fired
- -
- Checksum
- -
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.
Try it: read the mask and the sequence number
Click strings on and off, or type the four hex characters; then type a sequence number, or a two-character field, and see the other.
- Bits 15 … 0
- -
- Strings fired
- -
- As a number
- -
- Field
- -
- Number
- -
- Worked out
- -
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.
Try it: damage a header
The first characters of a synthetic header, its bits, and the XOR of them all. Edit the text, or damage it the three ways below, and see whether the checksum the writer wrote still matches.
- The writer wrote
- -
- The reader works out
- -
- So
- -
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
PHONEStable 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
PHONESblock 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,SUBSRCandMULTIP- 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 notesThe 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 0183Digits 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: ASCIITwo 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: NewlineBase64'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 formatEvery 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 format11Quiz: what stayed?
Ten questions. Pick an answer and it is marked at once, with a line on why. Nothing you answer leaves this page.
-
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.
-
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.
-
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.
-
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.
-
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.
-
Answer
832. Blocks of 00064 bytes, 060 of them, the first at offset 00256: 256 + (10 − 1) × 64 = 832.
-
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.
-
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.
-
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.
-
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.
- 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.
- 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.
- 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.
- MIND Technology: Seamap GunLink 4000 data sheet - the gun controller.
- IETF (2006). RFC 4648: The Base16, Base32, and Base64 Data Encodings - the Base64 alphabet.
- Wikipedia: NMEA 0183 - the XOR checksum of a sentence.
- Wikipedia: Longitudinal redundancy check - a check byte made by XOR.
- Wikipedia: ASCII - the codes of the digits.
- Wikipedia: Newline - CR LF and the teletype.
- Wikipedia: Hexadecimal - four bits to a hex digit.