Skip to content

Commit

Permalink
Merge pull request #1045 from nens/ben-pump_substance_attribute_error
Browse files Browse the repository at this point in the history
Fixed attribute error when selecting substance in a model that contains pumps (#)
  • Loading branch information
benvanbasten-ns authored Sep 12, 2024
2 parents 8e080c9 + 5ff7682 commit 1041086
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- Watershed tool: 2D flowlines intersecting obstacles are no longer shown as 1D flowlines (#1034)
- Model selection dialog: fixed order bug when sorting.
- Bump threedi-mi-utils to 0.1.4
- Fixed attribute error when selecting substance in a model that contains pumps (#1044)


3.9.3 (2024-08-14)
Expand Down
18 changes: 13 additions & 5 deletions tool_graph/graph_model.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
from collections import OrderedDict
from qgis.PyQt.QtCore import Qt
from qgis.PyQt.QtGui import QColor
from random import randint
from threedi_results_analysis.models.base import BaseModel
from threedi_results_analysis.models.base_fields import CheckboxField, CHECKBOX_FIELD
from threedi_results_analysis.models.base_fields import CHECKBOX_FIELD
from threedi_results_analysis.models.base_fields import CheckboxField
from threedi_results_analysis.models.base_fields import ValueField
from threedi_results_analysis.utils.color import COLOR_LIST

import logging
import numpy as np
import pyqtgraph as pg
from qgis.PyQt.QtCore import Qt
from qgis.PyQt.QtGui import QColor
from threedi_results_analysis.utils.color import COLOR_LIST


logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -149,7 +151,13 @@ def timeseries_table(self, parameters, absolute, time_units):

ga = threedi_result.get_gridadmin(parameters)
if ga.has_pumpstations:
pump_fields = set(list(ga.pumps.Meta.composite_fields.keys()))
# In some gridadmin types pumps do not have a Meta attribute... In
# such cases (e.g. water quality) the attribute does not have a meaning and
# the timeserie should be empty.
try:
pump_fields = set(list(ga.pumps.Meta.composite_fields.keys()))
except AttributeError:
pump_fields = {}
else:
pump_fields = {}
if self.object_type.value == "pump_linestring" and parameters not in pump_fields:
Expand Down

0 comments on commit 1041086

Please sign in to comment.