TUFLOW-Support / QGIS-TUFLOW-Plugin

TUFLOW related QGIS Plugins
9 stars 7 forks source link

Plot Flux from Map Output python error. #26

Closed ZedeN1 closed 3 years ago

ZedeN1 commented 3 years ago

Keep getting these errors when trying to use Plot Flux from Map Output (v3.1.4.1)

Also I think it's not relevant, (and not a problem) but the code references non-existent C:\Program Files\JetBrains\PyCharm 2019.2\

On Linux ``` python An error has occurred while executing Python code: TypeError: 'float' object is not subscriptable Traceback (most recent call last): File "/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/tuflowqgis_tuviewer/tuflowqgis_turubberband.py", line 250, in rightClick self.createMemoryLayer() File "/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/tuflowqgis_tuviewer/tuflowqgis_turubberband.py", line 318, in createMemoryLayer worked = self.plotFromRubberBand(feat) File "/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/tuflowqgis_tuviewer/tuflowqgis_turubberband.py", line 337, in plotFromRubberBand return self.plotFunction(None, feat, bypass=bypass, lineNo=len(self.rubberBands), data_type=self.dataType) File "/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/tuflowqgis_tuviewer/tuflowqgis_tuplot2d.py", line 656, in plotFlowFromMap velMag = velDataValue[0] TypeError: 'float' object is not subscriptable Python version: 3.8.5 (default, Jul 28 2020, 12:59:40) [GCC 9.3.0] QGIS version: 3.16.1-Hannover Hannover, b381a90dca Python Path: /home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/LAStools /usr/share/qgis/python /home/pavel/.local/share/QGIS/QGIS3/profiles/default/python /home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins /usr/share/qgis/python/plugins /usr/lib/python38.zip /usr/lib/python3.8 /usr/lib/python3.8/lib-dynload /home/pavel/.local/lib/python3.8/site-packages /usr/local/lib/python3.8/dist-packages /usr/lib/python3/dist-packages /home/pavel/.local/share/QGIS/QGIS3/profiles/default/python /home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/DigitizingTools/tools /home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/DigitizingTools /home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/crayfish/gui/../pyqtgraph-0.10.0-py2.py3-none-any.whl /home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/shapetools/ext-libs /usr/lib/python3/dist-packages/IPython/extensions /home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow /home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow /home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/forms /home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow /home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow /home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/tuflowqgis_tuviewer C:\Program Files\JetBrains\PyCharm 2019.2\debug-eggs C:\Program Files\JetBrains\PyCharm 2019.2\plugins\python\helpers\pydev C:\Program Files\JetBrains\PyCharm 2019.1.3\debug-eggs C:\Program Files\JetBrains\PyCharm 2019.1.3\helpers\pydev /home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/SwapVectorDirection ```
About Linux ``` php QGIS version 3.16.1-Hannover QGIS code revision b381a90dca Compiled against Qt 5.12.8 Running against Qt 5.12.8 Compiled against GDAL/OGR 3.0.4 Running against GDAL/OGR 3.0.4 Compiled against GEOS 3.8.0-CAPI-1.13.1 Running against GEOS 3.8.0-CAPI-1.13.1 Compiled against SQLite 3.31.1 Running against SQLite 3.31.1 PostgreSQL Client Version 12.5 (Ubuntu 12.5-0ubuntu0.20.04.1) SpatiaLite Version 4.3.0a QWT Version 6.1.4 QScintilla2 Version 2.11.2 Compiled against PROJ 6.3.1 Running against PROJ Rel. 6.3.0, January 1st, 2020 OS Version Ubuntu 20.04.1 LTS Active python plugins DigitizingTools; crayfish; QuickOSM; shapetools; quick_map_services; processing_r; StreetView; BufferByPercentage; SplitPolygonShowingAreas; GeodesicDensifier; LAStools; profiletool; LocatePoints; DataPlotly; valuetool; tuflow; SwapVectorDirection; processing; db_manager; MetaSearch ```
On Windows: ``` python An error has occurred while executing Python code: TypeError: 'float' object is not subscriptable Traceback (most recent call last): File "C:/Users/Pavel/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\tuflow\tuflowqgis_tuviewer\tuflowqgis_turubberband.py", line 250, in rightClick self.createMemoryLayer() File "C:/Users/Pavel/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\tuflow\tuflowqgis_tuviewer\tuflowqgis_turubberband.py", line 318, in createMemoryLayer worked = self.plotFromRubberBand(feat) File "C:/Users/Pavel/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\tuflow\tuflowqgis_tuviewer\tuflowqgis_turubberband.py", line 337, in plotFromRubberBand return self.plotFunction(None, feat, bypass=bypass, lineNo=len(self.rubberBands), data_type=self.dataType) File "C:/Users/Pavel/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\tuflow\tuflowqgis_tuviewer\tuflowqgis_tuplot2d.py", line 656, in plotFlowFromMap velMag = velDataValue[0] TypeError: 'float' object is not subscriptable Python version: 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] QGIS version: 3.16.1-Hannover Hannover, b381a90dca Python Path: C:/OSGEO4~1/apps/qgis/./python C:/Users/Pavel/AppData/Roaming/QGIS/QGIS3\profiles\default/python C:/Users/Pavel/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins C:/OSGEO4~1/apps/qgis/./python/plugins C:\OSGEO4~1\apps\Python37 C:\OSGEO4~1\apps\Python37\Scripts C:\OSGeo4W64\bin\python37.zip C:\OSGEO4~1\apps\Python37\DLLs C:\OSGEO4~1\apps\Python37\lib C:\OSGeo4W64\bin C:\OSGEO4~1\apps\Python37\lib\site-packages C:\OSGEO4~1\apps\Python37\lib\site-packages\win32 C:\OSGEO4~1\apps\Python37\lib\site-packages\win32\lib C:\OSGEO4~1\apps\Python37\lib\site-packages\Pythonwin C:/Users/Pavel/AppData/Roaming/QGIS/QGIS3\profiles\default/python C:\Users\Pavel\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\DigitizingTools\tools C:\Users\Pavel\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\DigitizingTools C:/Users/Pavel/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgis_resource_sharing C:\Users\Pavel\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\qgis_resource_sharing C:\Users\Pavel\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\qgis_resource_sharing\ext_libs C:/Users/Pavel/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\SwapVectorDirection C:/Users/Pavel/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\tuflow C:\Users\Pavel\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\tuflow C:\Users\Pavel\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\tuflow/forms C:\Users\Pavel\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\tuflow C:\Users\Pavel\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\tuflow C:\Users\Pavel\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\tuflow\tuflowqgis_tuviewer C:\Program Files\JetBrains\PyCharm 2019.2\debug-eggs C:\Program Files\JetBrains\PyCharm 2019.2\plugins\python\helpers\pydev C:\Program Files\JetBrains\PyCharm 2019.1.3\debug-eggs C:\Program Files\JetBrains\PyCharm 2019.1.3\helpers\pydev . ```
About Win10 ``` php QGIS version 3.16.1-Hannover QGIS code revision b381a90dca Compiled against Qt 5.11.2 Running against Qt 5.11.2 Compiled against GDAL/OGR 3.1.4 Running against GDAL/OGR 3.1.4 Compiled against GEOS 3.8.1-CAPI-1.13.3 Running against GEOS 3.8.1-CAPI-1.13.3 Compiled against SQLite 3.29.0 Running against SQLite 3.29.0 PostgreSQL Client Version 11.5 SpatiaLite Version 4.3.0 QWT Version 6.1.3 QScintilla2 Version 2.10.8 Compiled against PROJ 6.3.2 Running against PROJ Rel. 6.3.2, May 1st, 2020 OS Version Windows 10 (10.0) Active python plugins Coordtransform; DigitizingTools; GlobeBuilder; ImportPhotos; LocatePoints; nominatim; pluginbuilder3; processing_r; profiletool; qgis_resource_sharing; QPackage; QuickOSM; quick_map_services; SwapVectorDirection; tuflow; valuetool; VectorBender; MetaSearch; processing ```
TUFLOW-Support commented 3 years ago

Thanks for letting us know. Can you try with the latest commit (v3.1.4.5) to see if the error is still occurring?

ZedeN1 commented 3 years ago

Seems to work now, thank you! Tested on Linux only.

On a probably unrelated issue, I get the following error when opening an existing project. Error happened it v3.1.4.1 as-well (just checked) but I just didn't notice/ignored it before. As far as I can tell it has no impact on the use of the plugin.

On Linux with 3.1.4.5 ``` python An error has occurred while executing Python code: IndexError: list index out of range Traceback (most recent call last): File "/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/__init__.py", line 81, in conn = QgsProject.instance().readProject.connect(lambda event: openTuview(event, menu)) File "/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/__init__.py", line 65, in openTuview tuflowqgis.resultsPlottingDock.loadProject() File "/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/tuflowqgis_tuviewer/tuflowqgis_tuview.py", line 376, in loadProject self.tuProject.load() File "/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/tuflowqgis_tuviewer/tuflowqgis_tuproject.py", line 84, in load self.processResults2d('load') File "/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/tuflowqgis_tuviewer/tuflowqgis_tuproject.py", line 166, in processResults2d self.hastp = {x.split(':')[0]: True if x.split(':')[1] == 'True' else False for x in results} File "/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/tuflowqgis_tuviewer/tuflowqgis_tuproject.py", line 166, in self.hastp = {x.split(':')[0]: True if x.split(':')[1] == 'True' else False for x in results} IndexError: list index out of range Python version: 3.8.5 (default, Jul 28 2020, 12:59:40) [GCC 9.3.0] QGIS version: 3.16.1-Hannover Hannover, b381a90dca Python Path: /home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/LAStools /usr/share/qgis/python /home/pavel/.local/share/QGIS/QGIS3/profiles/default/python /home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins /usr/share/qgis/python/plugins /usr/lib/python38.zip /usr/lib/python3.8 /usr/lib/python3.8/lib-dynload /home/pavel/.local/lib/python3.8/site-packages /usr/local/lib/python3.8/dist-packages /usr/lib/python3/dist-packages /home/pavel/.local/share/QGIS/QGIS3/profiles/default/python /home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/DigitizingTools/tools /home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/DigitizingTools /home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/crayfish/gui/../pyqtgraph-0.10.0-py2.py3-none-any.whl /home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/shapetools/ext-libs /usr/lib/python3/dist-packages/IPython/extensions /home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow /home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow /home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/forms /home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow /home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow /home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/tuflowqgis_tuviewer C:\Program Files\JetBrains\PyCharm 2019.2\debug-eggs C:\Program Files\JetBrains\PyCharm 2019.2\plugins\python\helpers\pydev C:\Program Files\JetBrains\PyCharm 2019.1.3\debug-eggs C:\Program Files\JetBrains\PyCharm 2019.1.3\helpers\pydev /home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/SwapVectorDirection /net/M/WalsdenWater_EVY0894/Workspaces ```
TUFLOW-Support commented 3 years ago

Try with the latest commit (3.1.4.10) - hopefully this removes the python error. There are a few other settings that are loaded after this one, although they are mainly for convenience so probably why the current error isn't causing you much grief.

ZedeN1 commented 3 years ago

I can confirm flux works perfectly on v3.1.7.