oce (version 1.1-1)

magneticField: Earth magnetic declination, inclination, and intensity

Description

Implements the 12th generation International Geomagnetic Reference Field (IGRF), based on a reworked version of a Fortran program downloaded from a NOAA website [1].

Usage

magneticField(longitude, latitude, time)

Arguments

longitude

longitude in degrees east (negative for degrees west). The dimensions must conform to lat.

latitude

latitude in degrees north, a number, vector, or matrix.

time

The time at which the field is desired. This may be a single value or a vector or matrix that is structured to match longitude and latitude. The value may a decimal year, a POSIXt time, or a Date time.

Value

A list containing declination, inclination, and intensity.

Details

The code (subroutine igrf12syn) seems to have been written by Susan Macmillan of the British Geological Survey. Comments in the source code indicate that it employs coefficients agreed to in December 2014 by the IAGA Working Group V-MOD. Other comments in that code suggest that the valid time interval is from years 1900 to 2020, with only the values from 1945 to 2010 being considered definitive.

Reference [2] suggest that a new version to the underlying source code might be expected in 2019 or 2020, but a check on January 31, 2019, showed that version 12, as incorporated in oce since 2015, remains the active version.

References

1. The underlying Fortran code is from igrf12.f, downloaded the NOAA website (https://www.ngdc.noaa.gov/IAGA/vmod/igrf.html) on June 7, 2015.

2. Witze, Alexandra. “Earth<U+2019>s Magnetic Field Is Acting up and Geologists Don<U+2019>t Know Why.” Nature 565 (January 9, 2019): 143. https://doi.org/10.1038/d41586-019-00007-1.

See Also

Other things related to magnetism: applyMagneticDeclination

Examples

Run this code
# NOT RUN {
library(oce)
# 1. Today's value at Halifax NS
magneticField(-(63+36/60), 44+39/60, Sys.Date())

# 2. World map of declination in year 2000.
# }
# NOT RUN {
data(coastlineWorld)
par(mar=rep(0.5, 4)) # no axes on whole-world projection
mapPlot(coastlineWorld, projection="+proj=robin", col="lightgray")
# Construct matrix holding declination
lon <- seq(-180, 180)
lat <- seq(-90, 90)
dec2000 <- function(lon, lat)
    magneticField(lon, lat, 2000)$declination
dec <- outer(lon, lat, dec2000) # hint: outer() is very handy!
# Contour, unlabelled for small increments, labeled for
# larger increments.
mapContour(lon, lat, dec, col='blue', levels=seq(-180, -5, 5),
           lty=3, drawlabels=FALSE)
mapContour(lon, lat, dec, col='blue', levels=seq(-180, -20, 20))
mapContour(lon, lat, dec, col='red', levels=seq(5, 180, 5),
           lty=3, drawlabels=FALSE)
mapContour(lon, lat, dec, col='red', levels=seq(20, 180, 20))
mapContour(lon, lat, dec, levels=180, col='black', lwd=2, drawlabels=FALSE)
mapContour(lon, lat, dec, levels=0, col='black', lwd=2)
# }
# NOT RUN {
# }

Run the code above in your browser using DataCamp Workspace