Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ladoramkershner opened this issue May 13, 2022 · 1 comment
Assignees

Comments

@ladoramkershner
Copy link
Contributor

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 <class 'ale.drivers.selene_drivers.KaguyaTcPds3NaifSpiceDriver'>
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 <class 'ale.drivers.viking_drivers.VikingIsisLabelIsisSpiceDriver'>

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 <class 'ale.drivers.mess_drivers.MessengerMdisIsisLabelIsisSpiceDriver'>
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 <class 'ale.drivers.selene_drivers.KaguyaTcPds3NaifSpiceDriver'>
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 <class 'ale.drivers.viking_drivers.VikingIsisLabelIsisSpiceDriver'>
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 <class 'ale.drivers.mess_drivers.MessengerMdisIsisLabelIsisSpiceDriver'>
Failed: 'MRFLRO'

@oleg-alexandrov
Copy link
Collaborator

ALE is very hairy. I just ran into similar issues and took hours and dozens of print statements to nail where the error was. I made a pull request at #455, which may help a little towards the goal of clearing things up, though there's likely a lot more to do.

@acpaquette acpaquette self-assigned this Oct 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants