WMM coefficient file format for developers
The World Magnetic Model coefficient file is named “WMM.COF”. Numerical values of the Gauss coefficients (g_nm, h_nm, g_dot_nm, h_dot_nm) at the base epoch, their corresponding predictive annual changes for the next 5 years and their associated degrees and orders are provided in this file. For more details about the WMM Gauss coefficients, see section 1.2 of the WMM Technical report. The World Magnetic Model coefficients are written to this file in a specific format. The WMM.COF file format is designed such that, if implemented correctly, an update to a new WMM is done by simply replacing the old “WMM.COF” file with the new “WMM.COF” file, without needing to make any changes to the software. The “WMM.COF” file is an ASCII file with one header line, 90 lines of coefficients data and 2 terminating lines. Each line has 48 characters, ending with a carriage return and a linefeed (\n\r).
Line 1: “Header”
2020.0
|
WMM-2020
|
12/10/2019
|
^
|
^
|
^
|
Model Epoch
|
Model-name
|
Date of release
|
WMM is valid for 5 years from the "Model Epoch" parameter given in decimal years. The "Date of release" of the model has no significance in magnetic field calculation and is US style, MM/DD/YYYY.
Lines 2 to 91: Model coefficients
1
|
0
|
-29404.5
|
0.0
|
6.7
|
0.0
|
^
|
^
|
^
|
^
|
^
|
^
|
n
|
m
|
g_nm
|
h_nm
|
g_dot_nm
|
h_dot_nm
|
Lines 92 and 93: File terminators
999999999999999999999999999999999999999999999999
999999999999999999999999999999999999999999999999
A software implementation for reading WMM.COF should stop when reaching the terminator line.
WMM.COF file format is permanent and we do not anticipate making changes to it in the foreseeable future.
Example code
- FORTRAN
123456789012345678901234567890123456789012345678 (line length 48)
2020.0 WMM-2020 12/10/2019
OPEN (UNIT=9, FILE='WMM.COF')
READ (9, 1) EPOCH,MODEL,RELEASEDATE
1 FORMAT(F10.1,A20,A18)
123123123456789012345678901234567890112345678901 (line length 48)
1 0 -29404.5 0.0 6.7 0.0
READ(9,4) N,M,GNM,HNM,DGNM,DHNM
4 FORMAT(I3,I3,F10.1,F10.1,F11.1,F11.1)
- C
123456789012345678901234567890123456789012345678 (line length 48)
2020.0 WMM-2020 12/10/2019
fscanf(fp, "%4.1f %20s %02d/%02d/%04d", &epoch, model_name, &month, &day, &year);
123123123456789012345678901234567890112345678901 (line length 48)
1 0 -29404.5 0.0 6.7 0.0
fscanf(fp,"%3d%3d%10.1f%10.1f%11.1f%11.1f", &n, &m, &g_nm, &h_nm, &g_dot_nm, &h_dot_nm);
|