crs
crs
Planetary coordinate reference systems via IAU codes.
Thin, pyproj-only helpers that resolve IAU planetary CRS and build feature-centered local projections. The body’s ellipsoid / radii are carried by the IAU code itself — nothing is looked up or hardcoded here.
PROJ ships a single IAU CRS edition (IAU_2015); there is no IAU_2009/IAU_2006/… authority, so everything here builds against IAU_2015. (This is unrelated to :mod:planetarypy.constants, which does carry multiple IAU PCK editions for body parameters.)
Body names are resolved to NAIF ids via :mod:planetarypy.constants (one shared body registry); pass a NAIF id integer to skip that import. On a fresh install, the first name resolution triggers the one-time NSSDC archive download that planetarypy.constants performs.
Examples
>>> from planetarypy.crs import body_crs, local_crs
>>> body_crs("mars") # Mars ocentric geographic CRS
>>> body_crs(499, system="ographic") # by NAIF id
>>> local_crs(137.4, -4.6, "mars") # azeqd centered on Gale craterFunctions
| Name | Description |
|---|---|
| body_crs | Return a body’s geographic CRS from the IAU 2015 authority. |
| get_crs | craterpy-compatible alias for :func:body_crs. |
| local_crs | Azimuthal-Equidistant CRS centered on (lon, lat) for body. |
body_crs
crs.body_crs(body, system='ocentric')Return a body’s geographic CRS from the IAU 2015 authority.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| body | str or int | Body name (resolved via :mod:planetarypy.constants) or NAIF id. |
required |
| system | (ocentric, ographic) | Latitude convention. "ocentric" (the spherical IAU definition) is available for every body; "ographic" only for bodies that define it (e.g. Mars, Jupiter — not the Moon or Vesta). |
"ocentric" |
Returns
| Name | Type | Description |
|---|---|---|
| pyproj.CRS | The ellipsoid/radii come from the IAU code itself. |
get_crs
crs.get_crs(body, system='default')craterpy-compatible alias for :func:body_crs.
system="default" maps to "ocentric". Unlike craterpy’s original, this does NOT accept an arbitrary CRS string as system (no exception-driven passthrough) — construct such CRS with pyproj directly.
local_crs
crs.local_crs(lon, lat, body, *, system='ocentric')Azimuthal-Equidistant CRS centered on (lon, lat) for body.
Built on the body’s IAU geodetic CRS, so its sphere/ellipsoid comes from the IAU code (nothing looked up). Use for feature-centered work — local buffering, annulus geometry, distance-true measurements near the center.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| lon | float | Center longitude/latitude in degrees. | required |
| lat | float | Center longitude/latitude in degrees. | required |
| body | str or int | Body name or NAIF id. | required |
| system | str | See :func:body_crs. |
'ocentric' |
Returns
| Name | Type | Description |
|---|---|---|
| pyproj.CRS | A projected CRS (metres) centered on the given point. |