geopotential
Earth's gravity field from spherical-harmonic coefficients. Read a model from an ICGEM .gfc
file, from static models such as GOCO06s to every monthly GRACE field. Then evaluate the
potential, the gravity vector or the gravity-gradient tensor at any point, or draw maps of the
geoid, gravity anomalies or water height. Pure Rust, no required dependencies.
The geoid from GOCO06s, drawn with this crate.
Install
Example: a field and what it does
use ;
// A field with a single term: J2, Earth's flattening.
let mut field = zeros;
field.set;
// Geoid height at the equator and at the North Pole.
let lats = ;
let geoid = field.grid;
assert!; // the equatorial bulge
assert!; // flatter at the poles
// Add the central term (C̄00 = 1) and find gravity on a satellite 400 km above northern Italy.
field.set;
let r = 6_378_137.0 + 400e3;
let = ;
let = field.partials.acceleration_neu;
assert!; // pointing down, about 8.7 m/s²
assert!;
Example: read a real model
Download a model first, for example GOCO06s.gfc from the
ICGEM model table.
use ;
The calibrated error of each coefficient of the July 2026 COST-G field, read with read_gfc.
What is inside
| Item | What it does |
|---|---|
Legendre |
Normalized Legendre functions and their derivatives, stable to degree 2700 at every latitude (Holmes & Featherstone 2002) |
Coefficients |
The coefficients with their GM, radius and tide system; degree variances, rescaling, truncation and tide-system conversion (IERS Conventions 2010, ch. 6) |
TimeVariable |
Models with trends and periodic terms, evaluated at any date (ICGEM) |
partials, second_partials |
Potential, gravity vector and gravity-gradient tensor at a point |
grid with Functional |
Maps of geoid height, gravity anomaly or disturbance, radial gradient or equivalent water height (Barthelmes 2013; Wahr et al. 1998) |
read_gfc, Gfc |
ICGEM .gfc models, static or time-variable (icgem1.0 and 2.0), with their errors (format) |
julian_epoch, parse_date |
The decimal-year dates these files use |
special |
Complete elliptic integrals K and E by the arithmetic–geometric mean, and Bulirsch's general complete integral cel (Bulirsch 1969), which the fields of rings of mass, charge and current share |
linalg |
Pivoted Gaussian elimination for general systems and Cholesky for the normal equations of least squares |
fft |
The radix-2 fast Fourier transform, for time series and gridded fields |
Conventions:
- angles in radians, geocentric latitude;
- fully normalized coefficients with no Condon–Shortley phase, as in ICGEM files;
- the optional
serdefeature serializesCoefficients.
Models are free from ICGEM; each COST-G monthly series also comes as one zip.
Applications
- Height systems. Turning a GNSS ellipsoidal height into a usable one needs the geoid; this is the synthesis behind national models such as GEOID2022 and AUSGeoid2020.
- Orbit design and determination.
J2from a real model sets the nodal precession that makes an orbit sun-synchronous;examples/sun_synchronous_orbit.rsreproduces Landsat's 98.2°. - Inertial navigation. The deflection of the vertical is what an accelerometer mistakes for horizontal acceleration, and compensating it from a model is standard practice.
- Gradiometry.
SecondPartials::tensor_neugives the tidal tensor a gradiometer measures, in which a vehicle's own acceleration cancels. - Reading published models.
read_gfctakes any ICGEM.gfcfile, static or time-variable.
How it is checked
- Legendre functions: against closed forms, the addition theorem to degree 2700 close to the pole, and the Legendre equation.
- Derivatives: against finite differences.
- The field: against Laplace's equation, and the IERS tide offset of C̄20.
- An independent implementation: the degree-300 GOCO06s model agrees with geo5d to about 1e-15.
- Real files from COST-G and GOCO06s, which bend the format in practice: missing header
markers, comment and warning lines,
errors empirical, and free text before the header. A malformed record fails with its line number. The fixtures' sources are listed intests/data/README.md.
One of eight crates in physica:
physica (all of them, plus cross-domain analogies) ·
metrology (constants) ·
geopotential (the gravity field) ·
gravimetry (missions and GRACE) ·
gravitational (waves) ·
gravitics (frontier gravity) ·
magnetics (magnetism and MHD) ·
plasmoid (fusion plasma).