You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: R/functions_coefficients.R
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@
6
6
#'
7
7
#' @param t Annualized date time. E.g., 2015-02-01 = (2015 + 32/365) = 2015.088
8
8
#' @param t0 Annualized reference time associated with \code{t}
9
-
#' @param wmmVersion String representing WMM version to use. Must be consistent with \code{time} and one of the following: 'derived', 'WMM2000', 'WMM2005', 'WMM2010', 'WMM2015', 'WMM2015v2', 'WMM2020'. Default 'derived' value will infer the latest WMM version consistent with \code{time}.
9
+
#' @param wmmVersion String representing WMM version to use. Must be consistent with \code{time} and one of the following: 'derived', 'WMM2000', 'WMM2005', 'WMM2010', 'WMM2015', 'WMM2015v2', 'WMM2020', 'WMM2025'. Default 'derived' value will infer the latest WMM version consistent with \code{time}.
10
10
#'
11
11
#' @return vector of Gauss coefficients, \eqn{g_{n,m}(t)} and \eqn{h_{n,m}(t)}
Copy file name to clipboardExpand all lines: R/functions_misc.R
+16-6Lines changed: 16 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -6,9 +6,14 @@
6
6
#'
7
7
#' @return List of reference year and compatible WMM versions inferred from \code{time}.
8
8
.DeriveVersionInfo<-function(t) {
9
-
output<-if(t>=2025) {
9
+
output<-if(t>=2030) {
10
10
stop('Time value not supported in current version of wmm package.')
11
-
} elseif(t>=2020&t<2025) {
11
+
} elseif(t>=2024+351/366&t<2030) {
12
+
list(
13
+
'year'=2025,
14
+
'version'='WMM2025'
15
+
)
16
+
} elseif(t>=2020&t<2024+351/366) {
12
17
list(
13
18
'year'=2020,
14
19
'version'='WMM2020'
@@ -23,11 +28,16 @@
23
28
'year'=2010,
24
29
'version'='WMM2010'
25
30
)
26
-
} elseif(t>=2005){
31
+
} elseif(t>=2005){
27
32
list(
28
33
'year'=2005,
29
34
'version'='WMM2005'
30
35
)
36
+
} elseif(t>=2000) {
37
+
list(
38
+
'year'=2000,
39
+
'version'='WMM2000'
40
+
)
31
41
} else {
32
42
stop('Time value not supported in current version of wmm package.')
33
43
}
@@ -40,7 +50,7 @@
40
50
#' @noRd
41
51
#'
42
52
#' @param t Annualized date time. E.g., 2015-02-01 = (2015 + 32/365) = 2015.088
43
-
#' @param wmmVersion String representing WMM version to use. Must be consistent with \code{time} and one of the following: 'derived', 'WMM2000', 'WMM2005', 'WMM2010', 'WMM2015', 'WMM2015v2'.
53
+
#' @param wmmVersion String representing WMM version to use. Must be consistent with \code{time} and one of the following: 'derived', 'WMM2000', 'WMM2005', 'WMM2010', 'WMM2015', 'WMM2015v2', 'WMM2020', 'WMM2025'.
44
54
.CheckVersionWMM<-function(t, wmmVersion) {
45
55
# Get what WMM versions are compatible with the input time
46
56
derivedVersionInfo<- .DeriveVersionInfo(t)
@@ -75,11 +85,11 @@
75
85
.CheckBlackoutZone<-function(h) {
76
86
if (h<2000) {
77
87
warning(
78
-
'Location is in the blackout zone around the magnetic pole as defined by the WMM military specification (https://www.ngdc.noaa.gov/geomag/WMM/data/MIL-PRF89500B.pdf). Compass accuracy is highly degraded in this region.'
88
+
'Location is in the blackout zone around the magnetic pole as defined by the WMM military specification (https://www.ngdc.noaa.gov/geomag/WMM/data/MIL-PRF-89500B.pdf). Compass accuracy is highly degraded in this region.'
79
89
)
80
90
} elseif (h<6000) {
81
91
warning(
82
-
'Location is approaching the blackout zone around the magnetic pole as defined by the WMM military specification (https://www.ngdc.noaa.gov/geomag/WMM/data/MIL-PRF89500B.pdf). Compass accuracy may be degraded in this region.'
92
+
'Location is approaching the blackout zone around the magnetic pole as defined by the WMM military specification (https://www.ngdc.noaa.gov/geomag/WMM/data/MIL-PRF-89500B.pdf). Compass accuracy may be degraded in this region.'
Copy file name to clipboardExpand all lines: R/functions_wmm.R
+38-38Lines changed: 38 additions & 38 deletions
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,12 @@
1
-
#' Calculate Expected Magnetic Elements from WMM2020
1
+
#' Calculate Expected Magnetic Elements from WMM2025
2
2
#'
3
3
#' Calculate the magnetic elements (i.e., horizontal intensity, total intensity, inclination, declination, and their secular variation) for given magnetic orthogonal components
4
4
#'
5
5
#' @noRd
6
6
#'
7
7
#' @param orthComps named \code{list} containing magnetic orthogonal components
8
8
#'
9
-
#' @return Expected magnetic components from WMM2020. \code{list}
9
+
#' @return Expected magnetic components from WMM2025. \code{list}
10
10
#'
11
11
.CalculateMagneticElements<-function(
12
12
orthComps
@@ -51,9 +51,9 @@
51
51
return(output)
52
52
}
53
53
54
-
#' Calculate Expected Magnetic Field from WMM2020
54
+
#' Calculate Expected Magnetic Field from WMM2025
55
55
#'
56
-
#' Calculate the magnetic field for a given location and time using the fitted spherical harmonic model from the 2020 World Magnetic Model.
56
+
#' Calculate the magnetic field for a given location and time using the fitted spherical harmonic model from the 2025 World Magnetic Model.
57
57
#'
58
58
#' @noRd
59
59
#'
@@ -62,9 +62,9 @@
62
62
#' @param latGC GPS latitude, geocentric
63
63
#' @param radius Radius of curvature of prime vertical at given geodetic latitude
64
64
#' @param time Annualized date time. E.g., 2015-02-01 = (2015 + 32/365) = 2015.088
65
-
#' @param wmmVersion String representing WMM version to use. Must be consistent with \code{time} and one of the following: 'derived', 'WMM2005', 'WMM2010', 'WMM2015', 'WMM2015v2', 'WMM2020'. Default 'derived' value will infer the latest WMM version consistent with \code{time}.
65
+
#' @param wmmVersion String representing WMM version to use. Must be consistent with \code{time} and one of the following: 'derived', 'WMM2000', 'WMM2005', 'WMM2010', 'WMM2015', 'WMM2015v2', 'WMM2020', 'WMM2025'. Default 'derived' value will infer the latest WMM version consistent with \code{time}.
66
66
#'
67
-
#' @return Expected magnetic field from WMM2020, \eqn{m_{\lambda_t,\varphi_t,h_t,t}^{WMM}}{m_wmm(lambda_t, phi_t, h_t, t)}. \code{list}
67
+
#' @return Expected magnetic field from WMM2025, \eqn{m_{\lambda_t,\varphi_t,h_t,t}^{WMM}}{m_wmm(lambda_t, phi_t, h_t, t)}. \code{list}
68
68
.CalculateMagneticField<-function(
69
69
lon,
70
70
latGD,
@@ -148,7 +148,7 @@
148
148
#' @param lat GPS latitude, geodetic
149
149
#' @param height GPS height in meters above ellipsoid
150
150
#' @param time Annualized date time. E.g., 2015-02-01 = (2015 + 32/365) = 2015.088; optionally an object (length 1) of class 'POSIXt' or 'Date'
151
-
#' @param wmmVersion String representing WMM version to use. Must be consistent with \code{time} and one of the following: 'derived', 'WMM2000', 'WMM2005', 'WMM2010', 'WMM2015', 'WMM2015v2', 'WMM2020'. Default 'derived' value will infer the latest WMM version consistent with \code{time}.
151
+
#' @param wmmVersion String representing WMM version to use. Must be consistent with \code{time} and one of the following: 'derived', 'WMM2000', 'WMM2005', 'WMM2010', 'WMM2015', 'WMM2015v2', 'WMM2020', 'WMM2025'. Default 'derived' value will infer the latest WMM version consistent with \code{time}.
152
152
#'
153
153
#' @return \code{list} of calculated main field and secular variation vector components in nT and nT/yr, resp. The magnetic element intensities (i.e., horizontal and total intensities, h & f) are in nT and the magnetic element angles (i.e., inclination and declination, i & d) are in degrees, with their secular variation in nT/yr and deg/yr, resp.: \code{x}, \code{y}, \code{z}, \code{xDot}, \code{yDot}, \code{zDot}, \code{h}, \code{f}, \code{i}, \code{d}, \code{hDot}, \code{fDot}, \code{iDot}, \code{dDot}
Copy file name to clipboardExpand all lines: README.md
+12-8Lines changed: 12 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@
11
11
# wmm
12
12
The [World Magnetic Model](https://www.ncei.noaa.gov/products/world-magnetic-model) (WMM)
13
13
14
-
The purpose of this package is to make accessible the magnetic field vector components from WMM. The supported date ranges for `wmm` run from 2000-01-01 to 2024-12-31. The magnetic field calculations across this time range agree with the official WMM test values to the precision provided by the authors (see the unit tests of this package for details). I will update this package for each new WMM version. For those that prefer a non-R solution, the authors of WMM provide free software to calculate magnetic field on the official website.
14
+
The purpose of this package is to make accessible the magnetic field vector components from WMM. The supported date ranges for `wmm` run from 2000-01-01 to 2029-12-31. The magnetic field calculations across this time range agree with the official WMM test values to the precision provided by the authors (see the unit tests of this package for details). I will update this package for each new WMM version. For those that prefer a non-R solution, the authors of WMM provide free software to calculate magnetic field on the official website.
In v1.1.2, the only exported function is `GetMagneticFieldWMM`, which returns the orthogonal vector components of the main magnetic field (in nT) and secular variation field (in nT/yr) as predicted by WMM. The magnetic field elements, _h_, _f_, _i_, and _d_ (as well as their secular variation) are returned as well.
33
+
In v1.1.3, the only exported function is `GetMagneticFieldWMM`, which returns the orthogonal vector components of the main magnetic field (in nT) and secular variation field (in nT/yr) as predicted by WMM. The magnetic field elements, _h_, _f_, _i_, and _d_ (as well as their secular variation) are returned as well.
34
34
35
35
Example usage:
36
36
@@ -141,30 +141,34 @@ wmm::GetMagneticFieldWMM(
141
141
142
142
# Citations
143
143
144
-
1. Chulliat, A., W. Brown, P. Alken, C. Beggan, M. Nair, G. Cox, A. Woods,
144
+
1. NOAA NCEI Geomagnetic Modeling Team, British Geological Survey,
145
+
World Magnetic Model 2025, NOAA National Centers for Environmental Information,
146
+
doi: 10.25921/aqfd-sd83, 2024.
147
+
148
+
2. Chulliat, A., W. Brown, P. Alken, C. Beggan, M. Nair, G. Cox, A. Woods,
145
149
S. Macmillan, B. Meyer and M. Paniccia, The US/UK World Magnetic Model for
146
150
2020-2025: Technical Report, National Centers for Environmental Information,
147
151
NOAA, doi: 10.25923/ytk1-yx35, 2020.
148
152
149
-
2. Chulliat, A., W. Brown, P. Alken, S. Macmillan, M. Nair, C. Beggan, A. Woods,
153
+
3. Chulliat, A., W. Brown, P. Alken, S. Macmillan, M. Nair, C. Beggan, A. Woods,
150
154
B. Hamilton, B. Meyer and R. Redmon, 2019, Out-of-Cycle Update of the
151
155
US/UK World Magnetic Model for 2015-2020: Technical Note, National
152
156
Centers for Environmental Information, NOAA. doi: 10.25921/xhr3-0t19
153
157
154
-
3. Chulliat, A., S. Macmillan, P. Alken, C. Beggan, M. Nair, B. Hamilton, A.
158
+
4. Chulliat, A., S. Macmillan, P. Alken, C. Beggan, M. Nair, B. Hamilton, A.
155
159
Woods, V. Ridley, S. Maus and A. Thomson, 2015, The US/UK World
156
160
Magnetic Model for 2015-2020: Technical Report, National Geophysical
157
161
Data Center, NOAA. doi: 10.7289/V5TB14V7
158
162
159
-
4. Maus, S., S. Macmillan, S. McLean, B. Hamilton, A. Thomson,
163
+
5. Maus, S., S. Macmillan, S. McLean, B. Hamilton, A. Thomson,
160
164
M. Nair, and C. Rollins, 2010, The US/UK World Magnetic Model
161
165
for 2010-2015, NOAA Technical Report NESDIS/NGDC.
162
166
163
-
5. McLean, S., S. Macmillan, S. Maus, V. Lesur, A.
167
+
6. McLean, S., S. Macmillan, S. Maus, V. Lesur, A.
164
168
Thomson, and D. Dater, December 2004, The
165
169
US/UK World Magnetic Model for 2005-2010,
166
170
NOAA Technical Report NESDIS/NGDC-1.
167
171
168
-
6. Macmillian, S. and J. M. Quinn, 2000.
172
+
7. Macmillian, S. and J. M. Quinn, 2000.
169
173
“The Derivation of the World Magnetic Model 2000,”
170
174
British Geological Survey Technical Report WM/00/17R.
0 commit comments