Skip to content

Commit

Permalink
Add WMM2025
Browse files Browse the repository at this point in the history
  • Loading branch information
nhz2 committed Dec 22, 2024
1 parent 4c69107 commit 8968577
Show file tree
Hide file tree
Showing 10 changed files with 4,718 additions and 582 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ Note that latitude and longitude are in units of degrees, and the seven magnetic
XYZgeomag is within 0.5 nT of the official WMM software.

For more information on the limitations of the WMM model, see:
<https://www.ngdc.noaa.gov/geomag/WMM/limit.shtml>
<https://www.ncei.noaa.gov/products/world-magnetic-model/accuracy-limitations-error-model>

## Performance

XYZgeomag uses single precision floating points. It's designed to minimize ram usage for embedded systems.

| Device | Speed |
|-------------|----------|
| Arduino Uno | 52 ms |
| Raspberry Pi Pico | 6.5 ms |
| Arduino Uno R3 | 52 ms |
| Raspberry Pi Pico RP2040 | 4.5 ms |
| Teensy 3.6 | 83 µs |
| Teensy 4.0 | 21 µs |

Expand Down Expand Up @@ -117,12 +117,12 @@ void loop() {

## Adding New Coefficents

To add new coefficents, download the new `.COF` file from [https://www.ngdc.noaa.gov/geomag/WMM/DoDWMM.shtml](https://www.ngdc.noaa.gov/geomag/WMM/DoDWMM.shtml)
To add new coefficents, download the new `.COF` file from <https://www.ncei.noaa.gov/products/world-magnetic-model>

Add the .COF file to the `extras` directory.

Then run for example
`python wmmcodeupdate.py -f WMM2015.COF -f WMM2015v2.COF -f WMM2020.COF -o ../src/XYZgeomag.hpp -n 12` from the `extras` directory.
`python3 wmmcodeupdate.py -f WMM2015.COF -f WMM2015v2.COF -f WMM2020.COF -f WMM2025.COF -o ../src/XYZgeomag.hpp -n 12` from the `extras` directory.

In this example, `WMM2015.COF` , `WMM2015v2.COF`, and `WMM2020.COF` are the `.COF` files to use in `src/XYZgeomag.hpp`.

Expand All @@ -147,6 +147,8 @@ Using geodetic2ecef algorithm from https://geographiclib.sourceforge.io/

Using coefficients and test points from:

NOAA NCEI Geomagnetic Modeling Team; British Geological Survey. 2024: World Magnetic Model 2025. NOAA National Centers for Environmental Information. https://doi.org/10.25921/aqfd-sd83. Accessed [22 DEC 2024].

NCEI Geomagnetic Modeling Team and British Geological Survey. 2019. World Magnetic Model 2020. NOAA National Centers for Environmental Information. doi: 10.25921/11v3-da71, 2020, [10 DEC 2019].

Chulliat, A., W. Brown, P. Alken, S. Macmillan, M. Nair, C. Beggan, A. Woods, B. Hamilton, B. Meyer and R. Redmon, 2019, Out-of-Cycle Update of the US/UK World Magnetic Model for 2015-2020: Technical Note, National Centers for Environmental Information, NOAA. doi: 10.25921/xhr3-0t19.
Expand Down
2 changes: 1 addition & 1 deletion examples/Declination/Declination.ino
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ void loop() {
float lon = val + 75.0f; // longitude in degrees
float height = val + 305; // height above WGS84 ellipsoid in meters
geomag::Vector position = geomag::geodetic2ecef(lat,lon,height);
geomag::Vector mag_field = geomag::GeoMag(2022.5,position,geomag::WMM2020);
geomag::Vector mag_field = geomag::GeoMag(2027.5,position,geomag::WMM2025);
geomag::Elements out = geomag::magField2Elements(mag_field, lat, lon);
Serial.print(out.north);
Serial.println(" nT north");
Expand Down
2 changes: 1 addition & 1 deletion examples/Geocentric/Geocentric.ino
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ void loop() {
geomag::Vector out;
int starttime=micros();
int starttimemil=millis();
out=geomag::GeoMag(2022.5,in,geomag::WMM2020);
out=geomag::GeoMag(2027.5,in,geomag::WMM2025);
int endtime=micros();
int endtimemil=millis();
Serial.print(out.x*1E9);
Expand Down
93 changes: 93 additions & 0 deletions extras/WMM2025.COF
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
2025.0 WMM-2025 11/13/2024
1 0 -29351.8 0.0 12.0 0.0
1 1 -1410.8 4545.4 9.7 -21.5
2 0 -2556.6 0.0 -11.6 0.0
2 1 2951.1 -3133.6 -5.2 -27.7
2 2 1649.3 -815.1 -8.0 -12.1
3 0 1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 0.8 0.1 0.4
9 9 -12.9 10.0 -0.1 0.1
10 0 -1.3 0.0 0.1 0.0
10 1 -6.4 3.3 0.0 0.0
10 2 0.2 0.0 0.1 -0.0
10 3 2.0 2.4 0.1 -0.2
10 4 -1.0 5.3 -0.0 0.1
10 5 -0.6 -9.1 -0.3 -0.1
10 6 -0.9 0.4 0.0 0.1
10 7 1.5 -4.2 -0.1 0.0
10 8 0.9 -3.8 -0.1 -0.1
10 9 -2.7 0.9 -0.0 0.2
10 10 -3.9 -9.1 -0.0 -0.0
11 0 2.9 0.0 0.0 0.0
11 1 -1.5 0.0 -0.0 -0.0
11 2 -2.5 2.9 0.0 0.1
11 3 2.4 -0.6 0.0 -0.0
11 4 -0.6 0.2 0.0 0.1
11 5 -0.1 0.5 -0.1 -0.0
11 6 -0.6 -0.3 0.0 -0.0
11 7 -0.1 -1.2 -0.0 0.1
11 8 1.1 -1.7 -0.1 -0.0
11 9 -1.0 -2.9 -0.1 0.0
11 10 -0.2 -1.8 -0.1 0.0
11 11 2.6 -2.3 -0.1 0.0
12 0 -2.0 0.0 0.0 0.0
12 1 -0.2 -1.3 0.0 -0.0
12 2 0.3 0.7 -0.0 0.0
12 3 1.2 1.0 -0.0 -0.1
12 4 -1.3 -1.4 -0.0 0.1
12 5 0.6 -0.0 -0.0 -0.0
12 6 0.6 0.6 0.1 -0.0
12 7 0.5 -0.1 -0.0 -0.0
12 8 -0.1 0.8 0.0 0.0
12 9 -0.4 0.1 0.0 -0.0
12 10 -0.2 -1.0 -0.1 -0.0
12 11 -1.3 0.1 -0.0 0.0
12 12 -0.7 0.2 -0.1 -0.1
999999999999999999999999999999999999999999999999
999999999999999999999999999999999999999999999999
Loading

0 comments on commit 8968577

Please sign in to comment.