sentinel-hub/sentinelhub-py

[BUG] wrong key value in statistical_request example

urhprimozic opened this issue · 0 comments

Describe the bug

In Ln[16] of statistical_request.ipynb, when rescaling values back to the correct scale, i get a keyerror in line 8.

KeyError: "bands_Band(name='B01', units=(<Unit.REFLECTANCE: 'REFLECTANCE'>, <Unit.DN: 'DN'>), output_types=(<class 'numpy.float32'>, <class 'numpy.uint16'>))_mean"

The cause of error is probably in line seven: column_name = f"bands_{band}_{stat}".
It should be column_name = f"bands_{band.name}_{stat}" instead.

To Reproduce

  1. Run the jupyter notebook examples/statistical_request.ipynb

Expected behavior

KeyError in line 8.

Environment

Details of the python environment

Stack trace or screenshots

image

** Fix**
Change column_name = f"bands_{band}_{stat}" to column_name = f"bands_{band.name}_{stat}".
Desktop (please complete the following information):

  • OS: ubuntu
  • Browser: chrome