🚨 Latest Research:Tanstack npm Packages Compromised in Ongoing Mini Shai-Hulud Supply-Chain Attack.Learn More →
Socket
Book a DemoSign in
Socket

geomag-c

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

geomag-c

High-performance World Magnetic Model (WMM) calculator with C backend

pipPyPI
Version
1.0.0
Maintainers
0

GeoMag - World Magnetic Model (WMM) C Library

A high-performance C implementation of the World Magnetic Model (WMM). This library provides fast, accurate calculations of Earth's magnetic field components for navigation, attitude, and heading referencing systems.

What is Magnetic Declination?

Declination is the angle between Magnetic North and True North. Many maps show it in the legend so you can adjust your compass (either physically or mentally).

Why do you need this?

In Washington State, the declination angle is between 14° and 16° West depending on your location. If you just pull out a compass and head North, you're really heading at about 15°. Walk 500 feet on that course, and you'll be about 130 feet to the East of where you wanted to be.

For devices with magnetometers, you need to correct raw magnetic readings to show True North to users, and these values change yearly. In the last 10 years, declination has dropped over a full degree in the Greater Seattle area.

Features

  • Fast C implementation - Optimized for performance
  • Standard WMM models - Support for WMM-2025, WMM-2020, WMM-2015, and WMM-2010
  • High resolution model - WMMHR-2025 with 133 degrees of spherical harmonics
  • Full magnetic field components - Declination, inclination, intensity, and all vector components
  • Uncertainty estimates - Calculate confidence intervals for results
  • Warning zones - Automatic detection of blackout and caution zones near magnetic poles
  • Validated - Test suite verifies against NOAA reference values
  • Simple API - Easy to integrate into your projects

Building

Requirements

  • C compiler (gcc, clang, etc.)
  • Make
  • Math library (libm)

Quick Start

# Build the library and example
make

# Run the example program
make run-example

# Run tests
make test

# Run benchmark
make benchmark

Performance

This C implementation is significantly faster than the Python version:

  • Standard model: ~10-50x faster than Python
  • High resolution model: ~50-200x faster than Python
  • Typical calculation time: < 100 microseconds (standard), < 1 millisecond (high-res)

Optimal for real-time navigation systems, embedded systems, flight simulators, and high-frequency calculations.

Keywords

magnetic

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts