Provided by: geographiclib-tools_1.21-1ubuntu1_amd64
MagneticField -- compute the earth's magnetic field
MagneticField [ -n name ] [ -d dir ] [ -t time | -c time lat h ] [ -r ] [ -T tguard ] [ -H hguard ] [ -p prec ] [ -v ] [ --comment-delimiter commentdelim ] [ --version | -h | --help ] [ --input-file infile | --input-string instring ] [ --line-separator linesep ] [ --output-file outfile ]
MagneticField reads in times and positions on standard input and prints out the geomagnetic field on standard output and, optionally, its rate of change. The input line is of the form time lat lon h. time is a date of the form 2012-07-03 or a fractional year such as 2012.5. lat and lon are the latitude and longitude expressed as decimal degrees or degrees, minutes, and seconds; see GeoConvert(1) for details. h is the height above the ellipsoid in meters; this is optional and defaults to zero. Alternatively, time can be given on the command line as the argument to the -t option, in which case it should not be included on the input lines. Finally, the magnetic field can be computed at various points on a circle of latitude (constant time, lat, and h) via the -c option; in this case only the longitude should be given on the input lines. The output consists of the following 7 items: the declination (the direction of the horizontal component of the magnetic field measured clockwise from north) in degrees, the inclination (the direction of the magnetic field measured down from the horizontal) in degrees, the horizontal field in nanotesla (nT), the north component of the field in nT, the east component of the field in nT, the vertical component of the field in nT (down is positive), the total field in nT. If the -r option is given, a second line is printed giving the rates of change of these quantities in degrees/yr and nT/yr. The WGS84 ellipsoid is used, a = 6378137 m, f = 1/298.257223563.
-n use magnetic field model name instead of the default "wmm2010". See MODELS. -d read magnetic models from dir instead of the default. See MODELS. -t evaluate the field at time instead of reading the time from the input lines. -c evaluate the field on a circle of latitude given by time, lat, h instead of reading these quantities from the input lines. In this case, MagneticField can calculate the field considerably more quickly. -r toggle whether to report the rates of change of the field. -T signal an error if time lies tguard years (default 50 yr) beyond the range for the model. -H signal an error if h lies hguard meters (default 500000 m) beyond the range for the model. -p set the output precision to prec (default 1). Fields are printed with precision with prec decimal places; angles use prec + 1 places. -v print information about the magnetic model on standard error before processing the input. --comment-delimiter set the comment delimiter to commentdelim (e.g., "#" or "//"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space). --version print version and exit. -h print usage, the default magnetic path and name, and exit. --help print full documentation and exit. --input-file read input from the file infile instead of from standard input; a file name of "-" stands for standard input. --input-string read input from the string instring instead of from standard input. All occurrences of the line separator character (default is a semicolon) in instring are converted to newlines before the reading begins. --line-separator set the line separator character to linesep. By default this is a semicolon. --output-file write output to the file outfile instead of to standard output; a file name of "-" stands for standard output.
MagneticField computes the geomagnetic field using one of the following models wmm2010, the World Magnetic Model 2010, which approximates the main magnetic field for the period 2010aXX2015. See http://ngdc.noaa.gov/geomag/WMM/DoDWMM.shtml igrf11, the International Geomagnetic Reference Field (11th generation) which approximates the main magnetic field for the period 1900aXX2015. See http://ngdc.noaa.gov/IAGA/vmod/igrf.html emm2010, the Enhanced Magnetic Model 2010, which approximates the main and crustal magnetic fields for the period 2010aXX2015. See http://ngdc.noaa.gov/geomag/EMM/index.html These models approximate the magnetic field due to the earth's core and (in the case of emm2010) its crust. They neglect magnetic fields due to the ionosphere, the magnetosphere, nearby magnetized materials, electrical machinery, etc. By default, the "wmm2010" magnetic model is used. This may changed by setting the environment variable "MAGNETIC_NAME" or with the -n option. The magnetic models will be loaded from a directory specified at compile time. This may changed by setting the environment variables "MAGNETIC_PATH" or "GEOGRAPHICLIB_DATA", or with the -d option. The -h option prints the default magnetic path and name. Use the -v option to ascertain the full path name of the data file. Instructions for downloading and installing magnetic models are available at <http://geographiclib.sf.net/html/magnetic.html#magneticinst>.
MAGNETIC_NAME Override the compile-time default magnetic name of "wmm2010". The -h option reports the value of MAGNETIC_NAME, if defined, otherwise it reports the compile-time value. If the -n name option is used, then name takes precedence. MAGNETIC_PATH Override the compile-time default magnetic path. This is typically "/usr/local/share/GeographicLib/magnetic" on Unix-like systems and "C:/Documents and Settings/All Users/Application Data/GeographicLib/magnetic" on Windows systems. The -h option reports the value of MAGNETIC_PATH, if defined, otherwise it reports the compile-time value. If the -d dir option is used, then dir takes precedence. GEOGRAPHICLIB_DATA Another way of overriding the compile-time default magnetic path. If it is set (and if MAGNETIC_PATH is not set), then $GEOGRAPHICLIB_DATA/magnetic is used.
An illegal line of input will print an error message to standard output beginning with "ERROR:" and causes MagneticField to return an exit code of 1. However, an error does not cause MagneticField to terminate; following lines will be converted. If time or h are outside the recommended ranges for the model (but inside the ranges increase by tguard and hguard), a warning is printed on standard error and the field (which may be inaccurate) is returned in the normal way.
The magnetic field from WMM2010 in Timbuktu on 2012-01-01 echo 2012-01-01 16:46:33N 3:00:34W 300 | MagneticField -r => -2.55 12.43 33771.0 33737.6 -1500.5 7446.0 34582.1 0.10 -0.07 34.3 36.8 54.4 -35.3 25.9 The first two numbers returned are the declination and inclination of the field. The second line gives the annual change.
MagneticField was written by Charles Karney.
MagneticField was added to GeographicLib, <http://geographiclib.sf.net>, in version 1.15.