asp_plot.planetary_source#

Planetary (LOLA/MOLA) altimetry sources.

Owns the planetary-altimetry side of asp_plot.altimetry.Altimetry: loading LOLA (Moon) and MOLA (Mars) point clouds from ODE GDS CSV exports, sampling the ASP DEM at those points, and exporting a pc_align-ready CSV.

The body-agnostic machinery (DEM differencing, pc_align export, the shared CSV reader) lives on PlanetarySource; the per-body CSV loaders live on its LolaSource (Moon) and MolaSource (Mars) subclasses. Each instance holds its own data (planetary_points) and reads the cross-cutting dem_fn / directory / aligned_dem_fn from the coordinating Altimetry instance passed at construction.

Attributes#

Classes#

LolaSource

LOLA (Moon) altimetry source.

MolaSource

MOLA (Mars) altimetry source.

PlanetarySource

Body-agnostic planetary altimetry against an ASP DEM.

Functions#

gds_query_async(query_type, bounds, results_code[, email])

Submit an async query to the ODE GDS REST API.

Module Contents#

class asp_plot.planetary_source.LolaSource(alt)#

Bases: PlanetarySource

LOLA (Moon) altimetry source.

Parses a LOLA RDR CSV from the ODE GDS into height above the IAU 1737.4 km lunar sphere. The Moon is nearly spherical (1.4 km equatorial-vs-polar variation), so LOLA TOPOGRAPHY ≈ Pt_Radius − 1737.4 km — either column gives the same dh against an ASP lunar DEM to <1 m.

load_planetary_csv(csv_path)#

Parse a LOLA topo/RDR CSV into self.planetary_points.

Stores height above the IAU lunar sphere on height and the planetary radius on radius_m (used by pc_align).

Parameters:

csv_path (str) – Path to a LOLA RDR CSV from the ODE GDS API.

instrument = 'LOLA'#
class asp_plot.planetary_source.MolaSource(alt)#

Bases: PlanetarySource

MOLA (Mars) altimetry source.

Parses a MOLA PEDR CSV from the ODE GDS, using the PLANET_RAD column to compute height above the IAU Mars sphere (3,396,190 m): height = PLANET_RAD - 3,396,190. This is the same reference as ASP DEMs, so dh = MOLA − DEM is directly meaningful at all latitudes.

load_planetary_csv(csv_path)#

Parse a MOLA PEDR CSV into self.planetary_points.

TOPOGRAPHY (in *_topo_csv.csv) is referenced to the MOLA oblate areoid and produces a latitude-dependent offset of up to ~10 km against an ASP DEM, so it is rejected here. Pass the *_pts_csv.csv from the ODE GDS download instead — it carries PLANET_RAD.

Parameters:

csv_path (str) – Path to a MOLA PEDR CSV from the ODE GDS API. Must include a PLANET_RAD column (use the *_pts_csv.csv file).

instrument = 'MOLA'#
class asp_plot.planetary_source.PlanetarySource(alt)#

Bases: asp_plot.altimetry_source.AltimetrySource

Body-agnostic planetary altimetry against an ASP DEM.

Holds the machinery shared by every planetary instrument: sampling the DEM at the loaded points, differencing, outlier filtering, and exporting a pc_align-ready CSV. The CSV loader is body-specific and lives in the LolaSource (Moon) and MolaSource (Mars) subclasses; the coordinator instantiates the right one from the DEM’s body. The base load_planetary_csv() raises, so an Earth DEM that reaches here is pointed back at ICESat-2.

Parameters:

alt (Altimetry) – The coordinating asp_plot.altimetry.Altimetry instance. Cross-cutting paths (dem_fn, directory, aligned_dem_fn) are read from it so a single source of truth describes the DEM under analysis.

load_planetary_csv(csv_path)#

Load a planetary altimetry CSV (overridden per body).

The base implementation raises: only LolaSource and MolaSource know how to parse a GDS CSV. The CSV is obtained via the request_planetary_altimetry CLI tool, which submits an async query to the ODE GDS API and emails the user a download link; the user downloads and unzips the result, then passes the *_topo_csv.csv / *_pts_csv.csv file to the body source.

Parameters:

csv_path (str) – Path to a CSV file from the ODE GDS.

planetary_to_dem_dh(n_sigma=3)#

Compute height differences between planetary altimetry and DEM.

Reprojects self.planetary_points to the DEM CRS, interpolates DEM heights at altimetry locations, and computes the difference altimetry_minus_dem = height - dem_height. When aligned_dem_fn is set, also populates aligned_dem_height and altimetry_minus_aligned_dem so pre/post-alignment plots can share a single sample. Outliers beyond n_sigma × std from the mean (computed on the unaligned dh) are removed by default.

Parameters:
  • n_sigma (float or None, optional) – Remove dh outliers beyond this many standard deviations from the mean. Default 3. Pass None to skip outlier filtering.

  • self.planetary_points. (The results are stored as new columns on)

to_csv_for_pc_align_planetary(filename_prefix='planetary_for_pc_align')#

Export self.planetary_points to a CSV for pc_align.

Writes columns lon, lat, radius_m (planetary radius from the body center, in meters). Used as the planetary_csv argument to asp_plot.alignment.Alignment.pc_align_dem_to_planetary_csv().

Parameters:

filename_prefix (str, optional) – Prefix for the output CSV filename. Saved in self.alt.directory.

Returns:

Absolute path to the created CSV file.

Return type:

str

instrument = None#
planetary_points = None#
asp_plot.planetary_source.gds_query_async(query_type, bounds, results_code, email=None, **extra_params)#

Submit an async query to the ODE GDS REST API.

Parameters:
  • query_type (str) – GDS query type, e.g. "lolardr" or "molapedr".

  • bounds (dict) – Dictionary with westernlon, easternlon, minlat, maxlat keys.

  • results_code (str) – GDS results format code (e.g. "u" for LOLA, "v" for MOLA).

  • email (str or None, optional) – Email for notification when query finishes.

  • **extra_params – Additional GDS query parameters (e.g. channel="ttttt").

Returns:

Job ID for polling.

Return type:

str

asp_plot.planetary_source.GDS_BASE_URL = 'https://oderest.rsl.wustl.edu/livegds'#
asp_plot.planetary_source.MARS_IAU_SPHERE_RADIUS#
asp_plot.planetary_source.MOON_IAU_SPHERE_RADIUS#
asp_plot.planetary_source.logger#