DOI-USGS / DOI-USGS/ale

Add MroHiRisePds3LabelNaifSpiceDriver for direct EDR processing

Open
#701 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
XC
Stars
18
Forks
38
Avg merge
1d 20h
Merged PRs (30d)
3

Description

## Summary

ALE has `MroHiRiseIsisLabelNaifSpiceDriver` but no PDS3 label variant. This means HiRISE EDR files cannot be used directly with ALE — they must first go through ISIS `hi2isis` + `spiceinit` to create a cube with an ISIS label.

CTX already has both variants (`MroCtxIsisLabelNaifSpiceDriver` + `MroCtxPds3LabelNaifSpiceDriver`), enabling fully ISIS-free processing from raw PDS EDR to ISD.

## Motivation

We're building a Python-native HiRISE calibration pipeline ([isistools/hirisepipe](https://github.com/michaelaye/isistools)) that replaces hical + histitch + cubenorm in pure Python. The last remaining ISIS dependency is `hi2isis` + `spiceinit` to create a cube for ALE's camera model. A PDS3 driver would eliminate this entirely.

With the existing `MroCtxPds3LabelNaifSpiceDriver` + `props={'web': True}` (SpiceQL web service), CTX processing is already fully ISIS-free from raw EDR to map-projected GeoTIFF. The same should be possible for HiRISE.

## What's needed

A new class `MroHiRisePds3LabelNaifSpiceDriver` in `ale/drivers/mro_drivers.py` that:

1. Parses the HiRISE PDS3 EDR label (groups: `TIME_PARAMETERS`, `INSTRUMENT_SETTING_PARAMETERS`, `TEMPERATURE_PARAMETERS`, `IMAGE`, `CALIBRATION_IMAGE`)
2. Extracts instrument parameters: `MRO:CPMM_NUMBER`, `MRO:CHANNEL_NUMBER`, `MRO:TDI`, `MRO:BINNING`, `MRO:SCAN_EXPOSURE_DURATION`, `MRO:TRIM_LINES`
3. Maps CPMM → CCD → NAIF frame code (the CPMM-to-CCD mapping is non-trivial: `[0,1,2,3,12,4,10,11,5,13,6,7,8,9]`)
4. Handles the `LINE_SAMPLES` difference (PDS3 reports 5056 including prefix/suffix, science image is 1024)

The existing `MroHiRiseIsisLabelNaifSpiceDriver` can serve as the reference implementation — the PDS3 variant just needs different label keyword paths.

## PDS3 vs ISIS label keyword mapping

| Parameter | ISIS label path | PDS3 label path |
|---|---|---|
| CPMM number | `Instrument.CpmmNumber` | `INSTRUMENT_SETTING_PARAMETERS.MRO:CPMM_NUMBER` |
| Channel | `Instrument.ChannelNumber` | `INSTRUMENT_SETTING_PARAMETERS.MRO:CHANNEL_NUMBER` |
| TDI | `Instrument.Tdi` | `INSTRUMENT_SETTING_PARAMETERS.MRO:TDI` |
| Binning | `Instrument.Summing` | `INSTRUMENT_SETTING_PARAMETERS.MRO:BINNING` |
| Start time | `Instrument.StartTime` | `TIME_PARAMETERS.START_TIME` |
| SCLK | `Instrument.SpacecraftClockStartCount` | `TIME_PARAMETERS.SPACECRAFT_CLOCK_START_COUNT` |
| Exposure | `Instrument.ScanExposureDuration` | `INSTRUMENT_SETTING_PARAMETERS.MRO:SCAN_EXPOSURE_DURATION` |
| Lines | `Dimensions.Lines` | `IMAGE.LINES` |
| Samples | `Dimensions.Samples` | `IMAGE.LINE_SAMPLES` (note: includes prefix/suffix) |
| Target | `Instrument.TargetName` | `TARGET_NAME` |

## Impact

This would enable fully ISIS-free HiRISE processing pipelines — from PDS EDR download to calibrated, map-projected GeoTIFF — using only Python packages (ale + usgscsm + csmapi).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.