DOI-USGS / DOI-USGS/ISIS3

gllssical selects wrong calibration constants for Earth flyby data (CalTargetCode E1/E2)

Open
#6,001 0 comments 0 reactions 1 assignee Claimed by @jrcain-usgs View on GitHub
Dominant language
C++
Stars
245
Forks
181
Avg merge
1d 22h
Merged PRs (30d)
15

Description

### Summary

gllssical uses incorrect radiometric conversion factors (S1/S2) for Galileo Earth flyby data. The default (Jupiter orbital phase) constants are applied instead of the Earth-1 encounter constants, producing specific intensity values 3-7x too low depending on filter.

### Root Cause

In calculateScaleFactor0()
(https://github.com/DOI-USGS/ISIS3/blob/dev/isis/src/galileo/apps/gllssical/gllssical.cpp#L421), the loop iterates through all groups in conversionFactors_v002.sav and overwrites fltToRef/fltToRad on each match without breaking:

```cpp
for(int grp = 0; grp < conversionFactors.groups(); grp++) {
PvlGroup currGrp = conversionFactors.group(grp);
if(currGrp.hasKeyword("TargetName")) {
if(!icube->group("Archive")["CalTargetCode"][0].startsWith(currGrp["Ta
rgetName"][0])) {
continue;
}
}
if(currGrp.hasKeyword("MinimumTargetName")) { ... continue if no match ...
}

fltToRef = currGrp["FloatToRef"]; // overwrites every matching group
fltToRad = currGrp["FloatToRad"]; // no break
}
```

The last group in conversionFactors_v002.sav (obtained from downloadIsisData) has neither TargetName nor MinimumTargetName, so both if checks are skipped and it unconditionally overwrites the values. Since this default group comes after the TargetName = E1 group, the E1 calibration is always overwritten.

### Impact

For a cube with CalTargetCode = E1 (1990 Earth flyby), the GREEN filter gets
S2 = 5.315 (default) instead of S2 = 16.17 (E1). Per-filter error factors:

| Filter | E1 S2 (correct) | Default S2 (used) | Error |
| ------- | --------------- | ----------------- | ----- |
| CLEAR | 23.93 | 7.853 | 3.0x |
| GREEN | 16.17 | 5.315 | 3.0x |
| RED | 25.07 | 9.363 | 2.7x |
| VIOLET | 6.070 | 0.811 | 7.5x |
| IR-7270 | 31.19 | 11.77 | 2.7x |
| IR-7560 | 53.44 | 13.56 | 3.9x |
| IR-9680 | 31.73 | 11.81 | 2.7x |
| IR-8890 | 35.49 | 12.76 | 2.8x |

### Versions Affected

Confirmed identical code in 7.0.0, 7.2.0, 8.3.0, and dev (current).

### How to Reproduce

gllssi2isis from=.lbl to=test.cub
spiceinit from=test.cub
catlab from=test.cub # Confirm CalTargetCode = E1 in Archive group
gllssical from=test.cub to=test.cal.cub UNITS=RADIANCE

Output shows S2 = 5.315 for GREEN; expected 16.17

### Workaround

Reorder groups in $ISISDATA/galileo/calibration/conversionFactors_v002.sav (and v001) so that the TargetName = E1 group appears after the default group. Since the loop uses last-match-wins, this causes E1 constants to be selected correctly.

### Suggested Fix

Either:
1. Add break after setting fltToRef/fltToRad when a TargetName match is found (first-match-wins), or
2. Restructure to prefer specific matches over the default fallback

### Discovery Context

Found while independently reproducing the Galileo SSI Earth disk-integrated photometry pipeline from Strauss et al. (2024, AJ 167:87) using an AI-assisted autonomous research workflow. The calibration error was identified by comparing our results against published values and expected Earth spectral albedo from the literature.

Credit: Bug identified with assistance from Claude (Anthropic).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.