magvar 2.0.0 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/magvar.js +1 -1
- package/test/magvar.test.js +1 -7
package/package.json
CHANGED
package/src/magvar.js
CHANGED
package/test/magvar.test.js
CHANGED
|
@@ -6,12 +6,6 @@ describe('MagVar tests', () => {
|
|
|
6
6
|
// you can use the online calculator at
|
|
7
7
|
// http://www.geomag.bgs.ac.uk/data_service/models_compass/wmm_calc.html
|
|
8
8
|
|
|
9
|
-
test('can calculate Magvar for a spot location', () => {
|
|
10
|
-
const lat = 51.2;
|
|
11
|
-
const lon = -0.3;
|
|
12
|
-
expect(magvar(lat, lon)).toBeCloseTo(0.873, 1);
|
|
13
|
-
});
|
|
14
|
-
|
|
15
9
|
test('can calculate Magvar using the World Magnetic Model 2025-2030 test data', () => {
|
|
16
10
|
testData.forEach((test) => {
|
|
17
11
|
const year = Math.trunc(test[0]);
|
|
@@ -29,7 +23,7 @@ describe('MagVar tests', () => {
|
|
|
29
23
|
const lat = 51.2;
|
|
30
24
|
const lon = -0.3;
|
|
31
25
|
const d = new Date();
|
|
32
|
-
const julianDaysNow = gregorianToJulian(d.getFullYear(), d.getMonth(), d.
|
|
26
|
+
const julianDaysNow = gregorianToJulian(d.getFullYear(), d.getMonth(), d.getDate());
|
|
33
27
|
const magVarNow = calculateMagVar(julianDaysNow, lat, lon, 0);
|
|
34
28
|
expect(magvar(lat, lon)).toBeCloseTo(magVarNow, 1);
|
|
35
29
|
});
|