Skip to main content

EGM96 geoid undulations

Project description

egm96

GPS reports altitude as height above the WGS 84 reference ellipsoid, a smooth mathematical surface that can sit tens of meters away from actual sea level. EGM96, the 1996 Earth Gravitational Model from the U.S. National Geospatial-Intelligence Agency, describes where mean sea level lies relative to that ellipsoid. The gap between the two is the geoid undulation; subtracting it from a GPS height gives an approximate height above sea level.

This package looks up the EGM96 undulation for any coordinate.

Usage

import egm96

egm96.undulation(48.14, 11.58)   # 45.48  (meters, near Munich)

The undulation is the height of the geoid above the WGS 84 ellipsoid. Subtract it from a GPS ellipsoidal height h to get a height above mean sea level:

H = h - egm96.undulation(lat, lon)

Coordinates are in degrees. Longitude wraps at ±180° and latitude is clamped to ±90°. Both arguments also accept NumPy arrays, which broadcast together and return an array.

Accuracy and size

The package bundles the complete EGM96 5' grid (2161 × 4321 points) and interpolates it bilinearly. Against GeographicLib's cubic evaluation of the same model, over 6000 random points, the largest difference is < 0.06 m - negligible next to EGM96's own ~0.5–1 m uncertainty relative to the real geoid.

Bilinear error grows quickly if the grid is coarsened, so it is worth keeping the full resolution:

Grid spacing Max error vs EGM96
0.25° (15') 0.5 m
0.17° (10') 0.2 m
0.083° (5', used) 0.05 m

Stored plainly the grid is about 13 MB. The geoid is smooth, so encoding it as second differences (in centimeters) and deflating the result shrinks it to 3.1 MB with no loss; the loader reconstructs the values with two cumulative sums.

Grid Data

src/egm96/data/egm96-5.npz is built from the source geoid at packaging time and is not stored in the repository. generate-egm96-grid downloads the 5' PGM from GeographicLib — only if it is not already cached locally — and writes the .npz. CI runs the generator before uv build, so the grid ends up inside the wheel, and installing from PyPI needs no network access at runtime.

To build locally:

uv sync
uv run ./generate-egm96-grid
uv build

License

MIT (see LICENSE). EGM96 is a work of the U.S. Government (NGA, NASA, and Ohio State University) in the public domain; the 5' dataset is redistributed by the MIT-licensed GeographicLib.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

egm96-0.2.0.tar.gz (3.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

egm96-0.2.0-py3-none-any.whl (3.1 MB view details)

Uploaded Python 3

File details

Details for the file egm96-0.2.0.tar.gz.

File metadata

  • Download URL: egm96-0.2.0.tar.gz
  • Upload date:
  • Size: 3.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for egm96-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ebcf6eefe350eee9fdb03e89bdce0471c19e5662ce71dd0ab4cbafbe159b3a0f
MD5 89c803b8379902e3657e78aa1ee37c4b
BLAKE2b-256 12ccbe64de57fcbc6af5a2243b851f95785b2f7df63e3e18afec3e500066f861

See more details on using hashes here.

File details

Details for the file egm96-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: egm96-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 3.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for egm96-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2958d3bf541ae1389aa6c4401316ee06a99172080f06c1e85dc6edad0326aba6
MD5 8e477891eeb601b4055ed791d943e39d
BLAKE2b-256 0ec78062b66accfd375c830b62bb3566e3fe4607aaa72e9a477a51ac709f6306

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page