Skip to content

Commit

Permalink
Merge pull request stephent#18 from stephent/development/WMM2015v2
Browse files Browse the repository at this point in the history
Development/wmm2015v2
  • Loading branch information
stephent authored Feb 4, 2019
2 parents 9de99bd + 52e47d5 commit 41c6120
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 112 deletions.
178 changes: 89 additions & 89 deletions ObjectiveWMM/WMM.COF
Original file line number Diff line number Diff line change
@@ -1,93 +1,93 @@
2015.0 WMM-2015 12/15/2014
1 0 -29438.5 0.0 10.7 0.0
1 1 -1501.1 4796.2 17.9 -26.8
2 0 -2445.3 0.0 -8.6 0.0
2 1 3012.5 -2845.6 -3.3 -27.1
2 2 1676.6 -642.0 2.4 -13.3
3 0 1351.1 0.0 3.1 0.0
3 1 -2352.3 -115.3 -6.2 8.4
3 2 1225.6 245.0 -0.4 -0.4
3 3 581.9 -538.3 -10.4 2.3
4 0 907.2 0.0 -0.4 0.0
4 1 813.7 283.4 0.8 -0.6
4 2 120.3 -188.6 -9.2 5.3
4 3 -335.0 180.9 4.0 3.0
4 4 70.3 -329.5 -4.2 -5.3
5 0 -232.6 0.0 -0.2 0.0
5 1 360.1 47.4 0.1 0.4
5 2 192.4 196.9 -1.4 1.6
5 3 -141.0 -119.4 0.0 -1.1
5 4 -157.4 16.1 1.3 3.3
5 5 4.3 100.1 3.8 0.1
6 0 69.5 0.0 -0.5 0.0
6 1 67.4 -20.7 -0.2 0.0
6 2 72.8 33.2 -0.6 -2.2
6 3 -129.8 58.8 2.4 -0.7
6 4 -29.0 -66.5 -1.1 0.1
6 5 13.2 7.3 0.3 1.0
6 6 -70.9 62.5 1.5 1.3
7 0 81.6 0.0 0.2 0.0
7 1 -76.1 -54.1 -0.2 0.7
7 2 -6.8 -19.4 -0.4 0.5
7 3 51.9 5.6 1.3 -0.2
7 4 15.0 24.4 0.2 -0.1
7 5 9.3 3.3 -0.4 -0.7
7 6 -2.8 -27.5 -0.9 0.1
7 7 6.7 -2.3 0.3 0.1
8 0 24.0 0.0 0.0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10 0.2 -0.9 -0.0 -0.0
12 11 -0.9 -0.2 -0.0 0.0
12 12 -0.0 0.8 -0.1 -0.1
999999999999999999999999999999999999999999999999
999999999999999999999999999999999999999999999999
10 changes: 5 additions & 5 deletions ObjectiveWMM/WMM/GeomagnetismLibrary.c
Original file line number Diff line number Diff line change
Expand Up @@ -1710,35 +1710,35 @@ CALLS : none
if(MagneticModel == NULL)
{
MAG_Error(2);
return FALSE;
return (MAGtype_MagneticModel *) FALSE;
}

MagneticModel->Main_Field_Coeff_G = (double *) malloc((NumTerms + 1) * sizeof ( double));

if(MagneticModel->Main_Field_Coeff_G == NULL)
{
MAG_Error(2);
return FALSE;
return (MAGtype_MagneticModel *) FALSE;
}

MagneticModel->Main_Field_Coeff_H = (double *) malloc((NumTerms + 1) * sizeof ( double));

if(MagneticModel->Main_Field_Coeff_H == NULL)
{
MAG_Error(2);
return FALSE;
return (MAGtype_MagneticModel *) FALSE;
}
MagneticModel->Secular_Var_Coeff_G = (double *) malloc((NumTerms + 1) * sizeof ( double));
if(MagneticModel->Secular_Var_Coeff_G == NULL)
{
MAG_Error(2);
return FALSE;
return (MAGtype_MagneticModel *) FALSE;
}
MagneticModel->Secular_Var_Coeff_H = (double *) malloc((NumTerms + 1) * sizeof ( double));
if(MagneticModel->Secular_Var_Coeff_H == NULL)
{
MAG_Error(2);
return FALSE;
return (MAGtype_MagneticModel *) FALSE;
}
MagneticModel->CoefficientFileEndDate = 0;
MagneticModel->EditionDate = 0;
Expand Down
31 changes: 16 additions & 15 deletions ObjectiveWMMTests/DeclinationTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ - (void) testDeclination01 {
CCMagneticDeclination *declination = [[CCMagneticModel instance] declinationForCoordinate:coord elevation:0 date:date];

NSLog(@"declination = %f", declination.magneticDeclination);
XCTAssertEqualWithAccuracy(declination.magneticDeclination, -3.85, 0.005, @"Unexpected declination");
XCTAssertEqualWithAccuracy(declination.magneticDeclination, -3.90, 0.005, @"Unexpected declination");

}

