asp_plot.bodies#

Per-body facts for the planetary bodies asp_plot supports.

Earth, the Moon, and Mars each carry a handful of constants that the rest of the package needs: an altimetry instrument name, an IAU sphere radius, a pc_align --datum string, a geocentric PROJ string, and a geographic CRS WKT. Historically these were re-typed as ad-hoc {"moon": ..., "mars": ...} dict literals at every use site. This module collects them into one frozen Body dataclass and a BODIES registry so that adding a body (or correcting a constant) is a single-line change rather than a grep across files.

The canonical body detector remains asp_plot.utils.detect_planetary_body(), which inspects a DEM’s CRS WKT. body_for_dem() wraps it to return the matching Body.

Attributes#

Classes#

Body

Immutable bundle of per-body facts.

Functions#

body_for_dem(dem_fn[, body])

Return the Body for a DEM.

Module Contents#

class asp_plot.bodies.Body#

Immutable bundle of per-body facts.

name#

Canonical body name: "earth", "moon", or "mars". Matches the strings returned by asp_plot.utils.detect_planetary_body().

Type:

str

altimetry_instrument#

Reference altimetry instrument: "ICESat-2", "LOLA", or "MOLA".

Type:

str

iau_sphere_radius_m#

IAU mean sphere radius in meters, used to convert planetary radius to height above the sphere. None for Earth, which uses an ellipsoid rather than a sphere.

Type:

float or None

datum#

ASP pc_align --datum string ("D_MOON" / "D_MARS"). None for Earth (pc_align infers the datum from the data).

Type:

str or None

geocentric_proj#

Body-centered geocentric (“ECEF-equivalent”) PROJ string used to convert a Cartesian translation vector into the DEM’s CRS. None for Earth, where EPSG:4978 is used instead (PROJ refuses to operate across celestial bodies, so planets need an explicit string).

Type:

str or None

geographic_crs_wkt#

Geographic CRS WKT used when building planetary GeoDataFrames. None for Earth, whose data already carry a CRS.

Type:

str or None

semi_major_axis_m#

Ellipsoid semi-major axis in meters (fallback for building a geographic CRS when a DEM’s own ellipsoid is unavailable).

Type:

float

inverse_flattening#

Ellipsoid inverse flattening (0.0 for the spherical bodies).

Type:

float

altimetry_instrument: str#
datum: str | None#
geocentric_proj: str | None#
geographic_crs_wkt: str | None#
iau_sphere_radius_m: float | None#
inverse_flattening: float#
name: str#
semi_major_axis_m: float#
asp_plot.bodies.body_for_dem(dem_fn, body=None)#

Return the Body for a DEM.

Parameters:
Return type:

Body

asp_plot.bodies.BODIES#