1MAGNETICFIELD(1)            GeographicLib Utilities           MAGNETICFIELD(1)
2
3
4

NAME

6       MagneticField -- compute the earth's magnetic field
7

SYNOPSIS

9       MagneticField [ -n name ] [ -d dir ] [ -N Nmax ] [ -M Mmax ] [ -t time
10       | -c time lat h ] [ -r ] [ -w ] [ -T tguard ] [ -H hguard ] [ -p prec ]
11       [ -v ] [ --comment-delimiter commentdelim ] [ --version | -h | --help ]
12       [ --input-file infile | --input-string instring ] [ --line-separator
13       linesep ] [ --output-file outfile ]
14

DESCRIPTION

16       MagneticField reads in times and positions on standard input and prints
17       out the geomagnetic field on standard output and, optionally, its rate
18       of change.
19
20       The input line is of the form time lat lon h. time is a date of the
21       form 2012-07-03, a fractional year such as 2012.5, or the string "now".
22       lat and lon are the latitude and longitude expressed as decimal degrees
23       or degrees, minutes, and seconds; for details on the allowed formats
24       for latitude and longitude, see the "GEOGRAPHIC COORDINATES" section of
25       GeoConvert(1).  h is the height above the ellipsoid in meters; this is
26       optional and defaults to zero.  Alternatively, time can be given on the
27       command line as the argument to the -t option, in which case it should
28       not be included on the input lines.  Finally, the magnetic field can be
29       computed at various points on a circle of latitude (constant time, lat,
30       and h) via the -c option; in this case only the longitude should be
31       given on the input lines.
32
33       The output consists of the following 7 items:
34
35         the declination (the direction of the horizontal component of
36           the magnetic field measured clockwise from north) in degrees,
37         the inclination (the direction of the magnetic field measured
38           down from the horizontal) in degrees,
39         the horizontal field in nanotesla (nT),
40         the north component of the field in nT,
41         the east component of the field in nT,
42         the vertical component of the field in nT (down is positive),
43         the total field in nT.
44
45       If the -r option is given, a second line is printed giving the rates of
46       change of these quantities in degrees/yr and nT/yr.
47
48       The WGS84 ellipsoid is used, a = 6378137 m, f = 1/298.257223563.
49

OPTIONS

51       -n name
52           use magnetic field model name instead of the default "wmm2020".
53           See "MODELS".
54
55       -d dir
56           read magnetic models from dir instead of the default.  See
57           "MODELS".
58
59       -N Nmax
60           limit the degree of the model to Nmax.
61
62       -M Mmax
63           limit the order of the model to Mmax.
64
65       -t time
66           evaluate the field at time instead of reading the time from the
67           input lines.
68
69       -c time lat h
70           evaluate the field on a circle of latitude given by time, lat, h
71           instead of reading these quantities from the input lines.  In this
72           case, MagneticField can calculate the field considerably more
73           quickly.
74
75       -r  toggle whether to report the rates of change of the field.
76
77       -w  toggle the longitude first flag (it starts off); if the flag is on,
78           then on input and output, longitude precedes latitude (except that,
79           on input, this can be overridden by a hemisphere designator, N, S,
80           E, W).
81
82       -T tguard
83           signal an error if time lies tguard years (default 50 yr) beyond
84           the range for the model.
85
86       -H hguard
87           signal an error if h lies hguard meters (default 500000 m) beyond
88           the range for the model.
89
90       -p prec
91           set the output precision to prec (default 1).  Fields are printed
92           with precision with prec decimal places; angles use prec + 1
93           places.
94
95       -v  print information about the magnetic model on standard error before
96           processing the input.
97
98       --comment-delimiter commentdelim
99           set the comment delimiter to commentdelim (e.g., "#" or "//").  If
100           set, the input lines will be scanned for this delimiter and, if
101           found, the delimiter and the rest of the line will be removed prior
102           to processing and subsequently appended to the output line
103           (separated by a space).
104
105       --version
106           print version and exit.
107
108       -h  print usage, the default magnetic path and name, and exit.
109
110       --help
111           print full documentation and exit.
112
113       --input-file infile
114           read input from the file infile instead of from standard input; a
115           file name of "-" stands for standard input.
116
117       --input-string instring
118           read input from the string instring instead of from standard input.
119           All occurrences of the line separator character (default is a
120           semicolon) in instring are converted to newlines before the reading
121           begins.
122
123       --line-separator linesep
124           set the line separator character to linesep.  By default this is a
125           semicolon.
126
127       --output-file outfile
128           write output to the file outfile instead of to standard output; a
129           file name of "-" stands for standard output.
130

MODELS

132       MagneticField computes the geomagnetic field using one of the following
133       models
134
135           wmm2010, the World Magnetic Model 2010, which approximates the
136             main magnetic field for the period 2010-2015.  See
137             https://ngdc.noaa.gov/geomag/WMM/DoDWMM.shtml
138           wmm2015v2, the World Magnetic Model 2015, which approximates the
139             main magnetic field for the period 2015-2020.  See
140             https://ngdc.noaa.gov/geomag/WMM/DoDWMM.shtml
141           wmm2015, a deprecated version of wmm2015v2
142           wmm2020, the World Magnetic Model 2020, which approximates the
143             main magnetic field for the period 2020-2025.  See
144             https://ngdc.noaa.gov/geomag/WMM/DoDWMM.shtml
145           igrf11, the International Geomagnetic Reference Field (11th
146             generation), which approximates the main magnetic field for
147             the period 1900-2015.  See
148             https://ngdc.noaa.gov/IAGA/vmod/igrf.html
149           igrf12, the International Geomagnetic Reference Field (12th
150             generation), which approximates the main magnetic field for
151             the period 1900-2020.  See
152             https://ngdc.noaa.gov/IAGA/vmod/igrf.html
153           emm2010, the Enhanced Magnetic Model 2010, which approximates
154             the main and crustal magnetic fields for the period 2010-2015.
155             See https://ngdc.noaa.gov/geomag/EMM/index.html
156           emm2015, the Enhanced Magnetic Model 2015, which approximates
157             the main and crustal magnetic fields for the period 2000-2020.
158             See https://ngdc.noaa.gov/geomag/EMM/index.html
159           emm2017, the Enhanced Magnetic Model 2017, which approximates
160             the main and crustal magnetic fields for the period 2000-2022.
161             See https://ngdc.noaa.gov/geomag/EMM/index.html
162
163       These models approximate the magnetic field due to the earth's core and
164       (in the case of emm20xx) its crust.  They neglect magnetic fields due
165       to the ionosphere, the magnetosphere, nearby magnetized materials,
166       electrical machinery, etc.
167
168       By default, the "wmm2020" magnetic model is used.  This may changed by
169       setting the environment variable "GEOGRAPHICLIB_MAGNETIC_NAME" or with
170       the -n option.
171
172       The magnetic models will be loaded from a directory specified at
173       compile time.  This may changed by setting the environment variables
174       "GEOGRAPHICLIB_MAGNETIC_PATH" or "GEOGRAPHICLIB_DATA", or with the -d
175       option.  The -h option prints the default magnetic path and name.  Use
176       the -v option to ascertain the full path name of the data file.
177
178       Instructions for downloading and installing magnetic models are
179       available at
180       <https://geographiclib.sourceforge.io/html/magnetic.html#magneticinst>.
181

ENVIRONMENT

183       GEOGRAPHICLIB_MAGNETIC_NAME
184           Override the compile-time default magnetic name of "wmm2020".  The
185           -h option reports the value of GEOGRAPHICLIB_MAGNETIC_NAME, if
186           defined, otherwise it reports the compile-time value.  If the -n
187           name option is used, then name takes precedence.
188
189       GEOGRAPHICLIB_MAGNETIC_PATH
190           Override the compile-time default magnetic path.  This is typically
191           "/usr/local/share/GeographicLib/magnetic" on Unix-like systems and
192           "C:/ProgramData/GeographicLib/magnetic" on Windows systems.  The -h
193           option reports the value of GEOGRAPHICLIB_MAGNETIC_PATH, if
194           defined, otherwise it reports the compile-time value.  If the -d
195           dir option is used, then dir takes precedence.
196
197       GEOGRAPHICLIB_DATA
198           Another way of overriding the compile-time default magnetic path.
199           If it is set (and if GEOGRAPHICLIB_MAGNETIC_PATH is not set), then
200           $GEOGRAPHICLIB_DATA/magnetic is used.
201

ERRORS

203       An illegal line of input will print an error message to standard output
204       beginning with "ERROR:" and causes MagneticField to return an exit code
205       of 1.  However, an error does not cause MagneticField to terminate;
206       following lines will be converted.  If time or h are outside the
207       recommended ranges for the model (but inside the ranges increase by
208       tguard and hguard), a warning is printed on standard error and the
209       field (which may be inaccurate) is returned in the normal way.
210

EXAMPLES

212       The magnetic field from WMM2020 in Timbuktu on 2020-01-01
213
214           echo 2020-01-01 16:46:33N 3:00:34W 300 | MagneticField -r
215           => -1.60 12.00 33973.5 33960.3 -948.1 7223.0 34732.8
216              0.13 -0.02 21.8 23.9 77.9 -8.4 19.5
217
218       The first two numbers returned are the declination and inclination of
219       the field.  The second line gives the annual change.
220

SEE ALSO

222       GeoConvert(1), geographiclib-get-magnetic(8).
223

AUTHOR

225       MagneticField was written by Charles Karney.
226

HISTORY

228       MagneticField was added to GeographicLib,
229       <https://geographiclib.sourceforge.io>, in version 1.15.
230
231
232
233GeographicLib 1.50.1              2019-12-12                  MAGNETICFIELD(1)
Impressum