Magnetometer Data Archive Format
The magnetometer is configured to send data records every second over a serial link. These records contain the last 8 data samples for the three axes and correspond to an 8Hz sampling rate. The records also contain housekeeping and status information. The records are collected by the samplemag2.py program running under the maccs/magnetometer process group in the Data Transport Network. The data are downsampled to a 2Hz rate at this point.
Each magnetometer record is prefixed with a 9-byte header that contains the timestamp and GPS status. The combined record is then pushed into the transport.maccs.hires newsgroup on the remote station's news server.
The records are later extracted from the newsgroup and archived to disk, both on the remote station and the downstream base stations. The records are simply concatenated together into files for each UTC day.
Individual Record Format
Let's start with a high-level outline view of each data record. These are repeated throughout the file.
| Bytes 00-06 | Timestamp (UTC) |
| Bytes 07-08 | GPS status |
| Bytes 09-XX | Magnetometer data |
Note that the magnetometer data record can be variable in length (although it is usually a fixed size). You need to read the second byte of the magnetometer data record (byte 0x0A) for the length information. Typically, the magnetometer record is 29 bytes long for this system (2Hz sample rate). Your software should not rely on this, however. It should read the length information from the record instead.
Expanded Individual Record Format
We will now look at the format of each section in more detail. All values are bytes, that may need to be combined to yield the final value (ie the year part of the timestamp).
| Byte 00 | Timestamp - year/100 | First two digits of the four digit year |
| Byte 01 | Timestamp - year%100 | Last two digits of the four digit year |
| Byte 02 | Timestamp - month | 1..12 |
| Byte 03 | Timestamp - day of month | 1..31 |
| Byte 04 | Timestamp - hour | 0..23 |
| Byte 05 | Timestamp - minute | 0..59 |
| Byte 06 | Timestamp - second | 0..59 |
| Byte 07 | GPS - valid lock? | 0=No lock, 1=Good lock |
| Byte 08 | GPS - number of satellites | 0..8 |
| Byte 09 | Magnetometer - header | |
| Byte 10 | Magnetometer - num bytes | |
| Byte 11 | Magnetometer - status | see below for bit assignments |
| Byte 12 | Magnetometer - housekeeping | see below for bit assignments |
| Byte 13 | Magnetometer - sequence number | |
| Byte 14 | Magnetometer - head temp | |
| Byte 15 | Magnetometer - elec temp | |
| Byte 16 | Magnetometer - tilt 1 | |
| Byte 17 | Magnetometer - tile 2 | |
| Byte 18 | Magnetometer - data X part 0 | see below for conversion formula |
| Byte 19 | Magnetometer - data X part 1 | |
| Byte 20 | Magnetometer - data X part 2 | |
| Byte 21 | Magnetometer - data Y part 0 | |
| Byte 22 | Magnetometer - data Y part 1 | |
| Byte 23 | Magnetometer - data Y part 2 | |
| Byte 24 | Magnetometer - data Z part 0 | |
| Byte 25 | Magnetometer - data Z part 1 | |
| Byte 26 | Magnetometer - data Z part 2 | |
| .... | (repeat for number samples) | num samples = (num bytes-9)/3/3 |
| Byte N-2 | Magnetometer - checksum | |
| Byte N-1 | Magnetometer - trailer |
Magnetometer Data Sample Conversion Formula
To convert the bytes in the data record to measured values, you need to combine them as:
value = part0*65536 + part1*256 + part2
if value>2**23:
value = value-2**24
To convert the raw counts into nT:
nT = value*0.025
Magnetometer Status Bits
The magnetometer status word (Byte 11) is defined as:
| Bit 0 | General alarm |
| Bit 1 | X ranging |
| Bit 2 | Y ranging |
| Bit 3 | Z ranging |
| Bit 4 | X out of range |
| Bit 5 | Y out of range |
| Bit 6 | Z out of range |
| Bit 7 | Valid 1Hz |
Magnetometer Housekeeping Bits
The magnetometer housekeeping word (Byte 12) is defined as:
| Bit 0 | Initalization complete |
| Bit 1 | ROM error |
| Bit 2 | Active RAM error |
| Bit 3 | Unactive RAM error |
| Bit 4 | Unused |
| Bit 5 | Unused |
| Bit 6 | Unused |
| Bit 7 | Unused |
