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#
Immutable bundle of per-body facts. |
Functions#
|
Return the |
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 byasp_plot.utils.detect_planetary_body().- Type:
- iau_sphere_radius_m#
IAU mean sphere radius in meters, used to convert planetary radius to height above the sphere.
Nonefor Earth, which uses an ellipsoid rather than a sphere.- Type:
float or None
- datum#
ASP
pc_align --datumstring ("D_MOON"/"D_MARS").Nonefor 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.
Nonefor Earth, whereEPSG:4978is 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.
Nonefor 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:
- asp_plot.bodies.body_for_dem(dem_fn, body=None)#
Return the
Bodyfor a DEM.- Parameters:
dem_fn (str) – Path to the DEM file.
body (str or None, optional) – Body name to look up directly. If
None(default), the body is auto-detected from the DEM’s CRS viaasp_plot.utils.detect_planetary_body().
- Return type:
- asp_plot.bodies.BODIES#