DOI-USGS / DOI-USGS/ale

Inconsistent Erring Behavoir on ALE Drivers / Non-intuitive erring messages

Open
#454 1 comment 0 reactions 1 assignee Claimed by @acpaquette View on GitHub
Dominant language
XC
Stars
18
Forks
38
Avg merge
1d 20h
Merged PRs (30d)
3

Description

I think debugging would be easier for new users (also in general) if there was consistent erring behavior on the drivers instrument_id property. For example, the KaguyaTC Driver just fails:

```
Trying
Failed: 'INSTRUMENT_ID'

Traceback (most recent call last):
File "/work/users/ladoramkershner/projects/ale/ale/drivers/__init__.py", line 127, in load
res.instrument_id
File "/work/users/ladoramkershner/projects/ale/ale/drivers/selene_drivers.py", line 79, in instrument_id
instrument = super().instrument_id
File "/work/users/ladoramkershner/projects/ale/ale/base/label_pds3.py", line 33, in instrument_id
return self.label['INSTRUMENT_ID']
File "/home/ladoramkershner/miniconda3/envs/isis6_ale/lib/python3.6/site-packages/pvl/collections.py", line 175, in __getitem__
return dict_getitem(self, key)[0]
KeyError: 'INSTRUMENT_ID'
Trying
```

Where as the Viking Drivers actually raises an exception:
```
Failed: Instrument ID [MRFLRO] is wrong.

Traceback (most recent call last):
File "/work/users/ladoramkershner/projects/ale/ale/drivers/__init__.py", line 127, in load
res.instrument_id
File "/work/users/ladoramkershner/projects/ale/ale/drivers/viking_drivers.py", line 137, in instrument_id
raise Exception (f'Instrument ID [{instrument_id}] is wrong.')
Exception: Instrument ID [MRFLRO] is wrong.
Trying
Failed: 'MRFLRO'
```

I also think a more specific exception message might be helpful ('Instrument ID found on the input label [INSTRUMENT_ID], does not match this drivers available instrument ids').

Finally, trailing vertical space after the Exception would allow for more intuitive reading experience. Right now the Traceback stack butts up against the beginning prints of the next driver trial. So the previous two examples would print out as follows:
```
Trying
Failed: 'INSTRUMENT_ID'

Traceback (most recent call last):
File "/work/users/ladoramkershner/projects/ale/ale/drivers/__init__.py", line 127, in load
res.instrument_id
File "/work/users/ladoramkershner/projects/ale/ale/drivers/selene_drivers.py", line 79, in instrument_id
instrument = super().instrument_id
File "/work/users/ladoramkershner/projects/ale/ale/base/label_pds3.py", line 33, in instrument_id
return self.label['INSTRUMENT_ID']
File "/home/ladoramkershner/miniconda3/envs/isis6_ale/lib/python3.6/site-packages/pvl/collections.py", line 175, in __getitem__
return dict_getitem(self, key)[0]
KeyError: 'INSTRUMENT_ID'
Trying
Failed: Instrument ID [MRFLRO] is wrong.

Traceback (most recent call last):
File "/work/users/ladoramkershner/projects/ale/ale/drivers/__init__.py", line 127, in load
res.instrument_id
File "/work/users/ladoramkershner/projects/ale/ale/drivers/viking_drivers.py", line 137, in instrument_id
raise Exception (f'Instrument ID [{instrument_id}] is wrong.')
Exception: Instrument ID [MRFLRO] is wrong.
Trying
Failed: 'MRFLRO'

```

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.