Update World Magnetic Model from WMM2020 to WMM2025#8
Open
zourzouvillys wants to merge 1 commit intowestphae:masterfrom
Open
Update World Magnetic Model from WMM2020 to WMM2025#8zourzouvillys wants to merge 1 commit intowestphae:masterfrom
zourzouvillys wants to merge 1 commit intowestphae:masterfrom
Conversation
WMM2020 expired at end of 2024. WMM2025 was released by NOAA/NCEI on December 17, 2024 and is valid from 2025.0 through 2029. - Add WMM2025.COF coefficients and test values from NOAA - Regenerate embedded bindata.go with WMM2025 coefficients - Update error model constants to WMM2025 values - Add coefficient and magnetic field tests for WMM2025 - Update documentation and CLI references - Add go.mod for module support
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The World Magnetic Model (WMM) is the standard model for navigation, attitude, and heading systems. It is updated every 5 years by NOAA's National Centers for Environmental Information (NCEI) and the British Geological Survey (BGS). WMM2020 expired at the end of 2024, and WMM2025 was officially released on December 17, 2024.
This PR updates the entire library from WMM2020 (epoch 2020.0, valid 2019–2024) to WMM2025 (epoch 2025.0, valid 2024–2029).
What changed
Coefficients (
pkg/wmm/)bindata.go— Regenerated the embedded, gzip-compressedWMM.COFbinary asset with the WMM2025 spherical harmonic coefficients (degree/order 12, 91 coefficient pairs + secular variation). The file size changed from 4557 → 4554 bytes.testdata/WMM2025.COF— New coefficient file downloaded from NOAA NCEI. Header:2025.0 WMM-2025 11/13/2024.coefficients.go— Updated the doc comment to reflect the new default file validity period (11/13/2024 – 12/31/2029).Error model (
pkg/wmm/magnetic_field.go)Updated global average uncertainty constants from the WMM2025 technical report:
The declination uncertainty formula remains
sqrt(errDA² + errDB²/H²).Tests (
pkg/wmm/*_test.go)coefficients_test.go— AddedTestGetWMM2025Coefficients: validates 7 representative (n,m) pairs at epoch and epoch+1 year, matching the COF file exactly.magnetic_field_test.go— AddedTestAll2025TestValuesFromPaper: validates all 100 official NOAA test points spanning 2025.0–2029.5, at altitudes from 0–98 km, covering all 7 main field components (D, I, H, X, Y, Z, F) and their secular variation rates. Tolerances: ±0.05 nT for field values, ±0.005° for angles.testdata/WMM2025_TEST_VALUES.txt— Official test values from the NOAA WMM2025COF distribution.Documentation & CLI
README.md— Updated coefficient download URL (now points to NCEI), model year references (2020 → 2025), and package description.cmd/wmm_point/main.go— Updated usage strings, model year references, and comment header.Build
go.mod— Added Go module file (github.com/westphae/geomag) to enable building with modern Go toolchains. The repo previously relied on GOPATH mode which is no longer the default.Test plan
go test ./pkg/wmm/ -run TestGetWMM2025Coefficients— all 56 coefficient assertions passgo test ./pkg/wmm/ -run TestAll2025TestValuesFromPaper— all 100 NOAA test points pass (1400+ field component assertions)go test ./pkg/wmm/ -run TestGetWMM2020Coefficients— existing WMM2020 tests still passgo test ./pkg/wmm/ -run TestAll2020TestValuesFromPaper— existing WMM2020 test values still passgo test ./pkg/wmm/ -run TestGetWMM2015v2Coefficients— existing WMM2015v2 tests still passgo test ./pkg/wmm/— full wmm package test suite passeswmm_pointoutput against NOAA's online calculator for a known locationData source
All coefficient and test data downloaded from the official NOAA distribution:
https://www.ncei.noaa.gov/sites/default/files/2024-12/WMM2025COF.zip