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           igrf13, the International Geomagnetic Reference Field (13th
154             generation), which approximates the main magnetic field for
155             the period 1900-2025.  See
156             https://ngdc.noaa.gov/IAGA/vmod/igrf.html
157           emm2010, the Enhanced Magnetic Model 2010, which approximates
158             the main and crustal magnetic fields for the period 2010-2015.
159             See https://ngdc.noaa.gov/geomag/EMM/index.html
160           emm2015, the Enhanced Magnetic Model 2015, which approximates
161             the main and crustal magnetic fields for the period 2000-2020.
162             See https://ngdc.noaa.gov/geomag/EMM/index.html
163           emm2017, the Enhanced Magnetic Model 2017, which approximates
164             the main and crustal magnetic fields for the period 2000-2022.
165             See https://ngdc.noaa.gov/geomag/EMM/index.html
166
167       These models approximate the magnetic field due to the earth's core and
168       (in the case of emm20xx) its crust.  They neglect magnetic fields due
169       to the ionosphere, the magnetosphere, nearby magnetized materials,
170       electrical machinery, etc.
171
172       By default, the "wmm2020" magnetic model is used.  This may changed by
173       setting the environment variable "GEOGRAPHICLIB_MAGNETIC_NAME" or with
174       the -n option.
175
176       The magnetic models will be loaded from a directory specified at
177       compile time.  This may changed by setting the environment variables
178       "GEOGRAPHICLIB_MAGNETIC_PATH" or "GEOGRAPHICLIB_DATA", or with the -d
179       option.  The -h option prints the default magnetic path and name.  Use
180       the -v option to ascertain the full path name of the data file.
181
182       Instructions for downloading and installing magnetic models are
183       available at
184       <https://geographiclib.sourceforge.io/html/magnetic.html#magneticinst>.
185

ENVIRONMENT

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

ERRORS

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

EXAMPLES

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

SEE ALSO

226       GeoConvert(1), geographiclib-get-magnetic(8).
227

AUTHOR

229       MagneticField was written by Charles Karney.
230

HISTORY

232       MagneticField was added to GeographicLib,
233       <https://geographiclib.sourceforge.io>, in version 1.15.
234
235
236
237GeographicLib 1.51                2020-11-22                  MAGNETICFIELD(1)
Impressum