Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed attribute error when selecting substance in a model that contains pumps (#) #1045

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading