Skip to content

Commit 4e97c02

Browse files
authored
Merge pull request #248 from Tronald/develop
Magnetic v2.1.1.0
2 parents 93a277c + cdf6848 commit 4e97c02

20 files changed

+901
-24
lines changed

CONTRIBUTING.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,28 @@ Any contribution to this library is greatly appreciated! Developers are encourag
55

66
A Contributor Agreement is required to be on file before any pull requests will be considered. The agreement can be signed and emailed to support@signatgroup.com. You may download the agreement [here](https://github.com/Tronald/CoordinateSharp/raw/develop/Signature%20Group%20Contributor%20Agreement.pdf).
77

8+
### Setup
9+
10+
### Setup
11+
12+
After creating a local fork, additional setup steps may be required depending on your IDE. You might need to download legacy .NET Frameworks. Unfortunately, Microsoft no longer provides a straightforward way to download .NET 4.0 and .NET 4.5 Frameworks. Follow these steps to configure your IDE:
13+
14+
1. **Close all instances of Visual Studio** (or your IDE if using a different one).
15+
2. **Download** [Microsoft.NETFramework.ReferenceAssemblies.net45](https://www.nuget.org/packages/Microsoft.NETFramework.ReferenceAssemblies.net45) from NuGet.org.
16+
3. **Open the package as a ZIP file**:
17+
- Either directly open it as a ZIP, or
18+
- Rename the file extension from `.nupkg` to `.zip` and then open it.
19+
4. **Copy the framework files**:
20+
- From `build\.NETFramework\v4.0\`, copy the files to:
21+
`C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0`
22+
*(You’ll need admin permissions. Overwrite any existing files.)*
23+
- From `build\.NETFramework\v4.5\`, copy the files to:
24+
`C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5`
25+
*(Again, admin permissions are required. Overwrite any existing files.)*
26+
5. **Reopen Visual Studio** (or your IDE).
27+
28+
Your IDE should now recognize the legacy frameworks.
29+
830
### Organization
931

1032
The codebase is organized into various .cs files. If modifying the codebase, ensure you are familiar with how it is organized so that
Binary file not shown.

CoordinateSharp.Magnetic/CoordinateSharp.Magnetic.csproj

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,22 @@ For more information, please contact Signature Group, LLC at this address: sales
4747
<TargetFrameworks>net40; netstandard1.3; netstandard1.4; netstandard2.0; netstandard2.1; net50; net60; net70; net80; net90</TargetFrameworks>
4848
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
4949
<GenerateDocumentationFile>true</GenerateDocumentationFile>
50-
<Version>1.1.16.0</Version>
50+
<Version>2.1.1.0</Version>
5151
<Authors>Signature Group, LLC</Authors>
5252
<Company />
5353
<PackageProjectUrl>https://github.com/Tronald/CoordinateSharp</PackageProjectUrl>
5454
<PackageLicenseUrl></PackageLicenseUrl>
5555
<Copyright>Copyright 2024</Copyright>
5656
<Description>CoordinateSharp magnetic data extensions.</Description>
57-
<PackageReleaseNotes>-Adds .NET 9 support</PackageReleaseNotes>
57+
<PackageReleaseNotes>Adds support for the World Magnetic Model 2025 (WMM2025), covering the years 2025–2029.
58+
Introduces constructors that default to the latest WMM, eliminating the need for developers to manually update WMM specifications in their code after upgrading.</PackageReleaseNotes>
5859
<PackageTags>CoordinateSharp Latitude Longitude Coordinates Geography Magnetic Declination</PackageTags>
5960
<!-- <PackageLicenseExpression>AGPL-3.0-or-later</PackageLicenseExpression>-->
6061
<PackageLicenseFile>License.txt</PackageLicenseFile>
6162
<PackageIconUrl></PackageIconUrl>
6263
<PackageId>CoordinateSharp.Magnetic</PackageId>
6364
<Title>CoordinateSharp.Magnetic</Title>
64-
<AssemblyVersion>1.1.16.0</AssemblyVersion>
65+
<AssemblyVersion>2.1.1.0</AssemblyVersion>
6566
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
6667
<SignAssembly>true</SignAssembly>
6768
<PackageIcon>128x128.png</PackageIcon>
@@ -174,7 +175,7 @@ For more information, please contact Signature Group, LLC at this address: sales
174175
</ItemGroup>
175176

176177
<ItemGroup>
177-
<None Include="..\..\CoordinateSharp Graphics\128x128.png">
178+
<None Include="128x128.png">
178179
<Pack>True</Pack>
179180
<PackagePath>\</PackagePath>
180181
</None>

CoordinateSharp.Magnetic/DataModels/WMM2015COF.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ public static List<CoefficientModel> Data
5555
List<CoefficientModel> models = new List<CoefficientModel>();
5656

5757
//Convert COF to models.
58+
//NOTES TO QUICKLY CREATE FROM COF FILE
59+
//REGEX REPLACE (In Notepad++)
60+
//FIND: ^\s*(-?\d+)\s+(-?\d+)\s+(-?\d+\.?\d*)\s+(-?\d+\.?\d*)\s+(-?\d+\.?\d*)\s+(-?\d+\.?\d*)\s*$
61+
//REPALCE: models.Add\(new CoefficientModel\(\1, \2, \3, \4, \5, \6\)\);\n
62+
5863
models.Add(new CoefficientModel(1, 0, -29438.5, 0, 10.7, 0));
5964
models.Add(new CoefficientModel(1, 1, -1501.1, 4796.2, 17.9, -26.8));
6065
models.Add(new CoefficientModel(2, 0, -2445.3, 0, -8.6, 0));

CoordinateSharp.Magnetic/DataModels/WMM2020COF.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ public static List<CoefficientModel> Data
5555
List<CoefficientModel> models = new List<CoefficientModel>();
5656

5757
//Convert COF to models.
58+
//NOTES TO QUICKLY CREATE FROM COF FILE
59+
//REGEX REPLACE (In Notepad++)
60+
//FIND: ^\s*(-?\d+)\s+(-?\d+)\s+(-?\d+\.?\d*)\s+(-?\d+\.?\d*)\s+(-?\d+\.?\d*)\s+(-?\d+\.?\d*)\s*$
61+
//REPALCE: models.Add\(new CoefficientModel\(\1, \2, \3, \4, \5, \6\)\);\n
62+
5863
models.Add(new CoefficientModel(1, 0, -29404.5, 0.0, 6.7, 0.0));
5964
models.Add(new CoefficientModel(1, 1, -1450.7, 4652.9, 7.7, -25.1));
6065
models.Add(new CoefficientModel(2, 0, -2500.0, 0.0, -11.5, 0.0));
Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
/*
2+
CoordinateSharp is a .NET standard library that is intended to ease geographic coordinate
3+
format conversions and location based celestial calculations.
4+
https://github.com/Tronald/CoordinateSharp
5+
6+
Many celestial formulas in this library are based on Jean Meeus's
7+
Astronomical Algorithms (2nd Edition). Comments that reference only a chapter
8+
are referring to this work.
9+
10+
License
11+
12+
CoordinateSharp is split licensed and may be licensed under the GNU Affero General Public License version 3 or a commercial use license as stated.
13+
14+
Copyright (C) 2023, Signature Group, LLC
15+
16+
This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3
17+
as published by the Free Software Foundation with the addition of the following permission added to Section 15 as permitted in Section 7(a):
18+
FOR ANY PART OF THE COVERED WORK IN WHICH THE COPYRIGHT IS OWNED BY Signature Group, LLC. Signature Group, LLC DISCLAIMS THE WARRANTY OF
19+
NON INFRINGEMENT OF THIRD PARTY RIGHTS.
20+
21+
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
22+
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU
23+
Affero General Public License along with this program; if not, see http://www.gnu.org/licenses or write to the
24+
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA, 02110-1301 USA, or download the license from the following URL:
25+
26+
https://www.gnu.org/licenses/agpl-3.0.html
27+
28+
The interactive user interfaces in modified source and object code versions of this program must display Appropriate Legal Notices,
29+
as required under Section 5 of the GNU Affero General Public License.
30+
31+
You can be released from the requirements of the license by purchasing a commercial license. Buying such a license is mandatory
32+
as soon as you develop commercial activities involving the CoordinateSharp software without disclosing the source code of your own applications.
33+
These activities include: offering paid services to customers as an ASP, on the fly location based calculations in a web application,
34+
or shipping CoordinateSharp with a closed source product.
35+
36+
Organizations or use cases that fall under the following conditions may receive a free commercial use license upon request on a case by case basis.
37+
38+
39+
-Open source contributors to this library.
40+
-Scholarly or scientific research.
41+
-Emergency response / management uses.
42+
43+
Please visit http://coordinatesharp.com/licensing or contact Signature Group, LLC to purchase a commercial license, or for any questions regarding the AGPL 3.0 license requirements or free use license: sales@signatgroup.com.
44+
*/
45+
using System.Collections.Generic;
46+
47+
namespace CoordinateSharp.Magnetic
48+
{
49+
internal class WMM2025COF
50+
{
51+
public static List<CoefficientModel> Data
52+
{
53+
get
54+
{
55+
List<CoefficientModel> models = new List<CoefficientModel>();
56+
57+
//Convert COF to models.
58+
//NOTES TO QUICKLY CREATE FROM COF FILE
59+
//REGEX REPLACE (In Notepad++)
60+
//FIND: ^\s*(-?\d+)\s+(-?\d+)\s+(-?\d+\.?\d*)\s+(-?\d+\.?\d*)\s+(-?\d+\.?\d*)\s+(-?\d+\.?\d*)\s*$
61+
//REPALCE: models.Add\(new CoefficientModel\(\1, \2, \3, \4, \5, \6\)\);\n
62+
models.Add(new CoefficientModel(1, 0, -29351.8, 0.0, 12.0, 0.0));
63+
models.Add(new CoefficientModel(1, 1, -1410.8, 4545.4, 9.7, -21.5));
64+
models.Add(new CoefficientModel(2, 0, -2556.6, 0.0, -11.6, 0.0));
65+
models.Add(new CoefficientModel(2, 1, 2951.1, -3133.6, -5.2, -27.7));
66+
models.Add(new CoefficientModel(2, 2, 1649.3, -815.1, -8.0, -12.1));
67+
models.Add(new CoefficientModel(3, 0, 1361.0, 0.0, -1.3, 0.0));
68+
models.Add(new CoefficientModel(3, 1, -2404.1, -56.6, -4.2, 4.0));
69+
models.Add(new CoefficientModel(3, 2, 1243.8, 237.5, 0.4, -0.3));
70+
models.Add(new CoefficientModel(3, 3, 453.6, -549.5, -15.6, -4.1));
71+
models.Add(new CoefficientModel(4, 0, 895.0, 0.0, -1.6, 0.0));
72+
models.Add(new CoefficientModel(4, 1, 799.5, 278.6, -2.4, -1.1));
73+
models.Add(new CoefficientModel(4, 2, 55.7, -133.9, -6.0, 4.1));
74+
models.Add(new CoefficientModel(4, 3, -281.1, 212.0, 5.6, 1.6));
75+
models.Add(new CoefficientModel(4, 4, 12.1, -375.6, -7.0, -4.4));
76+
models.Add(new CoefficientModel(5, 0, -233.2, 0.0, 0.6, 0.0));
77+
models.Add(new CoefficientModel(5, 1, 368.9, 45.4, 1.4, -0.5));
78+
models.Add(new CoefficientModel(5, 2, 187.2, 220.2, 0.0, 2.2));
79+
models.Add(new CoefficientModel(5, 3, -138.7, -122.9, 0.6, 0.4));
80+
models.Add(new CoefficientModel(5, 4, -142.0, 43.0, 2.2, 1.7));
81+
models.Add(new CoefficientModel(5, 5, 20.9, 106.1, 0.9, 1.9));
82+
models.Add(new CoefficientModel(6, 0, 64.4, 0.0, -0.2, 0.0));
83+
models.Add(new CoefficientModel(6, 1, 63.8, -18.4, -0.4, 0.3));
84+
models.Add(new CoefficientModel(6, 2, 76.9, 16.8, 0.9, -1.6));
85+
models.Add(new CoefficientModel(6, 3, -115.7, 48.8, 1.2, -0.4));
86+
models.Add(new CoefficientModel(6, 4, -40.9, -59.8, -0.9, 0.9));
87+
models.Add(new CoefficientModel(6, 5, 14.9, 10.9, 0.3, 0.7));
88+
models.Add(new CoefficientModel(6, 6, -60.7, 72.7, 0.9, 0.9));
89+
models.Add(new CoefficientModel(7, 0, 79.5, 0.0, -0.0, 0.0));
90+
models.Add(new CoefficientModel(7, 1, -77.0, -48.9, -0.1, 0.6));
91+
models.Add(new CoefficientModel(7, 2, -8.8, -14.4, -0.1, 0.5));
92+
models.Add(new CoefficientModel(7, 3, 59.3, -1.0, 0.5, -0.8));
93+
models.Add(new CoefficientModel(7, 4, 15.8, 23.4, -0.1, 0.0));
94+
models.Add(new CoefficientModel(7, 5, 2.5, -7.4, -0.8, -1.0));
95+
models.Add(new CoefficientModel(7, 6, -11.1, -25.1, -0.8, 0.6));
96+
models.Add(new CoefficientModel(7, 7, 14.2, -2.3, 0.8, -0.2));
97+
models.Add(new CoefficientModel(8, 0, 23.2, 0.0, -0.1, 0.0));
98+
models.Add(new CoefficientModel(8, 1, 10.8, 7.1, 0.2, -0.2));
99+
models.Add(new CoefficientModel(8, 2, -17.5, -12.6, 0.0, 0.5));
100+
models.Add(new CoefficientModel(8, 3, 2.0, 11.4, 0.5, -0.4));
101+
models.Add(new CoefficientModel(8, 4, -21.7, -9.7, -0.1, 0.4));
102+
models.Add(new CoefficientModel(8, 5, 16.9, 12.7, 0.3, -0.5));
103+
models.Add(new CoefficientModel(8, 6, 15.0, 0.7, 0.2, -0.6));
104+
models.Add(new CoefficientModel(8, 7, -16.8, -5.2, -0.0, 0.3));
105+
models.Add(new CoefficientModel(8, 8, 0.9, 3.9, 0.2, 0.2));
106+
models.Add(new CoefficientModel(9, 0, 4.6, 0.0, -0.0, 0.0));
107+
models.Add(new CoefficientModel(9, 1, 7.8, -24.8, -0.1, -0.3));
108+
models.Add(new CoefficientModel(9, 2, 3.0, 12.2, 0.1, 0.3));
109+
models.Add(new CoefficientModel(9, 3, -0.2, 8.3, 0.3, -0.3));
110+
models.Add(new CoefficientModel(9, 4, -2.5, -3.3, -0.3, 0.3));
111+
models.Add(new CoefficientModel(9, 5, -13.1, -5.2, 0.0, 0.2));
112+
models.Add(new CoefficientModel(9, 6, 2.4, 7.2, 0.3, -0.1));
113+
models.Add(new CoefficientModel(9, 7, 8.6, -0.6, -0.1, -0.2));
114+
models.Add(new CoefficientModel(9, 8, -8.7, 0.8, 0.1, 0.4));
115+
models.Add(new CoefficientModel(9, 9, -12.9, 10.0, -0.1, 0.1));
116+
models.Add(new CoefficientModel(10, 0, -1.3, 0.0, 0.1, 0.0));
117+
models.Add(new CoefficientModel(10, 1, -6.4, 3.3, 0.0, 0.0));
118+
models.Add(new CoefficientModel(10, 2, 0.2, 0.0, 0.1, -0.0));
119+
models.Add(new CoefficientModel(10, 3, 2.0, 2.4, 0.1, -0.2));
120+
models.Add(new CoefficientModel(10, 4, -1.0, 5.3, -0.0, 0.1));
121+
models.Add(new CoefficientModel(10, 5, -0.6, -9.1, -0.3, -0.1));
122+
models.Add(new CoefficientModel(10, 6, -0.9, 0.4, 0.0, 0.1));
123+
models.Add(new CoefficientModel(10, 7, 1.5, -4.2, -0.1, 0.0));
124+
models.Add(new CoefficientModel(10, 8, 0.9, -3.8, -0.1, -0.1));
125+
models.Add(new CoefficientModel(10, 9, -2.7, 0.9, -0.0, 0.2));
126+
models.Add(new CoefficientModel(10, 10, -3.9, -9.1, -0.0, -0.0));
127+
models.Add(new CoefficientModel(11, 0, 2.9, 0.0, 0.0, 0.0));
128+
models.Add(new CoefficientModel(11, 1, -1.5, 0.0, -0.0, -0.0));
129+
models.Add(new CoefficientModel(11, 2, -2.5, 2.9, 0.0, 0.1));
130+
models.Add(new CoefficientModel(11, 3, 2.4, -0.6, 0.0, -0.0));
131+
models.Add(new CoefficientModel(11, 4, -0.6, 0.2, 0.0, 0.1));
132+
models.Add(new CoefficientModel(11, 5, -0.1, 0.5, -0.1, -0.0));
133+
models.Add(new CoefficientModel(11, 6, -0.6, -0.3, 0.0, -0.0));
134+
models.Add(new CoefficientModel(11, 7, -0.1, -1.2, -0.0, 0.1));
135+
models.Add(new CoefficientModel(11, 8, 1.1, -1.7, -0.1, -0.0));
136+
models.Add(new CoefficientModel(11, 9, -1.0, -2.9, -0.1, 0.0));
137+
models.Add(new CoefficientModel(11, 10, -0.2, -1.8, -0.1, 0.0));
138+
models.Add(new CoefficientModel(11, 11, 2.6, -2.3, -0.1, 0.0));
139+
models.Add(new CoefficientModel(12, 0, -2.0, 0.0, 0.0, 0.0));
140+
models.Add(new CoefficientModel(12, 1, -0.2, -1.3, 0.0, -0.0));
141+
models.Add(new CoefficientModel(12, 2, 0.3, 0.7, -0.0, 0.0));
142+
models.Add(new CoefficientModel(12, 3, 1.2, 1.0, -0.0, -0.1));
143+
models.Add(new CoefficientModel(12, 4, -1.3, -1.4, -0.0, 0.1));
144+
models.Add(new CoefficientModel(12, 5, 0.6, -0.0, -0.0, -0.0));
145+
models.Add(new CoefficientModel(12, 6, 0.6, 0.6, 0.1, -0.0));
146+
models.Add(new CoefficientModel(12, 7, 0.5, -0.1, -0.0, -0.0));
147+
models.Add(new CoefficientModel(12, 8, -0.1, 0.8, 0.0, 0.0));
148+
models.Add(new CoefficientModel(12, 9, -0.4, 0.1, 0.0, -0.0));
149+
models.Add(new CoefficientModel(12, 10, -0.2, -1.0, -0.1, -0.0));
150+
models.Add(new CoefficientModel(12, 11, -1.3, 0.1, -0.0, 0.0));
151+
models.Add(new CoefficientModel(12, 12, -0.7, 0.2, -0.1, -0.1));
152+
153+
models.Add(new CoefficientModel(13, 0, null, null, null, null));
154+
models.Add(new CoefficientModel(13, 1, null, null, null, null));
155+
models.Add(new CoefficientModel(13, 2, null, null, null, null));
156+
models.Add(new CoefficientModel(13, 3, null, null, null, null));
157+
models.Add(new CoefficientModel(13, 4, null, null, null, null));
158+
models.Add(new CoefficientModel(13, 5, null, null, null, null));
159+
models.Add(new CoefficientModel(13, 6, null, null, null, null));
160+
models.Add(new CoefficientModel(13, 7, null, null, null, null));
161+
models.Add(new CoefficientModel(13, 8, null, null, null, null));
162+
models.Add(new CoefficientModel(13, 9, null, null, null, null));
163+
models.Add(new CoefficientModel(13, 10, null, null, null, null));
164+
models.Add(new CoefficientModel(13, 11, null, null, null, null));
165+
models.Add(new CoefficientModel(13, 12, null, null, null, null));
166+
167+
return models;
168+
}
169+
}
170+
}
171+
}

CoordinateSharp.Magnetic/DataPoints/DataPoints.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,22 @@ public DataPoints(DataModel model, Magnetic magnetic)
5656
Parent = magnetic;
5757
Points = new List<DataPoint>();
5858

59-
if (model == DataModel.WMM2015)
59+
if (model == DataModel.WMM2025)
6060
{
61-
Load_Data(WMM2015COF.Data);
62-
modelYear = 2015;
61+
Load_Data(WMM2025COF.Data);
62+
modelYear = 2025;
6363
}
64-
if (model == DataModel.WMM2020)
64+
else if (model == DataModel.WMM2020)
6565
{
6666
Load_Data(WMM2020COF.Data);
6767
modelYear = 2020;
6868
}
69+
else if (model == DataModel.WMM2015)
70+
{
71+
Load_Data(WMM2015COF.Data);
72+
modelYear = 2015;
73+
}
74+
6975
}
7076

7177
private readonly double modelYear;

0 commit comments

Comments
 (0)