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

Incorrect error message when calibration key unknown #1252

Closed
gerritholl opened this issue Jul 7, 2020 · 1 comment
Closed

Incorrect error message when calibration key unknown #1252

gerritholl opened this issue Jul 7, 2020 · 1 comment

Comments

@gerritholl
Copy link
Collaborator

Describe the bug

Satpy gives a misleading error message when I'm trying to load a channel with a calibration (or other parameter) that is invalid.

To Reproduce

from satpy import Scene
from glob import glob
sc = Scene(filenames=glob("/data/gholl/cache/fogtools/abi/2020/04/12/01/C*/OR_ABI-L1b-RadM1-M6C*_G16_s20201030117217_e*_c*.nc"), reader="abi_l1b")
sc.load(["C08"], calibration="brightn")

Expected behavior

I would expect to be told that "brightn" is not a valid calibration. Or more generically and realistically, with #1088, I expect to be informed that there are no results for the DataQuery(name="C08", calibration="brightn"). I've also tested it with #1088. When I explicitly construct the DataQuery I get:

Traceback (most recent call last):
  File "mwe66.py", line 4, in <module>
    sc.load([DataQuery(name="C08", calibration="brightn")])
  File "/data/gholl/miniconda3/envs/py38/lib/python3.8/site-packages/satpy/scene.py", line 975, in load
    raise KeyError("Unknown datasets: {}".format(unknown_str))
KeyError: "Unknown datasets: DataQuery(name='C08', calibration='brightn')"

Perhaps #1088 should turn every index, whether by string (name), number (wavelength) or otherwise into a DataQuery. That way the KeyError would turn into the one above and the error message would be more correct.

Actual results

I'm told that dataset 'C08' is unknown, which is simply not true.

Traceback (most recent call last):
  File "mwe66.py", line 4, in <module>
    sc.load(["C08"], calibration="brightn")
  File "/data/gholl/miniconda3/envs/py38/lib/python3.8/site-packages/satpy/scene.py", line 975, in load
    raise KeyError("Unknown datasets: {}".format(unknown_str))
KeyError: 'Unknown datasets: C08'

Environment Info:

Tried with both Satpy master (0.22.1.dev14+gb909413f) as well as the latest commit on #1088 (0.21.1.dev398+gaa8c5e30).

@djhoese
Copy link
Member

djhoese commented Jul 7, 2020

Duplicate of #1220

@djhoese djhoese marked this as a duplicate of #1220 Jul 7, 2020
@djhoese djhoese closed this as completed 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