pytroll/pyspectral

Bug plotting spectral responses with MODIS

adybbroe opened this issue · 0 comments

Code Sample, a minimal, complete, and verifiable piece of code

# Your code here
python bin/composite_rsr_plot.py --platform_name Sentinel-3B EOS-Terra --sensor olci modis -r 0.4 0.8

Problem description

This gives an error, see below. If I remove the OLCI it works fine, and I can add Meteosat FCI and SNPP VIIRS together with modis, but when adding OLCI it fails like below. Strange!

[this should also explain why the current behaviour is a problem and why the
expected output is a better solution.]

Expected Output

A plot file in png should be generated. Here with only olci:
rsr_band_0040_0080

Actual Result, Traceback if applicable

Traceback (most recent call last):
  File "/home/a000680/usr/src/forks/pyspectral/pyspectral/rsr_reader.py", line 64, in __getitem__
    val = dict.__getitem__(self, key)
KeyError: 'ch8'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/a000680/usr/src/forks/pyspectral/bin/composite_rsr_plot.py", line 200, in <module>
    plt = plot_band(plt, b__, rsr,
  File "/home/a000680/usr/src/forks/pyspectral/bin/composite_rsr_plot.py", line 41, in plot_band
    detectors = rsr_obj.rsr[band_name].keys()
  File "/home/a000680/usr/src/forks/pyspectral/pyspectral/rsr_reader.py", line 71, in __getitem__
    raise KeyError(f'Band not found in RSR for {self.instrument}: {key}')
KeyError: 'Band not found in RSR for modis: ch8'

Versions of Python, package at hand and relevant dependencies

Python 3.10 and Pyspectral v0.12.2

Thank you for reporting an issue !