Skip to content

Lunar Topography Integration — Phase 7.6

Phase 7.6 adds a lazy reader for uncompressed PDS3 lunar DEM image products. The first documented target is the NASA LOLA/SELENE SLDEM2015 PDS3 IMG product. The reader implements the existing LunarLimbModel provider contract, so it can be supplied to EclipseEngine.calculate_local(..., limb_model=...) without changing the engine's numerical path.

Supported product format

PDS3LunarDEMModel.from_pds3_img(image_path, label_path=None, ...) reads a PDS3 IMAGE object with:

  • MAP_PROJECTION_TYPE = "SIMPLE CYLINDRICAL";
  • pixel registration, east-positive longitude and a declared body-fixed coordinate-system name;
  • a spherical reference surface (A_AXIS_RADIUS, B_AXIS_RADIUS, and C_AXIS_RADIUS agree within 1 cm);
  • LINES, LINE_SAMPLES, SAMPLE_TYPE, SAMPLE_BITS, UNIT, SCALING_FACTOR, OFFSET, map resolution and projection offsets in the detached/attached PDS3 label.

The reader supports PC_REAL/IEEE_REAL 32-bit floats and common 8/16/32-bit signed/unsigned integer image samples. It understands image pointers that use record or byte positions and row records with padding. The binary image is opened as a read-only numpy.memmap; the whole global DEM is not loaded into RAM. The model reads only the four cells needed for each bilinear prediction.

Compressed JP2, PDS4, polar stereographic products, ellipsoidal reference surfaces, and coordinate reprojection are not handled by this reader. Convert such products with a planetary GIS tool to a documented simple-cylindrical PDS3-compatible input or use a separate validated adapter. Do not relabel a product's frame or vertical datum to make it pass validation.

SLDEM2015 units and datum

The SLDEM2015 global PDS3 IMG label identifies a 128 pixels/degree product over 60°S–60°N and 0°–360° east longitude. It declares 32-bit PC_REAL samples, UNIT = KILOMETER, SCALING_FACTOR = 1, and a reference OFFSET of 1737.4 km. Its map projection declares a 1737.4 km spherical radius and the MEAN EARTH/POLAR AXIS OF DE421 body-fixed frame.

The OFFSET is the reference-sphere radius in the PDS planetocentric-radius convention. EclipseKit's limb model needs height above that sphere, not the absolute radius. The reader therefore computes:

\[ h_{m} = (DN \times SCALING\_FACTOR)\times UNIT_{m} + OFFSET_{m} - R_{reference,m}. \]

For the SLDEM2015 IMG product, OFFSET and R_reference are both 1,737,400 m, so the expression reduces to DN × 1000 m. The offset is not added a second time. The same formula also handles PDS labels where DN plus scale and offset represents an absolute radius.

The code does not infer per-point uncertainty from SLDEM2015's published product-wide accuracy. The documented typical vertical accuracy of roughly 3–4 m is not automatically copied into LunarLimbPrediction.uncertainty_m. Supply an independent, defensible uncertainty model before using Phase 7.5 to propagate topographic uncertainty.

Open a local product

Download a global or regional uncompressed IMG product and its matching LBL from the NASA/LOLA data node. The large global SLDEM2015 128 ppd image is approximately 2.8 GB; it is memory-mapped rather than loaded eagerly.

from eclipsekit import PDS3LunarDEMModel, LunarLimbQuery

with PDS3LunarDEMModel.from_pds3_img(
    r"data\SLDEM2015_128_60S_60N_000_360_FLOAT.IMG",
    r"data\SLDEM2015_128_60S_60N_000_360_FLOAT.LBL",
    expected_coordinate_system="MEAN EARTH/POLAR AXIS OF DE421",
) as dem:
    print(dem.product_info.to_dict())
    prediction = dem.predict(LunarLimbQuery(
        selenographic_latitude_deg=12.0,
        selenographic_longitude_deg=35.0,
        limb_angle_deg=0.0,
    ))
    print(prediction.altitude_m, prediction.source)

The with block closes the memory map. Call close() explicitly if the model is kept outside a context manager. A closed model cannot be queried again.

To use the provider in a local eclipse calculation:

from eclipsekit import EclipseEngine, Observer, PDS3LunarDEMModel

engine = EclipseEngine.from_jpl("de440s")
with PDS3LunarDEMModel.from_pds3_img("data/lunar.img", "data/lunar.lbl") as dem:
    result = engine.calculate_local(
        Observer(42.6, -5.5703, elevation_m=800.0),
        "2026-08-12T18:00:00Z",
        limb_model=dem,
    )

Coordinate-frame caution: the PDS label's frame is retained in dem.product_info and in each contact's serialized limb-model metadata. No DE421/DE440, mean-Earth/mean-axis, principal-axis, or libration transformation is applied. The existing contact-to-selenographic mapping remains the Phase 5 Meeus-style approximation. Use a product only after confirming that its declared frame is compatible with the coordinates generated by the active limb-mapping implementation. The expected_coordinate_system option checks an exact name in the label; it does not perform a transformation.

Validate a downloaded product

python -m pip install -e ".[dev,limb]"
eclipsekit-validate-topography `
  --image "data\SLDEM2015_128_60S_60N_000_360_FLOAT.IMG" `
  --label "data\SLDEM2015_128_60S_60N_000_360_FLOAT.LBL" `
  --expected-coordinate-system "MEAN EARTH/POLAR AXIS OF DE421"

The command checks the PDS3 label, projection, coordinate declaration, spherical radius, data type, record layout, file size and a deterministic grid of interpolation samples. It writes reports/phase7_6/lunar-topography-validation.json and .md. PASS means those structural and sampled interpolation checks pass; it is not an independent topographic accuracy result. PARTIAL means some sampled points were missing/invalid while others worked; FAIL means none passed.

Use --accept-labelled-radius only after reviewing a non-default source reference radius. The default requires 1,737,400 m, matching the lunar reference sphere used by the current project.

Known limits

  1. There is no automatic download; users obtain the source product from NASA and retain the original IMG and LBL locally.
  2. This phase reads one PDS3 image object at a time. Separate regional tiles can be opened as separate providers; a tile-mosaic selection layer is future work.
  3. No transformation is made between body-fixed frames, no interpolation is performed across missing-data cells, and no JP2 decompression is included.
  4. The global SLDEM2015 map covers ±60° latitude. Polar coverage requires a separate appropriately referenced polar product.
  5. A successful storage/interpolation smoke test is not a lunar limb benchmark. Independent height/control data and eclipse-contact comparisons remain necessary before claiming physical accuracy.

Source references