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

MODELS

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

ENVIRONMENT

173       GEOGRAPHICLIB_MAGNETIC_NAME
174           Override the compile-time default magnetic name of "wmm2015".  The
175           -h option reports the value of GEOGRAPHICLIB_MAGNETIC_NAME, if
176           defined, otherwise it reports the compile-time value.  If the -n
177           name option is used, then name takes precedence.
178
179       GEOGRAPHICLIB_MAGNETIC_PATH
180           Override the compile-time default magnetic path.  This is typically
181           "/usr/local/share/GeographicLib/magnetic" on Unix-like systems and
182           "C:/ProgramData/GeographicLib/magnetic" on Windows systems.  The -h
183           option reports the value of GEOGRAPHICLIB_MAGNETIC_PATH, if
184           defined, otherwise it reports the compile-time value.  If the -d
185           dir option is used, then dir takes precedence.
186
187       GEOGRAPHICLIB_DATA
188           Another way of overriding the compile-time default magnetic path.
189           If it is set (and if GEOGRAPHICLIB_MAGNETIC_PATH is not set), then
190           $GEOGRAPHICLIB_DATA/magnetic is used.
191

ERRORS

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

EXAMPLES

202       The magnetic field from WMM2015 in Timbuktu on 2016-01-01
203
204           echo 2016-01-01 16:46:33N 3:00:34W 300 | MagneticField -r
205           => -2.12 12.15 33871.9 33848.7 -1251.4 7293.9 34648.3
206              0.09 -0.08 31.8 33.8 53.7 -41.4 22.3
207
208       The first two numbers returned are the declination and inclination of
209       the field.  The second line gives the annual change.
210

SEE ALSO

212       GeoConvert(1), geographiclib-get-magnetic(8).
213

AUTHOR

215       MagneticField was written by Charles Karney.
216

HISTORY

218       MagneticField was added to GeographicLib,
219       <https://geographiclib.sourceforge.io>, in version 1.15.
220
221
222
223GeographicLib 1.49                2017-10-05                  MAGNETICFIELD(1)
Impressum