constants
constants
One-stop constants for planetary work.
Three layers live under this module, mergeable in any combination:
Fundamental physics constants (
G,c,h,k_B,N_A,sigma_sb,m_e,m_p,M_sun,R_earth, …) — re-exported from :mod:astropy.constantsso you don’t have to keep two imports separate. These are CODATA-versioned and authoritative; nothing here repackages or substitutes them.Per-body PCK constants (triaxial radii, GMs, poles, prime meridians, rotation rates) for ~145 solar-system bodies, sourced from NAIF SPICE PCK kernels and versioned by IAU report edition. The default edition is IAU 2015; earlier editions are reachable via :mod:
planetarypy.constants.iau2009for reproducibility studies.GMs themselves are not IAU-edition-specific — they come from JPL’s
gm_de440.tpcephemeris kernel, layered on top of each IAU PCK at build time so the latest GM solution wins regardless of which IAU edition you pick. Edition drift therefore manifests in cartographic and orientation fields (radii,pole_ra,pole_dec,pm, rotation rate), not in GM.NSSDC “textbook parameters” (bond albedo, surface pressure, satellite count, orbital elements, …) for the Sun, eight planets, the Moon, and Pluto — merged transparently into each Body.
NSSDC is NASA’s National Space Science Data Center at Goddard Space Flight Center, maintainer of the canonical per-body planetary fact sheets (D. R. Williams, since 1996). NSSDC’s per-field publication history is exposed via :mod:
planetarypy.constants.nssdcfor time-travel work.
Examples:
from planetarypy.constants import G, c, M_sun # astropy.constants
from planetarypy.constants import Mars # PCK + NSSDC merged
from planetarypy.constants import planets, moons, find_body
Mars.GM # PCK (IAU 2015)
Mars.bond_albedo # NSSDC (latest capture)
Mars.at_time('2001').bond_albedo # NSSDC as of 2001
Mars.at_time('2012').pole_dec # what a 2012 paper would see (IAU 2009)
Mars.at_time('2024').pole_dec # current default (IAU 2015) — ~1.5° apart
See :doc:/explanation/constants_design for the design rationale and :doc:/tutorials/constants_tutorial for a walkthrough.
Functions
| Name | Description |
|---|---|
| asteroids | All asteroids (NAIF id range 2_000_000 ≤ id < 1_000_000_000), |
| at_time | Date-aware single-field lookup across PCK + NSSDC sources. |
| comets | All comets (NAIF 1_NNNNNN range). |
| dwarf_planets | Bodies flagged as IAU-classified dwarf planets (Pluto, Ceres, …). |
| find_body | Best-effort lookup by NAIF id or case-insensitive name. None |
| mission_visited | Small bodies that have been flown by, orbited, or landed on |
| moons | All moons in the registry, or the moons of one parent. |
| planets | All 9 planets (Mercury through Pluto). Pluto is also in |
| sun | The Sun (NAIF 10) as a single-element list, for symmetry with |
asteroids
constants.asteroids()All asteroids (NAIF id range 2_000_000 ≤ id < 1_000_000_000), including alternate / mission-target IDs like Didymos and Dimorphos.
at_time
constants.at_time(body, field, date)Date-aware single-field lookup across PCK + NSSDC sources.
Function form of Body.at_time(date).<field>. Returns the :class:Constant for body.field current as of date.
body may be a name ("mars", case-insensitive), a NAIF id (499), or a :class:Body instance. date accepts "2001" / "2001-06" / "2001-06-15".
Returns None if the body isn’t in the registry, the field isn’t known for that body, or no source has data for that date.
comets
constants.comets()All comets (NAIF 1_NNNNNN range).
dwarf_planets
constants.dwarf_planets()Bodies flagged as IAU-classified dwarf planets (Pluto, Ceres, …).
Pluto appears in both :func:planets and :func:dwarf_planets — matches IAU’s dual classification.
find_body
constants.find_body(query)Best-effort lookup by NAIF id or case-insensitive name. None on miss (unlike bodies[query] which raises KeyError).
mission_visited
constants.mission_visited()Small bodies that have been flown by, orbited, or landed on (Bennu, Ryugu, Eros, Ceres, Vesta, 67P, Tempel 1, …).
moons
constants.moons(of=None)All moons in the registry, or the moons of one parent.
of may be a NAIF id (e.g. 699), a body name ("Saturn", case-insensitive), or a :class:Body instance. With no argument, returns a flat list across all planets.
planets
constants.planets()All 9 planets (Mercury through Pluto). Pluto is also in :func:dwarf_planets — overlap by design, matching IAU’s dual classification.
sun
constants.sun()The Sun (NAIF 10) as a single-element list, for symmetry with :func:planets / :func:moons / etc.