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.3.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.3.0-py3-none-any.whl (3.1 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: egm96-0.3.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.3.0.tar.gz
Algorithm Hash digest
SHA256 2c0fdfc72971dc61d576bc7993bd992ea813756da1f83d4d25350e277b9099d1
MD5 e3ed59865b8ca9ae0e2f043608027e93
BLAKE2b-256 1f463a266648c0bf2d6189b2624ce080bd9fb9da85149b651b065c5446a65b4c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: egm96-0.3.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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 230ea84b48130c6742bae19db94cd5d7737ecd6e3a2ab0b27059f1b807732076
MD5 69a3e540e7a6b205f557aef2843df191
BLAKE2b-256 825886e8c7b335c190121e3ded407a0935048041bc2709b2839c51951555a7f3

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