Unable to plot nanometer axis in spectral profile plot

Issue #26 new
Former user created an issue

Hi, I have been trying to plot spectral profiles from various multi and hyperspectral images with ENVI and GEOtiff file types. The band number x axis works fine but as soon as I try to plot spectra with the Nanometers axis no plot is drawn and I get the following error message :

AttributeError: 'QComboBox' object has no attribute 'timeseries' 
Traceback (most recent call last):
  File "~/.local/share/QGIS/QGIS3/profiles/default/python/plugins/rasterdataplotting/rasterdataplotting/gui/rdpprofileplotwidgetbase.py", line 133, in onCanvasClicked
    self.readAndPlotData()
  File "~/.local/share/QGIS/QGIS3/profiles/default/python/plugins/rasterdataplotting/rasterdataplotting/gui/rdpprofileplotwidgetbase.py", line 157, in readAndPlotData
    self.dataHandler.readAndPlot()
  File "~/.local/share/QGIS/QGIS3/profiles/default/python/plugins/rasterdataplotting/rasterdataplotting/gui/rdpprofileplotwidgetbase.py", line 326, in readAndPlot
    timeseries=profile.ui.axis().ui.date().timeseries())
AttributeError: 'QComboBox' object has no attribute 'timeseries'


Version de Python : 3.9.2 | packaged by conda-forge | (default, Feb 21 2021, 05:14:22) [GCC 9.3.0] 
Version de QGIS : 3.18.0-Zürich Zürich, exported 

The wavelength centers informations (with the wavelength unit) are indeed present in the HDR files and are correctly identified by QGIS (same for GEOtiff).

I tried to modify the corresponding python script to print the error-making attribute and all I can confirm is that QComboBox does have a timeseries attribute.

Finally, I have reinstalled the extension and now I do not have any errors poping, but still no plot is drawn :

I currently am on a linux mint distro with QGIS 3.18 beeing installed as a conda package in a separate conda environment (maybe it is relevant ?).

Comments (3)

  1. Adam

    A fix that works for ENVI files is remove the timeseries variable as an input to the _wavelength method in line 326 in rdpprofileplotwidgetbase.py.

    Original lines 323-326:

    xvalues = self._wavelength(layer=layer,
        modeRaster=profile.ui.axis().ui.modeRaster().isChecked(),
        modeTimeseries=profile.ui.axis().ui.modeTimeseries().isChecked(),
        timeseries=profile.ui.axis().ui.date().timeseries())
    

    change to:

    xvalues = self._wavelength(layer=layer,
        modeRaster=profile.ui.axis().ui.modeRaster().isChecked(),
        modeTimeseries=profile.ui.axis().ui.modeTimeseries().isChecked())
    

  2. Log in to comment