Expand All @@ -80,7 +80,7 @@ - (void) testDeclination02 {
CCMagneticDeclination *declination = [[CCMagneticModel instance] declinationForCoordinate:coord elevation:0 date:date];

NSLog(@"declination = %f", declination.magneticDeclination);
XCTAssertEqualWithAccuracy(declination.magneticDeclination, 0.57, 0.005, @"Unexpected declination");
XCTAssertEqualWithAccuracy(declination.magneticDeclination, 0.55, 0.005, @"Unexpected declination");

}

Expand All @@ -104,7 +104,7 @@ - (void) testDeclination04 {
CCMagneticDeclination *declination = [[CCMagneticModel instance] declinationForCoordinate:coord elevation:100000 date:date];

NSLog(@"declination = %f", declination.magneticDeclination);
XCTAssertEqualWithAccuracy(declination.magneticDeclination, -4.27, 0.005, @"Unexpected declination");
XCTAssertEqualWithAccuracy(declination.magneticDeclination, -4.32, 0.005, @"Unexpected declination");

}

Expand All @@ -116,7 +116,7 @@ - (void) testDeclination05 {
CCMagneticDeclination *declination = [[CCMagneticModel instance] declinationForCoordinate:coord elevation:100000 date:date];

NSLog(@"declination = %f", declination.magneticDeclination);
XCTAssertEqualWithAccuracy(declination.magneticDeclination, 0.56, 0.005, @"Unexpected declination");
XCTAssertEqualWithAccuracy(declination.magneticDeclination, 0.54, 0.005, @"Unexpected declination");

}

Expand All @@ -140,7 +140,7 @@ - (void) testDeclination07 {
CCMagneticDeclination *declination = [[CCMagneticModel instance] declinationForCoordinate:coord elevation:0 date:date];

NSLog(@"declination = %f", declination.magneticDeclination);
XCTAssertEqualWithAccuracy(declination.magneticDeclination, -2.75, 0.005, @"Unexpected declination");
XCTAssertEqualWithAccuracy(declination.magneticDeclination, -2.59, 0.005, @"Unexpected declination");

}

Expand All @@ -152,7 +152,7 @@ - (void) testDeclination08 {
CCMagneticDeclination *declination = [[CCMagneticModel instance] declinationForCoordinate:coord elevation:0 date:date];

NSLog(@"declination = %f", declination.magneticDeclination);
XCTAssertEqualWithAccuracy(declination.magneticDeclination, 0.32, 0.005, @"Unexpected declination");
XCTAssertEqualWithAccuracy(declination.magneticDeclination, 0.37, 0.005, @"Unexpected declination");

}

Expand All @@ -164,7 +164,7 @@ - (void) testDeclination09 {
CCMagneticDeclination *declination = [[CCMagneticModel instance] declinationForCoordinate:coord elevation:0 date:date];

NSLog(@"declination = %f", declination.magneticDeclination);
XCTAssertEqualWithAccuracy(declination.magneticDeclination, 69.58, 0.006, @"Unexpected declination");
XCTAssertEqualWithAccuracy(declination.magneticDeclination, 69.59, 0.006, @"Unexpected declination");

}

Expand All @@ -176,7 +176,7 @@ - (void) testDeclination10 {
CCMagneticDeclination *declination = [[CCMagneticModel instance] declinationForCoordinate:coord elevation:100000 date:date];

NSLog(@"declination = %f", declination.magneticDeclination);
XCTAssertEqualWithAccuracy(declination.magneticDeclination, -3.17, 0.005, @"Unexpected declination");
XCTAssertEqualWithAccuracy(declination.magneticDeclination, -3.01, 0.005, @"Unexpected declination");

}

Expand All @@ -188,7 +188,7 @@ - (void) testDeclination11 {
CCMagneticDeclination *declination = [[CCMagneticModel instance] declinationForCoordinate:coord elevation:100000 date:date];

NSLog(@"declination = %f", declination.magneticDeclination);
XCTAssertEqualWithAccuracy(declination.magneticDeclination, 0.32, 0.005, @"Unexpected declination");
XCTAssertEqualWithAccuracy(declination.magneticDeclination, 0.36, 0.005, @"Unexpected declination");

}

Expand All @@ -200,11 +200,12 @@ - (void) testDeclination12 {
CCMagneticDeclination *declination = [[CCMagneticModel instance] declinationForCoordinate:coord elevation:100000 date:date];

NSLog(@"declination = %f", declination.magneticDeclination);
XCTAssertEqualWithAccuracy(declination.magneticDeclination, 69.00, 0.005, @"Unexpected declination");
XCTAssertEqualWithAccuracy(declination.magneticDeclination, 69.01, 0.005, @"Unexpected declination");

}

// Subsequent test values obtained from http://www.ngdc.noaa.gov/geomag-web/#igrfwmm with model set to WMM2015
// 4 Feb 2019: expected results updated from http://www.ngdc.noaa.gov/geomag-web/#igrfwmm - although not stated, this online calculator appears to have been updated to use WMM2015v2 COF

- (void) testDeclination13 {

Expand All @@ -216,7 +217,7 @@ - (void) testDeclination13 {
CCMagneticDeclination *declination = [[CCMagneticModel instance] declinationForCoordinate:coord elevation:1630.0 date:date];

NSLog(@"declination = %f", declination.magneticDeclination);
XCTAssertEqualWithAccuracy(declination.magneticDeclination, 8.3790, 0.001, @"Unexpected declination");
XCTAssertEqualWithAccuracy(declination.magneticDeclination, 8.4116, 0.001, @"Unexpected declination");

}

Expand All @@ -230,7 +231,7 @@ - (void) testDeclination14 {
CCMagneticDeclination *declination = [[CCMagneticModel instance] declinationForCoordinate:coord elevation:22.0 date:date];

NSLog(@"declination = %f", declination.magneticDeclination);
XCTAssertEqualWithAccuracy(declination.magneticDeclination, -0.19978, 0.002, @"Unexpected declination");
XCTAssertEqualWithAccuracy(declination.magneticDeclination, -0.0432, 0.002, @"Unexpected declination");

}

Expand All @@ -244,7 +245,7 @@ - (void) testDeclination15 {
CCMagneticDeclination *declination = [[CCMagneticModel instance] declinationForCoordinate:coord elevation:54.0 date:date];

NSLog(@"declination = %f", declination.magneticDeclination);
XCTAssertEqualWithAccuracy(declination.magneticDeclination, 12.60236, 0.003, @"Unexpected declination");
XCTAssertEqualWithAccuracy(declination.magneticDeclination, 12.5805, 0.003, @"Unexpected declination");
}

- (void) testInvalidDate01 {
Expand Down Expand Up @@ -286,7 +287,7 @@ - (void) testTrueHeading01 {
CCMagneticDeclination *declination = [[CCMagneticModel instance] declinationForCoordinate:coord elevation:1630.0 date:date];

NSLog(@"declination = %f", declination.magneticDeclination);
XCTAssertEqualWithAccuracy([declination trueHeadingFromMagneticHeading:94.0], 94.0 + 8.37904, 0.001, @"Unexpected true heading");
XCTAssertEqualWithAccuracy([declination trueHeadingFromMagneticHeading:94.0], 94.0 + 8.4116, 0.001, @"Unexpected true heading");

}

Expand All @@ -300,7 +301,7 @@ - (void) testMagneticHeading01 {
CCMagneticDeclination *declination = [[CCMagneticModel instance] declinationForCoordinate:coord elevation:1630.0 date:date];

NSLog(@"declination = %f", declination.magneticDeclination);
XCTAssertEqualWithAccuracy([declination magneticHeadingFromTrueHeading:94.0 + 8.37904], 94.0, 0.001, @"Unexpected magnetic heading");
XCTAssertEqualWithAccuracy([declination magneticHeadingFromTrueHeading:94.0 + 8.4116], 94.0, 0.001, @"Unexpected magnetic heading");

}

Expand Down
6 changes: 3 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ObjectiveWMM
============

An Objective-C iOS wrapper for the World Magnetic Model 2015.
An Objective-C iOS wrapper for the [World Magnetic Model 2015v2](https://www.ngdc.noaa.gov/geomag/WMM/DoDWMM.shtml).

ObjectiveWMM is a simple repackaging for iOS of the C-language World Magnetic Model published by the United States’ National Geospatial-Intelligence Agency (NGA) and the United Kingdom’s Defence Geographic Centre (DGC).

Expand Down Expand Up @@ -51,7 +51,7 @@ The project includes a number of unit tests that utilize the [WMM2015 Test Value

In addition, a small number of test cases have been added, with test results taken from the DoD World Magnetic Model [Single Point Calculator](http://www.ngdc.noaa.gov/geomag-web/#igrfwmm) (2015 - 2020), configured to use WMM2015 (rather than IGRF 2011).

Finally, tests are included to validate model boundary dates. WMM 2015 is intended for use with dates falling in the years 2015-2020 only.
Finally, tests are included to validate model boundary dates. WMM 2015v2 is intended for use with dates falling in the years 2015-2020 only.

## Modifications to WMM source

Expand Down Expand Up @@ -80,7 +80,7 @@ ObjectiveWMM by [stephentrainor](https://github.com/stephent/).

## License

ObjectiveWMM includes portions of the WMM source code distributed by NGDC.
ObjectiveWMM includes portions of the WMM source code distributed by NCEI.

The WMM source code is in the public domain and not licensed or under copyright. The information and software may be used freely by the public. As required by 17 U.S.C. 403, third parties producing copyrighted works consisting predominantly of the material produced by U.S. government agencies must provide notice with such work(s) identifying the U.S. Government material incorporated and stating that such material is not subject to copyright protection.

Expand Down

0 comments on commit 41c6120

Please sign in to comment.