diff --git a/ObjectiveWMM/WMM.COF b/ObjectiveWMM/WMM.COF old mode 100644 new mode 100755 index 31bf3b6..7940efb --- a/ObjectiveWMM/WMM.COF +++ b/ObjectiveWMM/WMM.COF @@ -1,93 +1,93 @@ - 2015.0 WMM-2015v2 09/18/2018 - 1 0 -29438.2 0.0 7.0 0.0 - 1 1 -1493.5 4796.3 9.0 -30.2 - 2 0 -2444.5 0.0 -11.0 0.0 - 2 1 3014.7 -2842.4 -6.2 -29.6 - 2 2 1679.0 -638.8 0.3 -17.3 - 3 0 1351.8 0.0 2.4 0.0 - 3 1 -2351.6 -113.7 -5.7 6.5 - 3 2 1223.6 246.5 2.0 -0.8 - 3 3 582.3 -537.4 -11.0 -2.0 - 4 0 907.5 0.0 -0.8 0.0 - 4 1 814.8 283.3 -0.9 -0.4 - 4 2 117.8 -188.6 -6.5 5.8 - 4 3 -335.6 180.7 5.2 3.8 - 4 4 69.7 -330.0 -4.0 -3.5 - 5 0 -232.9 0.0 -0.3 0.0 - 5 1 360.1 46.9 0.6 0.2 - 5 2 191.7 196.5 -0.8 2.3 - 5 3 -141.3 -119.9 0.1 -0.0 - 5 4 -157.2 16.0 1.2 3.3 - 5 5 7.7 100.6 1.4 -0.6 - 6 0 69.4 0.0 -0.8 0.0 - 6 1 67.7 -20.1 -0.5 0.3 - 6 2 72.3 32.8 -0.1 -1.5 - 6 3 -129.1 59.1 1.6 -1.2 - 6 4 -28.4 -67.1 -1.6 0.4 - 6 5 13.6 8.1 0.0 0.2 - 6 6 -70.3 61.9 1.2 1.3 - 7 0 81.7 0.0 -0.3 0.0 - 7 1 -75.9 -54.3 -0.2 0.6 - 7 2 -7.1 -19.5 -0.3 0.5 - 7 3 52.2 6.0 0.9 -0.8 - 7 4 15.0 24.5 0.1 -0.2 - 7 5 9.1 3.5 -0.6 -1.1 - 7 6 -3.0 -27.7 -0.9 0.1 - 7 7 5.9 -2.9 0.7 0.2 - 8 0 24.2 0.0 -0.1 0.0 - 8 1 8.9 10.1 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0 - 12 2 0.5 0.3 -0.0 0.0 - 12 3 1.2 1.8 0.0 -0.1 - 12 4 -0.9 -2.2 -0.1 0.1 - 12 5 0.9 0.3 -0.0 -0.0 - 12 6 0.1 0.7 0.0 0.0 - 12 7 0.6 -0.1 -0.0 -0.0 - 12 8 -0.4 0.3 0.0 0.0 - 12 9 -0.5 0.2 -0.0 0.0 - 12 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 + 2020.0 WMM-2020 12/10/2019 + 1 0 -29404.5 0.0 6.7 0.0 + 1 1 -1450.7 4652.9 7.7 -25.1 + 2 0 -2500.0 0.0 -11.5 0.0 + 2 1 2982.0 -2991.6 -7.1 -30.2 + 2 2 1676.8 -734.8 -2.2 -23.9 + 3 0 1363.9 0.0 2.8 0.0 + 3 1 -2381.0 -82.2 -6.2 5.7 + 3 2 1236.2 241.8 3.4 -1.0 + 3 3 525.7 -542.9 -12.2 1.1 + 4 0 903.1 0.0 -1.1 0.0 + 4 1 809.4 282.0 -1.6 0.2 + 4 2 86.2 -158.4 -6.0 6.9 + 4 3 -309.4 199.8 5.4 3.7 + 4 4 47.9 -350.1 -5.5 -5.6 + 5 0 -234.4 0.0 -0.3 0.0 + 5 1 363.1 47.7 0.6 0.1 + 5 2 187.8 208.4 -0.7 2.5 + 5 3 -140.7 -121.3 0.1 -0.9 + 5 4 -151.2 32.2 1.2 3.0 + 5 5 13.7 99.1 1.0 0.5 + 6 0 65.9 0.0 -0.6 0.0 + 6 1 65.6 -19.1 -0.4 0.1 + 6 2 73.0 25.0 0.5 -1.8 + 6 3 -121.5 52.7 1.4 -1.4 + 6 4 -36.2 -64.4 -1.4 0.9 + 6 5 13.5 9.0 -0.0 0.1 + 6 6 -64.7 68.1 0.8 1.0 + 7 0 80.6 0.0 -0.1 0.0 + 7 1 -76.8 -51.4 -0.3 0.5 + 7 2 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0.0 0.0 + 11 7 -0.1 -1.7 -0.0 0.1 + 11 8 1.4 -1.6 -0.1 -0.0 + 11 9 -0.6 -3.0 -0.1 -0.1 + 11 10 0.2 -2.0 -0.1 0.0 + 11 11 3.1 -2.6 -0.1 -0.0 + 12 0 -2.0 0.0 0.0 0.0 + 12 1 -0.1 -1.2 -0.0 -0.0 + 12 2 0.5 0.5 -0.0 0.0 + 12 3 1.3 1.3 0.0 -0.1 + 12 4 -1.2 -1.8 -0.0 0.1 + 12 5 0.7 0.1 -0.0 -0.0 + 12 6 0.3 0.7 0.0 0.0 + 12 7 0.5 -0.1 -0.0 -0.0 + 12 8 -0.2 0.6 0.0 0.1 + 12 9 -0.5 0.2 -0.0 -0.0 + 12 10 0.1 -0.9 -0.0 -0.0 + 12 11 -1.1 -0.0 -0.0 0.0 + 12 12 -0.3 0.5 -0.1 -0.1 +999999999999999999999999999999999999999999999999 +999999999999999999999999999999999999999999999999 diff --git a/ObjectiveWMM/WMM/GeomagnetismLibrary.c b/ObjectiveWMM/WMM/GeomagnetismLibrary.c index 0e8536d..bb334ce 100644 --- a/ObjectiveWMM/WMM/GeomagnetismLibrary.c +++ b/ObjectiveWMM/WMM/GeomagnetismLibrary.c @@ -11,7 +11,7 @@ * * ABSTRACT * - * The purpose of Geomagnetism Library is primarily to support the World Magnetic Model (WMM) 2015-2020. + * The purpose of Geomagnetism Library is primarily to support the World Magnetic Model (WMM) 2020-2025. * It however is built to be used for spherical harmonic models of the Earth's magnetic field * generally and supports models even with a large (>>12) number of degrees. It is also used in many * other geomagnetic models distributed by NGDC. @@ -732,7 +732,7 @@ char MAG_GeomagIntroduction_EMM(MAGtype_MagneticModel *MagneticModel, char* Vers printf("\n The Enhanced Magnetic Model (EMM) for %d", (int) MagneticModel->epoch); printf("\n is a model of Earth's main Magnetic and crustal field. The EMM"); printf("\n is recomputed every five (5) years, in years divisible by "); - printf("\n five (i.e. 2010, 2015). See the contact information below"); + printf("\n five (i.e. 2015, 2020). See the contact information below"); printf("\n to obtain more information on the EMM and associated software."); printf("\n "); printf("\n Input required is the location in geodetic latitude and"); @@ -808,7 +808,7 @@ char MAG_GeomagIntroduction_WMM(MAGtype_MagneticModel *MagneticModel, char *Vers printf("\n The World Magnetic Model (WMM) for %d", (int) MagneticModel->epoch); printf("\n is a model of Earth's main Magnetic field. The WMM"); printf("\n is recomputed every five (5) years, in years divisible by "); - printf("\n five (i.e. 2010, 2015). See the contact information below"); + printf("\n five (i.e. 2015, 2020). See the contact information below"); printf("\n to obtain more information on the WMM and associated software."); printf("\n "); printf("\n Input required is the location in geodetic latitude and"); diff --git a/ObjectiveWMMTests/DeclinationTests.m b/ObjectiveWMMTests/DeclinationTests.m index 2f856d2..73c173e 100644 --- a/ObjectiveWMMTests/DeclinationTests.m +++ b/ObjectiveWMMTests/DeclinationTests.m @@ -49,210 +49,209 @@ - (void) testCoefficientFileFound { - (void) testModelValidityPeriod { - // Current model is valid from 2015 through 2020 (see http://www.ngdc.noaa.gov/geomag/WMM/soft.shtml) + // Current model is valid from 2020 through 2025 (see https://www.ngdc.noaa.gov/geomag/WMM/soft.shtml) - NSDate *validFrom = [self dateForYear:2015 month:1 day:1]; - NSDate *validTo = [self dateForYear:2020 month:12 day:31]; + NSDate *validFrom = [self dateForYear:2020 month:1 day:1]; + NSDate *validTo = [self dateForYear:2025 month:12 day:31]; XCTAssertTrue([validFrom isEqualToDate:[[CCMagneticModel instance] modelValidityStart]], @"Unexpected model validity start date"); XCTAssertTrue([validTo isEqualToDate:[[CCMagneticModel instance] modelValidityEnd]], @"Unexpected model validity end date"); } -// See http://www.ngdc.noaa.gov/geomag/WMM/data/WMM2015/WMM2015testvalues.pdf for tests 01 through 12 +// See https://www.ngdc.noaa.gov/geomag/WMM/data/WMM2020/WMM2020testvalues.pdf for tests 01 through 12 - (void) testDeclination01 { - NSDate *date = [self dateForYear:2015 month:1 day:1]; + NSDate *date = [self dateForYear:2020 month:1 day:1]; CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(80, 0); CCMagneticDeclination *declination = [[CCMagneticModel instance] declinationForCoordinate:coord elevation:0 date:date]; NSLog(@"declination = %f", declination.magneticDeclination); - XCTAssertEqualWithAccuracy(declination.magneticDeclination, -3.90, 0.005, @"Unexpected declination"); + XCTAssertEqualWithAccuracy(declination.magneticDeclination, -1.28, 0.005, @"Unexpected declination"); } - (void) testDeclination02 { - NSDate *date = [self dateForYear:2015 month:1 day:1]; + NSDate *date = [self dateForYear:2020 month:1 day:1]; CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(0, 120); CCMagneticDeclination *declination = [[CCMagneticModel instance] declinationForCoordinate:coord elevation:0 date:date]; NSLog(@"declination = %f", declination.magneticDeclination); - XCTAssertEqualWithAccuracy(declination.magneticDeclination, 0.55, 0.005, @"Unexpected declination"); + XCTAssertEqualWithAccuracy(declination.magneticDeclination, 0.16, 0.005, @"Unexpected declination"); } - (void) testDeclination03 { - NSDate *date = [self dateForYear:2015 month:1 day:1]; + NSDate *date = [self dateForYear:2020 month:1 day:1]; CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(-80, 240); CCMagneticDeclination *declination = [[CCMagneticModel instance] declinationForCoordinate:coord elevation:0 date:date]; NSLog(@"declination = %f", declination.magneticDeclination); - XCTAssertEqualWithAccuracy(declination.magneticDeclination, 69.81, 0.005, @"Unexpected declination"); + XCTAssertEqualWithAccuracy(declination.magneticDeclination, 69.36, 0.005, @"Unexpected declination"); } - (void) testDeclination04 { - NSDate *date = [self dateForYear:2015 month:1 day:1]; + NSDate *date = [self dateForYear:2020 month:1 day:1]; CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(80, 0); CCMagneticDeclination *declination = [[CCMagneticModel instance] declinationForCoordinate:coord elevation:100000 date:date]; NSLog(@"declination = %f", declination.magneticDeclination); - XCTAssertEqualWithAccuracy(declination.magneticDeclination, -4.32, 0.005, @"Unexpected declination"); + XCTAssertEqualWithAccuracy(declination.magneticDeclination, -1.70, 0.005, @"Unexpected declination"); } - (void) testDeclination05 { - NSDate *date = [self dateForYear:2015 month:1 day:1]; + NSDate *date = [self dateForYear:2020 month:1 day:1]; CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(0, 120); CCMagneticDeclination *declination = [[CCMagneticModel instance] declinationForCoordinate:coord elevation:100000 date:date]; NSLog(@"declination = %f", declination.magneticDeclination); - XCTAssertEqualWithAccuracy(declination.magneticDeclination, 0.54, 0.005, @"Unexpected declination"); + XCTAssertEqualWithAccuracy(declination.magneticDeclination, 0.16, 0.005, @"Unexpected declination"); } - (void) testDeclination06 { - NSDate *date = [self dateForYear:2015 month:1 day:1]; + NSDate *date = [self dateForYear:2020 month:1 day:1]; CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(-80, 240); CCMagneticDeclination *declination = [[CCMagneticModel instance] declinationForCoordinate:coord elevation:100000 date:date]; NSLog(@"declination = %f", declination.magneticDeclination); - XCTAssertEqualWithAccuracy(declination.magneticDeclination, 69.22, 0.005, @"Unexpected declination"); + XCTAssertEqualWithAccuracy(declination.magneticDeclination, 68.78, 0.005, @"Unexpected declination"); } - (void) testDeclination07 { - NSDate *date = [self dateForYear:2017 month:7 day:1]; + NSDate *date = [self dateForYear:2022 month:7 day:1]; CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(80, 0); CCMagneticDeclination *declination = [[CCMagneticModel instance] declinationForCoordinate:coord elevation:0 date:date]; NSLog(@"declination = %f", declination.magneticDeclination); - XCTAssertEqualWithAccuracy(declination.magneticDeclination, -2.59, 0.005, @"Unexpected declination"); + XCTAssertEqualWithAccuracy(declination.magneticDeclination, 0.01, 0.005, @"Unexpected declination"); } - (void) testDeclination08 { - NSDate *date = [self dateForYear:2017 month:7 day:1]; + NSDate *date = [self dateForYear:2022 month:7 day:1]; CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(0, 120); CCMagneticDeclination *declination = [[CCMagneticModel instance] declinationForCoordinate:coord elevation:0 date:date]; NSLog(@"declination = %f", declination.magneticDeclination); - XCTAssertEqualWithAccuracy(declination.magneticDeclination, 0.37, 0.005, @"Unexpected declination"); + XCTAssertEqualWithAccuracy(declination.magneticDeclination, -0.06, 0.005, @"Unexpected declination"); } - (void) testDeclination09 { - NSDate *date = [self dateForYear:2017 month:7 day:1]; + NSDate *date = [self dateForYear:2022 month:7 day:1]; CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(-80, 240); CCMagneticDeclination *declination = [[CCMagneticModel instance] declinationForCoordinate:coord elevation:0 date:date]; NSLog(@"declination = %f", declination.magneticDeclination); - XCTAssertEqualWithAccuracy(declination.magneticDeclination, 69.59, 0.006, @"Unexpected declination"); + XCTAssertEqualWithAccuracy(declination.magneticDeclination, 69.13, 0.006, @"Unexpected declination"); } - (void) testDeclination10 { - NSDate *date = [self dateForYear:2017 month:7 day:1]; + NSDate *date = [self dateForYear:2022 month:7 day:1]; CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(80, 0); CCMagneticDeclination *declination = [[CCMagneticModel instance] declinationForCoordinate:coord elevation:100000 date:date]; NSLog(@"declination = %f", declination.magneticDeclination); - XCTAssertEqualWithAccuracy(declination.magneticDeclination, -3.01, 0.005, @"Unexpected declination"); + XCTAssertEqualWithAccuracy(declination.magneticDeclination, -0.41, 0.005, @"Unexpected declination"); } - (void) testDeclination11 { - NSDate *date = [self dateForYear:2017 month:7 day:1]; + NSDate *date = [self dateForYear:2022 month:7 day:1]; CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(0, 120); CCMagneticDeclination *declination = [[CCMagneticModel instance] declinationForCoordinate:coord elevation:100000 date:date]; NSLog(@"declination = %f", declination.magneticDeclination); - XCTAssertEqualWithAccuracy(declination.magneticDeclination, 0.36, 0.005, @"Unexpected declination"); + XCTAssertEqualWithAccuracy(declination.magneticDeclination, -0.05, 0.005, @"Unexpected declination"); } - (void) testDeclination12 { - NSDate *date = [self dateForYear:2017 month:7 day:1]; + NSDate *date = [self dateForYear:2022 month:7 day:1]; CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(-80, 240); CCMagneticDeclination *declination = [[CCMagneticModel instance] declinationForCoordinate:coord elevation:100000 date:date]; NSLog(@"declination = %f", declination.magneticDeclination); - XCTAssertEqualWithAccuracy(declination.magneticDeclination, 69.01, 0.005, @"Unexpected declination"); + XCTAssertEqualWithAccuracy(declination.magneticDeclination, 68.55, 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 +// Subsequent test values obtained from WMMGUI: https://www.ngdc.noaa.gov/geomag/WMM/soft.shtml - (void) testDeclination13 { - // Boulder, Colorado on Jan 10 2018 + // Boulder, Colorado on Jan 10 2023 - NSDate *date = [self dateForYear:2018 month:1 day:10]; + NSDate *date = [self dateForYear:2023 month:1 day:10]; CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(40.014986, -105.270546); CCMagneticDeclination *declination = [[CCMagneticModel instance] declinationForCoordinate:coord elevation:1630.0 date:date]; NSLog(@"declination = %f", declination.magneticDeclination); - XCTAssertEqualWithAccuracy(declination.magneticDeclination, 8.4116, 0.001, @"Unexpected declination"); + XCTAssertEqualWithAccuracy(declination.magneticDeclination, 7.93, 0.005, @"Unexpected declination"); } - (void) testDeclination14 { - // London, UK on Aug 28 2019 + // London, UK on Aug 28 2024 - NSDate *date = [self dateForYear:2019 month:8 day:28]; + NSDate *date = [self dateForYear:2024 month:8 day:28]; CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(51.507335, -0.127683); CCMagneticDeclination *declination = [[CCMagneticModel instance] declinationForCoordinate:coord elevation:22.0 date:date]; NSLog(@"declination = %f", declination.magneticDeclination); - XCTAssertEqualWithAccuracy(declination.magneticDeclination, -0.0432, 0.002, @"Unexpected declination"); + XCTAssertEqualWithAccuracy(declination.magneticDeclination, 0.95, 0.005, @"Unexpected declination"); } - (void) testDeclination15 { - // Sydney, Australia on Dec 31 2014 + // Sydney, Australia on Dec 31 2020 - NSDate *date = [self dateForYear:2019 month:12 day:31]; + NSDate *date = [self dateForYear:2020 month:12 day:31]; CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(-33.867487, 151.206990); CCMagneticDeclination *declination = [[CCMagneticModel instance] declinationForCoordinate:coord elevation:54.0 date:date]; NSLog(@"declination = %f", declination.magneticDeclination); - XCTAssertEqualWithAccuracy(declination.magneticDeclination, 12.5805, 0.003, @"Unexpected declination"); + XCTAssertEqualWithAccuracy(declination.magneticDeclination, 12.68, 0.005, @"Unexpected declination"); } - (void) testInvalidDate01 { - // Sydney, Australia on Jan 1 2021 - date is out of model bounds, declination returned should equal zero + // Sydney, Australia on Jan 1 2026 - date is out of model bounds, declination returned should equal zero - NSDate *date = [self dateForYear:2021 month:1 day:1]; + NSDate *date = [self dateForYear:2026 month:1 day:1]; XCTAssertFalse([[CCMagneticModel instance] dateIsWithinModelBounds:date], @"Expected date to be out of model bounds"); @@ -265,9 +264,9 @@ - (void) testInvalidDate01 { - (void) testInvalidDate02 { - // Sydney, Australia on Dec 31 2014 - date is out of model bounds, declination returned should equal zero + // Sydney, Australia on Dec 31 2019 - date is out of model bounds, declination returned should equal zero - NSDate *date = [self dateForYear:2014 month:12 day:31]; + NSDate *date = [self dateForYear:2019 month:12 day:31]; XCTAssertFalse([[CCMagneticModel instance] dateIsWithinModelBounds:date], @"Expected date to be out of model bounds"); @@ -279,35 +278,35 @@ - (void) testInvalidDate02 { - (void) testTrueHeading01 { - // Boulder, Colorado on Jan 10 2018 + // Boulder, Colorado on Jan 10 2023 - NSDate *date = [self dateForYear:2018 month:1 day:10]; + NSDate *date = [self dateForYear:2023 month:1 day:10]; CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(40.014986, -105.270546); CCMagneticDeclination *declination = [[CCMagneticModel instance] declinationForCoordinate:coord elevation:1630.0 date:date]; NSLog(@"declination = %f", declination.magneticDeclination); - XCTAssertEqualWithAccuracy([declination trueHeadingFromMagneticHeading:94.0], 94.0 + 8.4116, 0.001, @"Unexpected true heading"); + XCTAssertEqualWithAccuracy([declination trueHeadingFromMagneticHeading:94.0], 94.0 + 7.93, 0.005, @"Unexpected true heading"); } - (void) testMagneticHeading01 { - // Boulder, Colorado on Jan 10 2018 + // Boulder, Colorado on Jan 10 2023 - NSDate *date = [self dateForYear:2018 month:1 day:10]; + NSDate *date = [self dateForYear:2023 month:1 day:10]; CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(40.014986, -105.270546); CCMagneticDeclination *declination = [[CCMagneticModel instance] declinationForCoordinate:coord elevation:1630.0 date:date]; NSLog(@"declination = %f", declination.magneticDeclination); - XCTAssertEqualWithAccuracy([declination magneticHeadingFromTrueHeading:94.0 + 8.4116], 94.0, 0.001, @"Unexpected magnetic heading"); + XCTAssertEqualWithAccuracy([declination magneticHeadingFromTrueHeading:94.0 + 7.93], 94.0, 0.005, @"Unexpected magnetic heading"); } - (void) testDateBounds01 { - NSDate *date = [self dateForYear:2014 month:8 day:1]; + NSDate *date = [self dateForYear:2019 month:8 day:1]; NSDate *withinBounds = [[CCMagneticModel instance] dateWithinModelBoundsFromDate:date]; @@ -316,7 +315,7 @@ - (void) testDateBounds01 { - (void) testDateBounds02 { - NSDate *date = [self dateForYear:2022 month:3 day:21]; + NSDate *date = [self dateForYear:2027 month:3 day:21]; NSDate *withinBounds = [[CCMagneticModel instance] dateWithinModelBoundsFromDate:date]; @@ -326,7 +325,7 @@ - (void) testDateBounds02 { - (void) testDateBounds03 { - NSDate *date = [self dateForYear:2018 month:6 day:21]; + NSDate *date = [self dateForYear:2021 month:6 day:21]; NSDate *withinBounds = [[CCMagneticModel instance] dateWithinModelBoundsFromDate:date]; @@ -335,7 +334,7 @@ - (void) testDateBounds03 { - (void) testDateWithinBounds01 { - NSDate *inputDate = [self dateForYear:2022 month:1 day:1]; // out of range + NSDate *inputDate = [self dateForYear:2027 month:1 day:1]; // out of range NSDate *dateInBounds = [[CCMagneticModel instance] dateWithinModelBoundsFromDate:inputDate]; CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(40.014986, -105.270546); @@ -344,7 +343,7 @@ - (void) testDateWithinBounds01 { - (void) testDateWithinBounds02 { - NSDate *inputDate = [self dateForYear:2015 month:1 day:1]; // out of range + NSDate *inputDate = [self dateForYear:2019 month:1 day:1]; // out of range NSDate *dateInBounds = [[CCMagneticModel instance] dateWithinModelBoundsFromDate:inputDate]; CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(40.014986, -105.270546); @@ -353,9 +352,9 @@ - (void) testDateWithinBounds02 { - (void) testHeadingInBounds01 { - // New York on Jan 10 2018 + // New York on Jan 10 2023 - NSDate *date = [self dateForYear:2018 month:1 day:10]; + NSDate *date = [self dateForYear:2023 month:1 day:10]; CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(40.714353, -74.005973); CCMagneticDeclination *declination = [[CCMagneticModel instance] declinationForCoordinate:coord elevation:57.0 date:date]; @@ -369,9 +368,9 @@ - (void) testHeadingInBounds01 { - (void) testHeadingInBounds02 { - // Boulder, Colorado on Jan 10 2018 + // Boulder, Colorado on Jan 10 2023 - NSDate *date = [self dateForYear:2018 month:1 day:10]; + NSDate *date = [self dateForYear:2023 month:1 day:10]; CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(40.014986, -105.270546); CCMagneticDeclination *declination = [[CCMagneticModel instance] declinationForCoordinate:coord elevation:1630.0 date:date];