A file header included in a data file is at the beginning of the file. Only one file header can be associated with a data file. Alternatively, a file header can be stored in a file separate from the data file.
In the following example, a file header is used to store the minimum
and maximum for each variable and the data are converted from ASCII to
binary. There are two variables, latitude and longitude. The file
header format and data formats are described in the format description
file llmaxmin.fmt.
Here is llmaxmin.fmt:
ASCII_file_header "Latitude/Longitude Limits" minmax_title 1 24 char 0 latitude_min 25 36 double 6 latitude_max 37 46 double 6 longitude_min 47 59 double 6 longitude_max 60 70 double 6 ASCII_data "lat/lon" latitude 1 10 double 6 longitude 12 22 double 6 binary_data "lat/lon" latitude 1 4 long 6 longitude 5 8 long 6
The example ASCII data file llmaxmin.dat contains a file header
and data as described in llmaxmin.fmt.
llmaxmin.dat:
1 2 3 4 5 6 7
1234567890123456789012345678901234567890123456789012345678901234567890
Latitude and Longitude: -83.223548 54.118314 -176.161101 149.408117
-47.303545 -176.161101
-25.928001 0.777265
-28.286662 35.591879
12.588231 149.408117
-83.223548 55.319598
54.118314 -136.940570
38.818812 91.411330
-34.577065 30.172129
27.331551 -155.233735
11.624981 -113.660611
This use of a file header would be appropriate if you were interested in creating maps from large data files. By including maximums and minimums in a header, the scale of the axes can be determined without reading the entire file.
FreeForm ND naming conventions have been followed in this example, so to convert the ASCII data in the example to binary format, use the following simple command:
newform llmaxmin.dat -o llmaxmin.bin
The file header in the example will be written into the binary file as
ASCII text because the header descriptor in llmaxmin.fmt
(ASCII_file_header) does not specify read/write type, so the
format is used for both the input and output header.