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

Readers give incorrect error message for unknown calibration #1220

Open
simonrp84 opened this issue May 27, 2020 · 2 comments
Open

Readers give incorrect error message for unknown calibration #1220

simonrp84 opened this issue May 27, 2020 · 2 comments

Comments

@simonrp84
Copy link
Member

Describe the bug
If a user selects an incorrect calibration type for the abi_l1b reader then the error message they receive is incorrect.

To Reproduce

from satpy import Scene
from glob import glob

files = glob('*.nc')
scn = Scene(files, reader='abi_l1b')
scn.load(['C04'], calibration='counts')

Expected behavior
An error message is produced that says: Unknown calibration counts.
This is defined here.

Actual results
The following error message is given:

KeyError                                  Traceback (most recent call last)
<ipython-input-12-34ce17a0197c> in <module>
      1 print(scn.available_dataset_names())
----> 2 scn.load(['C04'], calibration='counts')

/network/aopp/apres/users/proud/satpyconda/lib/python3.7/site-packages/satpy/scene.py in load(self, wishlist, calibration, resolution, polarization, level, generate, unload, **kwargs)
    997         if unknown:
    998             unknown_str = ", ".join(map(str, unknown))
--> 999             raise KeyError("Unknown datasets: {}".format(unknown_str))
   1000 
   1001         self.read(**kwargs)

KeyError: 'Unknown datasets: C04'

Environment Info:

  • OS: Ubuntu 18.04
  • Satpy Version: 0.21.0

Additional context
Running with an accepted calibration type (such as calibration='radiance') works successfully.

@djhoese
Copy link
Member

djhoese commented May 27, 2020

This is likely not specific to ABI. I think the Unknown datasets message is only using what you've provided for the names ['C04']. So the message isn't necessarily wrong since counts is a calibration that Satpy knows about but C04 doesn't have that calibration: the C04 dataset, as requested, is unknown.

We could make the error message longer and include any of the other parameters that were provided (calibration, polarization, etc). That may have to change depending on how @mraspaud's dynamic DatasetIDs work.

@simonrp84
Copy link
Member Author

Yes, I suspected it might be a bit more broad than just ABI. Would be nice to have it fixed, though, so that the user gets a more accurate error message.
Or, on the other hand, delete the code in the ABI reader and improve coverage ;)

@djhoese djhoese changed the title ABI L1b reader gives incorrect error message for unknown calibration Readers give incorrect error message for unknown calibration Jul 7, 2020
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

2 participants