nens / threedigrid

grid administration for 3Di models
Other
9 stars 0 forks source link

Time series plotter: Attribute error when selecting substance in model that contains pumps TOPDESK 2406 0082 #233

Open leendertvanwolfswinkel opened 1 week ago

leendertvanwolfswinkel commented 1 week ago

How to reproduce:

At first glance, to me this looks as an inconsistency in threedigrid (Lines and Nodes having a Meta property but Pumps not?), that would better be fixed there rather than in 3Di Results Analysis. But I may be wrong.


AttributeError: 'Pumps' object has no attribute 'Meta' 
Traceback (most recent call last):
  File "C:\Users\leendert.vanwolfswin\AppData\Roaming\3Di\QGIS3\profiles\default/python/plugins\threedi_results_analysis\tool_graph\graph_view.py", line 582, in parameter_change
    self.graph_plot.set_parameter(self.current_parameter, time_units)
  File "C:\Users\leendert.vanwolfswin\AppData\Roaming\3Di\QGIS3\profiles\default/python/plugins\threedi_results_analysis\tool_graph\graph_view.py", line 246, in set_parameter
    item.plots(self.current_parameter["parameters"], time_units=self.current_time_units, absolute=self.absolute)
  File "C:\Users\leendert.vanwolfswin\AppData\Roaming\3Di\QGIS3\profiles\default/python/plugins\threedi_results_analysis\tool_graph\graph_model.py", line 122, in plots
    ts_table = self.timeseries_table(
  File "C:\Users\leendert.vanwolfswin\AppData\Roaming\3Di\QGIS3\profiles\default/python/plugins\threedi_results_analysis\tool_graph\graph_model.py", line 152, in timeseries_table
    pump_fields = set(list(ga.pumps.Meta.composite_fields.keys()))
  File "C:\Users\leendert.vanwolfswin\AppData\Roaming\3Di\QGIS3\profiles\default\python\plugins\threedi_results_analysis\deps\threedigrid\orm\base\models.py", line 194, in __getattribute__
    attr = super().__getattribute__(attr_name)
AttributeError: 'Pumps' object has no attribute 'Meta'
``
leendertvanwolfswinkel commented 1 week ago

@hoanphungt can you confirm that this issue should be solved in threedigrid?

hoanphungt commented 1 week ago

@leendertvanwolfswinkel I just looked at the code in the ThreediToolBox and the threedigrid. It's indeed an issue that should be solved in the threedigrid.

The error comes from this line: https://github.com/nens/ThreeDiToolbox/blob/refactor/tool_graph/graph_model.py#L152

It refers to the gridadmin file of the threedi result. The Pumps model is defined in the threedigrid and it doesn't contain a Meta property.