Skip to content

Update World Magnetic Model from WMM2020 to WMM2025#8

Open
zourzouvillys wants to merge 1 commit intowestphae:masterfrom
sixfathoms:update-wmm2025
Open

Update World Magnetic Model from WMM2020 to WMM2025#8
zourzouvillys wants to merge 1 commit intowestphae:masterfrom
sixfathoms:update-wmm2025

Conversation

@zourzouvillys
Copy link
Copy Markdown

@zourzouvillys zourzouvillys commented Mar 30, 2026

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-compressed WMM.COF binary 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:

Component WMM2020 WMM2025 Unit
X 131 137 nT
Y 94 89 nT
Z 157 141 nT
H 128 133 nT
F 148 138 nT
I 0.21 0.20 deg
D (const) 0.26 0.26 deg
D (1/H) 5625 5417 nT

The declination uncertainty formula remains sqrt(errDA² + errDB²/H²).

Tests (pkg/wmm/*_test.go)

  • coefficients_test.go — Added TestGetWMM2025Coefficients: validates 7 representative (n,m) pairs at epoch and epoch+1 year, matching the COF file exactly.
  • magnetic_field_test.go — Added TestAll2025TestValuesFromPaper: 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.
  • All existing WMM2015v2 and WMM2020 tests continue to pass (they load their own COF files).

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 pass
  • go 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 pass
  • go test ./pkg/wmm/ -run TestAll2020TestValuesFromPaper — existing WMM2020 test values still pass
  • go test ./pkg/wmm/ -run TestGetWMM2015v2Coefficients — existing WMM2015v2 tests still pass
  • go test ./pkg/wmm/ — full wmm package test suite passes
  • Manual verification: compare wmm_point output against NOAA's online calculator for a known location

Data source

All coefficient and test data downloaded from the official NOAA distribution:
https://www.ncei.noaa.gov/sites/default/files/2024-12/WMM2025COF.zip

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant