feat: WMM native error model with location-dependent uncertainty (#13)#15
feat: WMM native error model with location-dependent uncertainty (#13)#15StreckerCM wants to merge 5 commits intodevelopmentfrom
Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…t δD Implement Issue #13 — WMM location-dependent uncertainty (Level 2). - Add UncertaintyModelPreference enum (Auto/Iscwsa/Native) and UncertaintySource enum - Add UncertaintyModel property to CalculationOptions (default: Auto) - Create wmm-error-model.json embedded resource with WMM2025 and WMMHR2025 constants - Add WmmErrorModelData/WmmErrorModelEntry POCOs for JSON deserialization - Extend GeomagneticUncertainty with X, Y, Z, H components and Source property - Extend UncertaintyDataProvider with WMM error model resolution and δD computation - Compute location-dependent δD = √(C₁² + (C₂/H)²) using horizontal intensity - Integrate into GeoMag pipeline: Auto uses WMM error model for WMM/WMMHR - ModelCategoryOverride forces ISCWSA for backward compatibility - Add 21 new tests (unit + integration), all 322 tests pass Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix critical bug: async MagneticCalculationsAsync now uses 4-param GetUncertainty with per-step H value (was using stale ISCWSA-only overload) - Fix revision string to distinguish WMM2025-TR vs WMMHR2025-TR - Update file headers and XML docs to reflect dual ISCWSA/WMM support Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
[REVIEWER] Code Review — Iteration #1Critical (Fixed)
Major (Fixed)
Major (Documented)
Minor (Fixed)
Minor (Accepted)
Notes
|
[API_DESIGNER] API Surface Review — Iteration #1Reviewed: CriticalNone. Major1. The 2-param Suggestion: Mark the 2-param overload 2. Both Minor3. Naming inconsistency:
4. The property 5. The XML doc comment on Notes
|
[API_DESIGNER] API Surface Review — Iteration #1Critical (Already Fixed)
Significant
Moderate
Minor
Notes
|
[PROJECT_MGR] Requirements Check — Iteration #1Task Verification✅ Add UncertaintyModelPreference enum — Enum created in src/GeoMagSharp/Enums/GeoMagEnums.cs with values: Auto, Iscwsa, Native ✅ Add UncertaintyModel property to CalculationOptions — Property added in src/GeoMagSharp/Models/Configuration/CalculationOptions.cs; defaults to Auto ✅ Create wmm-error-model.json embedded resource — JSON file present at src/GeoMagSharp/Data/wmm-error-model.json with WMM2025 and WMMHR2025 constants ✅ Add JSON POCO classes for deserialization — WmmErrorModelData.cs and WmmErrorModelEntry classes created in src/GeoMagSharp/Models/Configuration/WmmErrorModelData.cs ✅ Add new properties to GeomagneticUncertainty — Properties NorthIntensity, EastIntensity, VerticalIntensity, HorizontalIntensity, and Source added to src/GeoMagSharp/Models/Results/GeomagneticUncertainty.cs ✅ Extend UncertaintyDataProvider — WMM methods implemented:
✅ Compute δD formula — ComputeDeclinationUncertainty() formula implemented: δD = √(C₁² + (C₂/H)²) ✅ Integration in GeoMag.cs — UncertaintyModel preference passed through calculation pipeline (lines 151, 369) ✅ Unit tests for WMM constants — Multiple test methods present:
✅ Unit tests for δD computation — Comprehensive test coverage:
✅ Backward compatibility — Iscwsa override verified; existing tests pass unchanged ✅ Build status — 0 errors, 0 warnings Build & Test ResultsBuild: ✅ Succeeded (0 errors, 0 warnings)
Tests: ✅ 320 passed, 2 skipped, 0 failed
SummaryAll requirements from tasks.md are met. Code is complete and verified:
Ready for next Ralph Loop iteration. |
[SECURITY] Security Review — Iteration #1SummaryReviewed Minor Issues1.
2. The sentinel value 999.0 is returned when
3. Negative The guard Notes (No Action Required)Thread safety with String-based model key mapping: The Embedded JSON resource integrity: The JSON is embedded at compile time as an assembly resource. It cannot be modified at runtime by consumers. The structure is simple and well-typed via the POCO classes.
Overflow risk in VerdictNo critical or major issues found. The implementation is well-structured with appropriate error handling. The three minor items above are suggestions for improved defensive coding but do not represent security vulnerabilities or correctness bugs in practice. |
[SECURITY] Security Review — Iteration #1Critical (Already Fixed)
High
Medium
Low
SummaryThe async bug (CRITICAL-1) is already fixed. Remaining findings are defensive hardening — input validation guards, error message clarity, and making the 999.0 sentinel identifiable. No exploitable vulnerabilities found. |
[PROJECT_MGR] Requirements Check — Iteration #1Task Verification
Build & Test Results
Completion Criteria
AssessmentFeature implementation is 100% complete. All tasks verified against source code and passing tests. Ready for Ralph Loop review cycles. |
… internal setters - Rename DipAngle to Inclination with [Obsolete] backward-compat alias - Change GeomagneticUncertainty setters to internal (immutable to consumers) - Make GetIscwsaUncertainty/GetWmmUncertainty internal - Add NaN/Infinity/negative guards to ComputeDeclinationUncertainty - Add null-check after JSON deserialization in LoadEmbeddedResource - Add InternalsVisibleTo for test assembly - Update all tests to use Inclination, add 6 new edge-case tests - Update README and example project Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
[IMPLEMENTER] Pass 2, Iteration 0 — Clean ✅Reviewed all implementation files for completeness and correctness:
Finding: None — Implementation is complete and correct. |
[REVIEWER] Pass 2, Iteration 1 — Clean ✅Thorough review of all production and test code. Verified:
Finding: None — Code is production-ready. |
[TESTER] Pass 2, Iteration 2 — Clean ✅Test verification:
Test coverage verified for Issue #13:
Finding: None — All tests pass, coverage is comprehensive. |
[API_DESIGNER] Pass 2, Iteration 3 — Clean ✅Public API review: New enums — Well-named, documented, default values correct:
CalculationOptions.UncertaintyModel — Good property name, defaults to Auto, copy constructor propagates correctly. GeomagneticUncertainty — Internal setters prevent misuse. New nullable properties (NorthIntensity, EastIntensity, etc.) correctly use UncertaintyDataProvider — Public surface is minimal (2 GetUncertainty overloads + GetModelCategory). Helper methods correctly internalized. API discoverability: Finding: None — API surface is clean, well-documented, and backward-compatible. |
[SECURITY] Pass 2, Iteration 4 — Clean ✅Security review of all public entry points, data loading, and computation:
Finding: None — No security issues detected. |
[PROJECT_MGR] Pass 2, Iteration 5 — Clean ✅Requirements check:
Clean cycle count: 1 of 2 — Starting pass 3 for the second clean cycle. |
Pass 3 — All 6 Personas — Clean ✅✅Second clean cycle confirmed. All personas reviewed with no findings:
✅ Clean cycle count: 2 of 2 — COMPLETION CRITERIA MET Build: 0 errors | Tests: 326 passed, 2 skipped | No uncommitted changes |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
Adds the WMM native error model (Level 2) for location-dependent uncertainty estimation, implementing the formulas from the WMM2025 Technical Report Section 3.4.
δD = √(C₁² + (C₂/H)²)— declination uncertainty varies with horizontal intensity HUncertaintyModelPreferenceenum:Auto(default, uses WMM for WMM/WMMHR models),Iscwsa(force ISCWSA),Native(force WMM error model)GetUncertainty(model, override)2-param overload still returns ISCWSA valuesBreaking Changes
DipAngle→Inclinationrename:GeomagneticUncertainty.DipAngleis now[Obsolete]with a forwarding alias. Use.Inclinationinstead.DipAnglewill be removed in a future version.GeomagneticUncertaintyproperty setters are nowinternal— external consumers can no longer set values directly (they were never intended to).GetIscwsaUncertaintyandGetWmmUncertaintychanged frompublictointernal. UseGetUncertainty()instead.New Properties on
GeomagneticUncertaintySourceUncertaintySourceIscwsaorWmmErrorModelNorthIntensitydouble?EastIntensitydouble?VerticalIntensitydouble?HorizontalIntensitydouble?InclinationdoubleDipAngleTest plan
Closes #13
🤖 Generated with Claude Code