author | A.M. Thurnherr <athurnherr@yahoo.com> |
Mon, 23 Feb 2015 09:19:46 +0000 | |
changeset 15 | 3746197831db |
parent 5 | 033a169071de |
permissions | -rw-r--r-- |
5 | 1 |
2009/09/12 Eric Firing |
2 |
||
3 |
This repository contains a modified version of the code |
|
4 |
from Geomag61_unix.tar.gz. The only modification affecting the |
|
5 |
actual calculation is the change from single to double precision; |
|
6 |
this causes some very small differences in output. The other |
|
7 |
modifications are to modernize and modularize the code (which |
|
8 |
has been done only partially so far), and to generate a |
|
9 |
command, magdec, that produces only a single easy-to-parse |
|
10 |
line of output. Magdec takes full advantage of what modernization |
|
11 |
has been done; the geomag command still uses the original |
|
12 |
file-reading code, apart from one bugfix to prevent memory |
|
13 |
corruption and permit compilation with modern versions of |
|
14 |
gcc. |
|
15 |
||
16 |
In addition, I added a minimal Makefile for use on Linux |
|
17 |
systems. If compilation on Windows is needed, then I will |
|
18 |
probably add scons build scripts rather than trying to make |
|
19 |
the Makefile handle Windows. |
|
20 |
||
21 |
A cython interface may also be added. |
|
22 |
||
23 |
================ Changes (see also the hg log) ===================== |
|
24 |
||
25 |
2010/03/04 EF |
|
26 |
Modified for new Geomagnetic model, IGRF11. The file |
|
27 |
format was changed, so geomag and magdec no longer worked with the |
|
28 |
older models. This is not a problem, because the IGRF11 file includes |
|
29 |
models for times past. There were two basic file changes: the order |
|
30 |
of the first two fields (indices) was reversed, and the fields |
|
31 |
were spaced out to allow easier parsing. The lines are still |
|
32 |
80-characters (without the endings), and we are still using this |
|
33 |
fact in the parsing. Now, however, the file is compiled in, so it |
|
34 |
no longer needs to be specified on the command line. |
|
35 |
||
36 |
Rather than update the file parsing in geomag61.c, I deleted it, |
|
37 |
so now only magdec is provided. |
|
38 |
||
15
3746197831db
IX11beta for CLIVAR P16
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
5
diff
changeset
|
39 |
2010/08/20 EF |
3746197831db
IX11beta for CLIVAR P16
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
5
diff
changeset
|
40 |
Added a Makefile.mingw32cross, so that with the ubuntu mingw32 cross |
3746197831db
IX11beta for CLIVAR P16
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
5
diff
changeset
|
41 |
compiler packages installed, one can generate magdec.exe via: |
5 | 42 |
|
15
3746197831db
IX11beta for CLIVAR P16
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
5
diff
changeset
|
43 |
make -f Makefile.mingw32cross |
3746197831db
IX11beta for CLIVAR P16
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
5
diff
changeset
|
44 |
|
3746197831db
IX11beta for CLIVAR P16
A.M. Thurnherr <athurnherr@yahoo.com>
parents:
5
diff
changeset
|
45 |
This will leave magdec.exe in the current directory. |
5 | 46 |
|
47 |
||
48 |
=============== Original README.txt below this line =================== |
|
49 |
||
50 |
This zip file contains the C source code for the NGDC software "Geomag" |
|
51 |
version 6.1 that computes the estimated main magnetic field values for |
|
52 |
given locations and dates (or ranges of dates). Geomag requires a |
|
53 |
magnetic field model file for input. Two models are included in this |
|
54 |
zip: IGRF10 and WMM2005. Use the '.cof' extensions on Windows systems |
|
55 |
and the '.unx' extensions on Unix systems, since text files differ in |
|
56 |
format between the two platforms. The zip and tar files also include |
|
57 |
compiled versions (executables) of Geomag for Windows and Linux. |
|
58 |
||
59 |
||
60 |
Background |
|
61 |
---------- |
|
62 |
The IGRF10 is the tenth generation standard main field model adopted |
|
63 |
by the International Association of Geomagnetism and Aeronomy (IAGA). |
|
64 |
This is a degree and order 13 model for 2005-2010 with models for 1900 |
|
65 |
forward enabling estimation of the main field for dates between |
|
66 |
January 1, 1900 and January 1, 2010. For more information on the IGRF |
|
67 |
and IAGA, visit the IAGA Working Group V-MOD Web site at: |
|
68 |
http://www.ngdc.noaa.gov/IAGA/vmod/ |
|
69 |
||
70 |
The WMM is the standard model for the U.S. and U.K. Departments of Defense |
|
71 |
and for NATO. This is a degree and order 12 main field model for 2005.0 |
|
72 |
and degree and order 12 (computed to 8) secular variation model for 2005 - |
|
73 |
2010. For more information on the WMM or to download the Technical Report, |
|
74 |
visit the WMM Web site at: |
|
75 |
http://www.ngdc.noaa.gov/seg/WMM/ |
|
76 |
||
77 |
||
78 |
The computed magnetic elements are: |
|
79 |
----------------------------------- |
|
80 |
D: Declination |
|
81 |
I: Inclination |
|
82 |
H: Horizontal field strength |
|
83 |
X: North component |
|
84 |
Y: East component |
|
85 |
Z: Down component |
|
86 |
F: Total field strength |
|
87 |
dD,dI,dH,dX,dY,dZ,dF: Change per year of the above quantities. |
|
88 |
||
89 |
||
90 |
To compile this code on unix systems: |
|
91 |
------------------------------------ |
|
92 |
for the Gnu C compiler: |
|
93 |
1) uncomment '#include <math.h>' |
|
94 |
2) gcc -lm geomag61.c -o geomag61.exe |
|
95 |
||
96 |
For Intel: |
|
97 |
1) uncomment '#include <mathimf.h>' |
|
98 |
2) icc -wd1572 -static geomag61.c -o geomag61.exe |
|
99 |
||
100 |
||
101 |
To compile this code on Windows systems: |
|
102 |
---------------------------------------- |
|
103 |
The DOS executable in this distribution was produced with |
|
104 |
Microsoft VisualStudio 2003 .NET, substituting its C++ compiler |
|
105 |
with the Intel C++ compiler. Generate an empty WIN32 console |
|
106 |
project, copy geomag61.c into the source directory, |
|
107 |
convert the project to Intel C++, and build it. |
|
108 |
||
109 |
||
110 |
Command line option: |
|
111 |
-------------------- |
|
112 |
Note that the geomag program can receive parameters on |
|
113 |
the command line. For example: |
|
114 |
geomag61.exe IGRF10.unx 2010.32 D M133.4 10.5 10.5 |
|
115 |
||
116 |
The command line syntax is listed by providing the h option as |
|
117 |
geomag61.exe h |
|
118 |
||
119 |
||
120 |
Spread-sheet option: |
|
121 |
-------------------- |
|
122 |
New in revision 61 is that the program can read a file of |
|
123 |
dates and locations and create a new file with a set of extra |
|
124 |
columns giving the magnetic components. These can then be |
|
125 |
read as columns into a spread sheet program. The dates and |
|
126 |
coordinates have to be given in the same format as for the |
|
127 |
command line option. See also the sample files discussed below. |
|
128 |
||
129 |
For example: |
|
130 |
geomag61.exe IGRF10.unx f in-coords.txt output.txt |
|
131 |
will append the magnetic components and their secualar |
|
132 |
variation to the dates and locations given in 'in-coords.txt' |
|
133 |
and write the result to a file 'output.txt'. |
|
134 |
||
135 |
This distribution contains example files which were produced |
|
136 |
on a Linux system using the commands: |
|
137 |
geomag61.exe IGRF10.unx f sample_coords.txt sample_out_IGRF10.txt |
|
138 |
geomag61.exe WMM2005.unx f sample_coords.txt sample_out_WMM2005.txt |
|
139 |
The same result can be achieved on a Windows system by |
|
140 |
substituting 'IGRF10.unx' with 'IGRF10.cof' and same for WMM2005. |
|
141 |
||
142 |
||
143 |
To run the program with command line arguments under Windows: |
|
144 |
------------------------------------------------------------- |
|
145 |
1) Click on <Start> <Programs> <Accessories> <Command Prompt> |
|
146 |
2) Change directory ('cd') to the folder containg geomag61.exe |
|
147 |
3) Run the program, e.g. 'geomag61.exe IGRF10.cof f in.txt out.txt' |
|
148 |
4) Use the '.cof' model files for Windows, while the '.unx' model |
|
149 |
files should work for Linux. |
|
150 |
||
151 |
||
152 |
Contact: |
|
153 |
-------- |
|
154 |
For further infos, or bug reports, please contact: |
|
155 |
stefan.maus@noaa.gov |