TUFLOW-Support / QGIS-TUFLOW-Plugin

TUFLOW related QGIS Plugins
9 stars 7 forks source link

Problem loading some results #19

Closed ZedeN1 closed 4 years ago

ZedeN1 commented 4 years ago

On Linux:

An error has occurred while executing Python code: 

AttributeError: 'ChanInfo' object has no attribute 'nChan' 
Traceback (most recent call last):
  File "/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/tuflowqgis_tuviewer/tuflowqgis_tumenufunctions.py", line 142, in load1dResults
    self.tuView.tuResults.importResults('timeseries', inFileNames[0])
  File "/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/tuflowqgis_tuviewer/tuflowqgis_turesults.py", line 60, in importResults
    result = self.tuResults1D.importResults(inFileNames)
  File "/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/tuflowqgis_tuviewer/tuflowqgis_turesults1d.py", line 59, in importResults
    error, message = res.Load(filePath)
  File "/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/TUFLOW_results.py", line 1589, in Load
    if self.Data_1D.nChan != self.Channels.nChan:
AttributeError: 'ChanInfo' object has no attribute 'nChan'

On Windows:

ValueError: could not convert string to float: '********' 
Traceback (most recent call last):
  File "C:/Users/edenvale/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\tuflow\tuflowqgis_tuviewer\tuflowqgis_tumenufunctions.py", line 141, in load1dResults
    self.tuView.tuResults.importResults('timeseries', inFileNames[0])
  File "C:\Users\edenvale\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\tuflow\tuflowqgis_tuviewer\tuflowqgis_turesults.py", line 60, in importResults
    result = self.tuResults1D.importResults(inFileNames)
  File "C:\Users\edenvale\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\tuflow\tuflowqgis_tuviewer\tuflowqgis_turesults1d.py", line 59, in importResults
    error, message = res.Load(filePath)
  File "C:/Users/edenvale/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\tuflow\TUFLOW_results.py", line 1536, in Load
    self.Channels = ChanInfo(fullpath)
  File "C:/Users/edenvale/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\tuflow\TUFLOW_results.py", line 658, in __init__
    self.chan_n.append(float(row[9]))
ValueError: could not convert string to float: '********'

Getting this error for some result files and not others. ZIP and individual files are available on Google Drive

TUFLOW-Support commented 4 years ago

Hey, it looks like it's failing because of the n value in the 1d_chan.csv which is being written as ** image

I've updated so it will skip these instances and use a dummy value of zero where it can. If the attribute is more critical (e.g. channel inverts) then it will catch the error and let the user know: image

ZedeN1 commented 4 years ago

Thanks, it fixed the issue :)

I haven't managed to get the error when viewing the results though.

TUFLOW-Support commented 4 years ago

Great! The error message should only be triggered if it can't read in something more important like the channel inverts. In your case it can't read in the n value which is probably not critical, so it just uses a dummy value of zero and continues. The above example error message was not from what you provided - I inserted some spurious values just to test it.