Fix date handling, decimal-year API, and packaging - #16
Draft
dpyeates wants to merge 3 commits into
Draft
Conversation
Recompute magvar() against the current UTC time (or an optional Date / decimal year), make Julian conversion timezone-safe, cache secular variation, expose full field components, warn outside 2025-2030, and drop the unused WMM 2020 coefficients from the published package. Co-authored-by: Darren Yeates <darren@sensorworks.co.uk>
Parse the NOAA/NCEI input test document as the primary fixture, assert exact main-field matches for all 12 published cases, cover secular-rate consistency and API agreement, and keep the extended vector set as regression coverage. Co-authored-by: Darren Yeates <darren@sensorworks.co.uk>
Expand installation/quick-start guidance, document input conventions, field components, decimal years, helpers, migration notes, and how tests relate to the official WMM2025 test-values file. Co-authored-by: Darren Yeates <darren@sensorworks.co.uk>
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
Addresses the general review findings for
magvar(WMM 2025–2030).Bugs fixed
magvar()now evaluates against the current UTC time on each call (no module-load freeze)gregorianToJulianuses UTC (Date.UTC) so results no longer depend on process timezoneyearFrac = decimalYear - 2025.0), aligned with WMMAPI / architecture
magvar/magneticField:Dateor decimal yearcalculateMagVarForDecimalYear,calculateMagneticField,magneticFieldsrc/WMMCOF2020.jsand thejulianDaysNowexporttest/Optimizations
m <= nFloat32Arrayscratch buffers in favor of normal JS numbersPackaging / DX
2.1.0exports+filesso the npm tarball is coefficients + runtime only (~6 KB packed)26 → 29(npm audit: 0 vulnerabilities)Tests
WMM2025_TEST_VALUES.txtchecked in undertest/fixtures/magvar/magneticField/ decimal-year helpers