teksi / wastewater

[DEV] Future TEKSI wastewater module, adapted data model to fit VSA-DSS 2020 new standard
https://teksi.github.io/wastewater
GNU General Public License v3.0
2 stars 5 forks source link

Network following crashing when levels are missing #476

Open sjib opened 4 hours ago

sjib commented 4 hours ago

Describe the bug A clear and concise description of what the bug is.

When selecting network following upstream on node V1.102 a python error appears and cursors keep turning (blue circle). Difficult to work on.

To Reproduce Exact steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

No half crash if using network following function

Screenshots / data If applicable, add screenshots or data to help explain your problem. grafik

2024-10-28T11:59:34     WARNING    Traceback (most recent call last):
              File "C:\Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\tww_pre_202403/python/plugins\teksi_wastewater\tools\twwmaptools.py", line 145, in canvasReleaseEvent
              self.leftClicked(event)
              File "C:\Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\tww_pre_202403/python/plugins\teksi_wastewater\tools\twwmaptools.py", line 559, in leftClicked
              self.getTree(match.featureId())
              File "C:\Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\tww_pre_202403/python/plugins\teksi_wastewater\tools\twwmaptools.py", line 508, in getTree
              nodes, edges = self.network_analyzer.getTree(node_id, upstream)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
              File "C:\Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\tww_pre_202403/python/plugins\teksi_wastewater\tools\twwnetwork.py", line 298, in getTree
              pred, _ = nx.bellman_ford_predecessor_and_distance(my_graph, node)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
              File "C:\PROGRA~1\QGIS 3.34.8\apps\Python312\Lib\site-packages\networkx\utils\decorators.py", line 789, in func
              return argmap._lazy_compile(__wrapper)(*args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
              File " compilation 4", line 3, in argmap_bellman_ford_predecessor_and_distance_1
              import gzip
              ^^^^
              File "C:\PROGRA~1\QGIS 3.34.8\apps\Python312\Lib\site-packages\networkx\utils\backends.py", line 633, in __call__
              return self.orig_func(*args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
              File "C:\PROGRA~1\QGIS 3.34.8\apps\Python312\Lib\site-packages\networkx\algorithms\shortest_paths\weighted.py", line 1246, in bellman_ford_predecessor_and_distance
              raise nx.NodeNotFound(f"Node {source} is not found in the graph")
             networkx.exception.NodeNotFound: Node 82 is not found in the graph

2024-10-28T12:00:43     WARNING    Traceback (most recent call last):
              File "C:\Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\tww_pre_202403/python/plugins\teksi_wastewater\tools\twwmaptools.py", line 145, in canvasReleaseEvent
              self.leftClicked(event)
              File "C:\Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\tww_pre_202403/python/plugins\teksi_wastewater\tools\twwmaptools.py", line 559, in leftClicked
              self.getTree(match.featureId())
              File "C:\Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\tww_pre_202403/python/plugins\teksi_wastewater\tools\twwmaptools.py", line 508, in getTree
              nodes, edges = self.network_analyzer.getTree(node_id, upstream)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
              File "C:\Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\tww_pre_202403/python/plugins\teksi_wastewater\tools\twwnetwork.py", line 298, in getTree
              pred, _ = nx.bellman_ford_predecessor_and_distance(my_graph, node)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
              File " compilation 4", line 3, in argmap_bellman_ford_predecessor_and_distance_1
              import gzip
              ^^^^
              File "C:\PROGRA~1\QGIS 3.34.8\apps\Python312\Lib\site-packages\networkx\utils\backends.py", line 633, in __call__
              return self.orig_func(*args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
              File "C:\PROGRA~1\QGIS 3.34.8\apps\Python312\Lib\site-packages\networkx\algorithms\shortest_paths\weighted.py", line 1246, in bellman_ford_predecessor_and_distance
              raise nx.NodeNotFound(f"Node {source} is not found in the graph")
             networkx.exception.NodeNotFound: Node 82 is not found in the graph

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

Looks like levels (cote attributes) are missing in this part of (secondary) network

sjib commented 4 hours ago

No reach_point levels grafik

sjib commented 4 hours ago

No cover level grafik

sjib commented 4 hours ago

Bottom level exists: grafik