Warnings in Spectral Viewer

Issue #932 closed
Agustin Lobo created an issue

Using enmapboxplugin.3.10.20220119T091443.develop

As soon as I move the color bars, I get:

2022-01-20T09:09:52 WARNING warning:/home/alobo/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/externals/qps/speclib/gui/spectrallibraryplotwidget.py:3668: DeprecationWarning:

         an integer is required (got type float). Implicit conversion to integers using __int__ is deprecated, and may be removed in a future version of Python.


         traceback: File "/home/alobo/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/externals/qps/speclib/gui/spectrallibraryplotwidget.py", line 3583, in onRendererLayerChanged
          mBand.setBand(bandNo)
          File "/home/alobo/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/externals/qps/speclib/gui/spectrallibraryplotwidget.py", line 3668, in onRendererBandChanged
          vmin, vmax = layer.dataProvider().cumulativeCut(
          File "/usr/lib/python3.9/warnings.py", line 109, in _showwarnmsg
          sw(msg.message, msg.category, msg.filename, msg.lineno,

2022-01-20T09:10:42 WARNING warning:/home/alobo/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/externals/qps/speclib/gui/spectrallibraryplotwidget.py:3668: DeprecationWarning:

         an integer is required (got type float). Implicit conversion to integers using __int__ is deprecated, and may be removed in a future version of Python.


         traceback: File "/home/alobo/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/externals/qps/externals/pyqtgraph/widgets/GraphicsView.py", line 350, in mouseReleaseEvent
          super().mouseReleaseEvent(ev)
          File "/home/alobo/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/externals/qps/externals/pyqtgraph/GraphicsScene/GraphicsScene.py", line 233, in mouseReleaseEvent
          if self.sendDragEvent(ev, final=True):
          File "/home/alobo/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/externals/qps/externals/pyqtgraph/GraphicsScene/GraphicsScene.py", line 353, in sendDragEvent
          self.dragItem.mouseDragEvent(event)
          File "/home/alobo/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/externals/qps/externals/pyqtgraph/graphicsItems/InfiniteLine.py", line 403, in mouseDragEvent
          self.sigPositionChangeFinished.emit(self)
          File "/home/alobo/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/externals/qps/speclib/gui/spectrallibraryplotwidget.py", line 3620, in onRendererBarChanged
          self.mRendererRedBand.setBand(bandNo)
          File "/home/alobo/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/externals/qps/speclib/gui/spectrallibraryplotwidget.py", line 3668, in onRendererBandChanged
          vmin, vmax = layer.dataProvider().cumulativeCut(
          File "/usr/lib/python3.9/warnings.py", line 109, in _showwarnmsg
          sw(msg.message, msg.category, msg.filename, msg.lineno,

2022-01-20T09:14:02 WARNING warning:/home/alobo/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/externals/qps/speclib/gui/spectrallibraryplotwidget.py:3707: DeprecationWarning:

         an integer is required (got type float). Implicit conversion to integers using __int__ is deprecated, and may be removed in a future version of Python.


         traceback: File "/home/alobo/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/externals/qps/externals/pyqtgraph/widgets/GraphicsView.py", line 350, in mouseReleaseEvent
          super().mouseReleaseEvent(ev)
          File "/home/alobo/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/externals/qps/externals/pyqtgraph/GraphicsScene/GraphicsScene.py", line 233, in mouseReleaseEvent
          if self.sendDragEvent(ev, final=True):
          File "/home/alobo/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/externals/qps/externals/pyqtgraph/GraphicsScene/GraphicsScene.py", line 353, in sendDragEvent
          self.dragItem.mouseDragEvent(event)
          File "/home/alobo/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/externals/qps/externals/pyqtgraph/graphicsItems/InfiniteLine.py", line 403, in mouseDragEvent
          self.sigPositionChangeFinished.emit(self)
          File "/home/alobo/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/externals/qps/speclib/gui/spectrallibraryplotwidget.py", line 3624, in onRendererBarChanged
          self.mRendererBlueBand.setBand(bandNo)
          File "/home/alobo/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/externals/qps/speclib/gui/spectrallibraryplotwidget.py", line 3707, in onRendererBandChanged
          vmin, vmax = layer.dataProvider().cumulativeCut(
          File "/usr/lib/python3.9/warnings.py", line 109, in _showwarnmsg
          sw(msg.message, msg.category, msg.filename, msg.lineno,

Comments (12)

  1. Andreas Janz

    I didn’t get those warnings on my Windows system.

    Would be helpful, if you could manually edit the code. Replace the bandNo with an int(bandNo):

    Does that work?

  2. Agustin Lobo reporter

    I get:

    2022-01-20T10:37:04     WARNING    warning:/home/alobo/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/externals/qps/speclib/gui/spectrallibraryplotwidget.py:3668: DeprecationWarning:

                 an integer is required (got type float). Implicit conversion to integers using __int__ is deprecated, and may be removed in a future version of Python.


                 traceback: File "/home/alobo/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/externals/qps/speclib/gui/spectrallibraryplotwidget.py", line 3583, in onRendererLayerChanged
                  mBand.setBand(bandNo)
                  File "/home/alobo/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/externals/qps/speclib/gui/spectrallibraryplotwidget.py", line 3668, in onRendererBandChanged
                  vmin, vmax = layer.dataProvider().cumulativeCut(
                  File "/usr/lib/python3.9/warnings.py", line 109, in _showwarnmsg
                  sw(msg.message, msg.category, msg.filename, msg.lineno,

  3. Andreas Janz

    So nothing changed, right?
    Please try to also cast the sampleSize: int(QgsRasterLayer.SAMPLE_SIZE)

  4. Agustin Lobo reporter

    Another one. This one might be related to the image displaying not being updated when moving the color bars:

    2022-01-21T14:44:14 WARNING warning:/home/alobo/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/externals/qps/externals/pyqtgraph/graphicsItems/ViewBox/ViewBoxMenu.py:120: DeprecationWarning:

             an integer is required (got type float). Implicit conversion to integers using __int__ is deprecated, and may be removed in a future version of Python.
    
    
             traceback: File "/home/alobo/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/externals/qps/externals/pyqtgraph/widgets/GraphicsView.py", line 144, in paintEvent
              return super().paintEvent(ev)
              File "/home/alobo/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/externals/qps/externals/pyqtgraph/graphicsItems/ViewBox/ViewBox.py", line 1611, in paint
              self.prepareForPaint()
              File "/home/alobo/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/externals/qps/externals/pyqtgraph/graphicsItems/ViewBox/ViewBox.py", line 301, in prepareForPaint
              self.updateAutoRange()
              File "/home/alobo/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/externals/qps/externals/pyqtgraph/graphicsItems/ViewBox/ViewBox.py", line 927, in updateAutoRange
              self.setRange(**args)
              File "/home/alobo/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/externals/qps/externals/pyqtgraph/graphicsItems/ViewBox/ViewBox.py", line 631, in setRange
              self.sigStateChanged.emit(self)
              File "/home/alobo/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/externals/qps/externals/pyqtgraph/graphicsItems/ViewBox/ViewBoxMenu.py", line 102, in viewStateChanged
              self.updateState()
              File "/home/alobo/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/externals/qps/externals/pyqtgraph/graphicsItems/ViewBox/ViewBoxMenu.py", line 120, in updateState
              self.ctrl[i].autoPercentSpin.setValue(state['autoRange'][i]*100)
              File "/usr/lib/python3.9/warnings.py", line 109, in _showwarnmsg
              sw(msg.message, msg.category, msg.filename, msg.lineno,
    

  5. Agustin Lobo reporter

    I can’t remember how to get the 3 bars to define the raster composite from the spectrum…

  6. Log in to comment