34 0.0, -29438.5, -1501.1, 4796.2,
35 -2445.3, 3012.5, -2845.6, 1676.6, -642.0,
36 1351.1, -2352.3, -115.3, 1225.6, 245.0, 581.9, -538.3,
37 907.2, 813.7, 283.4, 120.3, -188.6, -335.0, 180.9, 70.3, -329.5,
38 -232.6, 360.1, 47.4, 192.4, 196.9, -141.0, -119.4, -157.4, 16.1, 4.3, 100.1,
39 69.5, 67.4, -20.7, 72.8, 33.2, -129.8, 58.8, -29.0, -66.5, 13.2, 7.3, -70.9, 62.5,
40 81.6, -76.1, -54.1, -6.8, -19.4, 51.9, 5.6, 15.0, 24.4, 9.3, 3.3, -2.8, -27.5, 6.7, -2.3,
41 24.0, 8.6, 10.2, -16.9, -18.1, -3.2, 13.2, -20.6, -14.6, 13.3, 16.2, 11.7, 5.7, -16.0, -9.1, -2.0, 2.2,
42 5.4, 8.8, -21.6, 3.1, 10.8, -3.1, 11.7, 0.6, -6.8, -13.3, -6.9, -0.1, 7.8, 8.7, 1.0, -9.1, -3.9, -10.5, 8.5,
43 -1.9, -6.5, 3.3, 0.2, -0.3, 0.6, 4.6, -0.6, 4.4, 1.7, -7.9, -0.7, -0.6, 2.1, -4.1, 2.3, -2.8, -1.8, -1.1, -3.6, -8.7,
44 3.1, -1.5, -0.1, -2.3, 2.1, 2.1, -0.7, -0.9, -1.1, 0.6, 0.7, -0.7, -0.2, 0.2, -2.1, 1.7, -1.5, -0.2, -2.5, 0.4, -2.0, 3.5, -2.3,
45 -2.0, -0.3, -1.0, 0.4, 0.5, 1.3, 1.8, -0.9, -2.2, 0.9, 0.3, 0.1, 0.7, 0.5, -0.1, -0.4, 0.3, -0.4, 0.2, 0.2, -0.9, -0.9, -0.2, 0.0, 0.7
50 0.0, 10.7, 17.9, -26.8,
51 -8.6, 0.0, -3.3, -27.1, 2.4, -13.3,
52 3.1, -6.2, 8.4, -0.4, -0.4, -10.4, 2.3,
53 -0.4, 0.8, -0.6, -9.2, 5.3, 4.0, 3.0, -4.2, -5.3,
54 -0.2, 0.1, 0.4, -1.4, 1.6, 0.0, -1.1, 1.3, 3.3, 3.8, 0.1,
55 -0.5, -0.2, 0.0, -0.6, -2.2, 2.4, -0.7, -1.1, 0.1, 0.3, 1.0, 1.5, 1.3,
56 0.2, -0.2, 0.7, -0.4, 0.5, 1.3, -0.2, 0.2, -0.1, -0.4, -0.7, -0.9, 0.1, 0.3, 0.1,
57 0.0, 0.1, -0.3, -0.5, 0.3, 0.5, 0.3, -0.2, 0.6, 0.4, -0.1, 0.2, -0.2, -0.4, 0.3, 0.3, 0.0,
58 0.0, -0.1, -0.2, -0.1, -0.1, 0.4, -0.2, -0.5, 0.1, -0.2, 0.1, 0.1, 0.0, 0.0, -0.2, -0.2, 0.4, -0.1, 0.3,
59 0.0, 0.0, 0.1, -0.1, -0.1, 0.3, 0.0, -0.1, 0.0, -0.1, -0.2, -0.1, 0.1, 0.0, -0.1, -0.2, -0.2, -0.1, 0.1, -0.2, -0.1,
60 0.0, 0.0, 0.0, -0.1, 0.1, 0.1, 0.0, 0.0, 0.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1, 0.0, 0.0, 0.0, -0.1, -0.1, 0.0, -0.1, -0.1,
61 0.1, 0.0, 0.0, 0.0, 0.0, 0.1, -0.1, -0.1, 0.0, 0.0, 0.0, 0.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0
74 k = nmax1 * (nmax1 + 2);
78 k = nmax2 * (nmax2 + 2);
79 l = nmax1 * (nmax1 + 2);
81 for (ii = k + 1; ii <= l; ++ii) {
87 k = nmax1 * (nmax1 + 2);
88 l = nmax2 * (nmax2 + 2);
90 for (ii = k + 1; ii <= l; ++ii) {
91 gh[ii] = factor *
gh2[ii];
98 for (ii = 1; ii <= k; ++ii) {
99 gh[ii] =
gh1[ii] + factor *
gh2[ii];
106 double *geo_mag_y,
double *geo_mag_z,
int16_t iext,
double ext1,
double ext2,
double ext3)
109 double earths_radius = 6371.2;
110 double dtr = 0.01745329;
114 double aa, bb, cc, dd;
124 #ifdef GEO_MAG_DOUBLE
131 int ii, j, k, l,
m, n;
140 argument = flat * dtr;
141 slat = sinf(argument);
142 if ((90.0 - flat) < 0.001) {
145 if ((90.0 + flat) < 0.001) {
152 clat = cosf(argument);
153 argument = flon * dtr;
154 sl[1] = sinf(argument);
155 cl[1] = cosf(argument);
166 npq = (nmax * (nmax + 3)) / 2;
169 aa = a2 * clat * clat;
170 bb = b2 * slat * slat;
174 argument = elev * (elev + 2.0 * dd) + (a2 * aa + b2 * bb) / cc;
176 cd = (elev + dd) / r;
177 sd = (a2 - b2) / dd * slat * clat / r;
179 slat = slat * cd - clat * sd;
180 clat = clat * cd + aa * sd;
183 ratio = earths_radius / r;
188 p[3] = 4.5 * slat * slat - 1.5;
189 p[4] = 3.0 * aa * clat * slat;
192 q[3] = -3.0 * clat * slat;
193 q[4] = aa * (slat * slat - clat * clat);
195 for (k = 1; k <= npq; ++k) {
201 rr = pow(argument, power);
207 argument = (1.0 - 0.5 / fm);
210 p[k] = (1.0 + 1.0 / fm) * aa * clat * p[j];
211 q[k] = aa * (clat * q[j] + slat / fm * p[j]);
212 sl[
m] = sl[m - 1] * cl[1] + cl[m - 1] * sl[1];
213 cl[
m] = cl[m - 1] * cl[1] - sl[m - 1] * sl[1];
215 argument = fn * fn - fm * fm;
217 argument = ((fn - 1.0) * (fn - 1.0)) - (fm * fm);
218 bb = sqrt(argument) / aa;
219 cc = (2.0 * fn - 1.0) / aa;
222 p[k] = (fn + 1.0) * (cc * slat / fn * p[ii] - bb / (fn - 1.0) * p[j]);
223 q[k] = cc * (slat * q[ii] - clat / fn * p[ii]) - bb * q[j];
230 *geo_mag_x = *geo_mag_x + aa * q[k];
231 *geo_mag_z = *geo_mag_z - aa * p[k];
235 cc = aa * cl[
m] + bb * sl[
m];
236 *geo_mag_x = *geo_mag_x + cc * q[k];
237 *geo_mag_z = *geo_mag_z - cc * p[k];
239 *geo_mag_y = *geo_mag_y + (aa * sl[
m] - bb * cl[
m]) *
240 fm * p[k] / ((fn + 1.0) * clat);
242 *geo_mag_y = *geo_mag_y + (aa * sl[
m] - bb * cl[
m]) * q[k] * slat;
249 aa = ext2 * cl[1] + ext3 * sl[1];
250 *geo_mag_x = *geo_mag_x - ext1 * clat + aa * slat;
251 *geo_mag_y = *geo_mag_y + ext2 * sl[1] - ext3 * cl[1];
252 *geo_mag_z = *geo_mag_z + ext1 * slat + aa * clat;
255 *geo_mag_x = *geo_mag_x * cd + *geo_mag_z * sd;
256 *geo_mag_z = *geo_mag_z * cd - aa * sd;
WMM2015 Geomagnetic field model.
int16_t extrapsh(double date, double dte1, int16_t nmax1, int16_t nmax2, double *gh)
const double gh1[MAXCOEFF]
const double gh2[MAXCOEFF]
int16_t mag_calc(int16_t igdgc, double flat, double flon, double elev, int16_t nmax, double *gh, double *geo_mag_x, double *geo_mag_y, double *geo_mag_z, int16_t iext, double ext1, double ext2, double ext3)