Record headers occur once for every block of data in a file. They are interspersed with the data, a configuration sometimes called a format sandwich. Record headers can also be stored together in a separate file.
The following format description file specifies a record header and ASCII and binary data formats for aeromagnetic trackline data.
Here is aeromag.fmt:
ASCII_record_header "Aeromagnetic Record Header Format" flight_line_number 1 5 long 0 count 6 13 long 0 fiducial_number_corresponding_to_first_logical_record 14 22 long 0 date_MMDDYY_or_julian_day 23 30 long 0 flight_number 31 38 long 0 utm_easting_of_first_record 39 48 float 0 utm_northing_of_first_record 49 58 float 0 utm_easting_of_last_record 59 68 float 0 utm_northing_of_last_record 69 78 float 0 blank_padding 79 104 char 0 ASCII_data "Aeromagnetic ASCII Data Format" flight_line_number 1 5 long 0 fiducial_number 6 15 long 0 utm_easting_meters 16 25 float 0 utm_northing_meters 26 35 float 0 mag_total_field_intensity_nT 36 45 long 0 mag_residual_field_nT 46 55 long 0 alt_radar_meters 56 65 long 0 alt_barometric_meters 66 75 long 0 blank 76 80 char 0 latitude 81 92 float 6 longitude 93 104 float 6 binary_data "Aeromagnetic Binary Data Format" flight_line_number 1 4 long 0 fiducial_number 5 8 long 0 utm_easting_meters 9 12 long 0 utm_northing_meters 13 16 long 0 mag_total_field_intensity_nT 17 20 long 0 mag_residual_field_nT 21 24 long 0 alt_radar_meters 25 28 long 0 alt_barometric_meters 29 32 long 0 blank 33 37 char 0 latitude 38 41 long 6 longitude 42 45 long 6
The example ASCII file aeromag.dat contains two record headers
followed by a number of data records. The header and data formats are
described in aeromag.fmt. The variable count (second variable
defined in the header format description) is used to indicate how many
data records occur after each header.
aeromag.dat:
1 2 3 4 5 6 7 8 9 10
123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345
420 5 5272 178 2 413669. 6669740. 333345. 6751355.
420 5272 413669. 6669740. 2715963 2715449 1088 1348 60.157307 -154.555191
420 5273 413635. 6669773. 2715977 2715464 1088 1350 60.157593 -154.555817
420 5274 413601. 6669807. 2716024 2715511 1088 1353 60.157894 -154.556442
420 5275 413567. 6669841. 2716116 2715603 1079 1355 60.158188 -154.557068
420 5276 413533. 6669875. 2716263 2715750 1079 1358 60.158489 -154.557693
411 10 8366 178 2 332640. 6749449. 412501. 6668591.
411 8366 332640. 6749449. 2736555 2736538 963 1827 60.846806 -156.080185
411 8367 332674. 6749415. 2736539 2736522 932 1827 60.846516 -156.079529
411 8368 332708. 6749381. 2736527 2736510 917 1829 60.846222 -156.078873
411 8369 332742. 6749347. 2736516 2736499 922 1832 60.845936 -156.078217
411 8370 332776. 6749313. 2736508 2736491 946 1839 60.845642 -156.077560
411 8371 332810. 6749279. 2736505 2736488 961 1846 60.845348 -156.076904
411 8372 332844. 6749245. 2736493 2736476 982 1846 60.845062 -156.076248
411 8373 332878. 6749211. 2736481 2736463 1015 1846 60.844769 -156.075607
411 8374 332912. 6749177. 2736470 2736452 1029 1846 60.844479 -156.074951
411 8375 332946. 6749143. 2736457 2736439 1041 1846 60.844189 -156.074295
This file contains two record headers. The first occurs on the first line of the file and has a count of 5, so it is followed by 5 data records. The second record header follows the first 5 data records. It has a count of 10 and is followed by 10 data records.
The FreeForm ND default naming conventions have been used here so you
could use the following abbreviated command to reformat
aeromag.dat to a binary file named aeromag.bin:
newform aeromag.dat -o aeromag.bin
The ASCII record headers are written into the binary file as ASCII text.