mirror of https://gitlab.com/pamhyr/pamhyr2
BC, Geometry: Add safety condition to value computation.
parent
1c89b7fb1b
commit
e842fef434
|
|
@ -368,6 +368,9 @@ class Reach(SQLSubModel):
|
|||
|
||||
def inter_profiles_rk(self):
|
||||
profiles = sorted(self.profiles, key=lambda p: p.rk)
|
||||
if len(profiles) == 0:
|
||||
return []
|
||||
|
||||
first = profiles[0]
|
||||
last = profiles[-1]
|
||||
|
||||
|
|
@ -750,6 +753,9 @@ class Reach(SQLSubModel):
|
|||
cnt += 1
|
||||
|
||||
def get_incline(self):
|
||||
if len(self.profiles) == 0:
|
||||
return 0.0
|
||||
|
||||
first = self.profile(0)
|
||||
last = self.profile(len(self) - 1)
|
||||
|
||||
|
|
@ -767,6 +773,9 @@ class Reach(SQLSubModel):
|
|||
|
||||
def get_incline_mean(self):
|
||||
profiles = self.profiles
|
||||
if len(profiles) == 0:
|
||||
return 0.0
|
||||
|
||||
previous = profiles[0]
|
||||
|
||||
incline_acc = 0
|
||||
|
|
@ -790,6 +799,9 @@ class Reach(SQLSubModel):
|
|||
|
||||
def get_incline_median(self):
|
||||
profiles = self.profiles
|
||||
if len(profiles) == 0:
|
||||
return 0.0
|
||||
|
||||
previous = profiles[0]
|
||||
|
||||
incline_acc = []
|
||||
|
|
@ -814,6 +826,9 @@ class Reach(SQLSubModel):
|
|||
|
||||
def get_incline_median_mean(self):
|
||||
profiles = self.profiles
|
||||
if len(profiles) == 0:
|
||||
return 0.0
|
||||
|
||||
previous = profiles[0]
|
||||
|
||||
incline_acc = []
|
||||
|
|
|
|||
|
|
@ -347,6 +347,13 @@ class EditBoundaryConditionWindow(PamhyrWindow):
|
|||
if node is None:
|
||||
return
|
||||
reach = self._data.reach(self._study.river)[0]
|
||||
if len(reach.profiles) == 0:
|
||||
self.message_box(
|
||||
text=self._trad["title_need_geometry"],
|
||||
informative_text=self._trad["msg_need_geometry"]
|
||||
)
|
||||
return
|
||||
|
||||
profile = reach.profiles[-1]
|
||||
dlg = GenerateDialog(self.slope_value,
|
||||
reach,
|
||||
|
|
@ -379,6 +386,13 @@ class EditBoundaryConditionWindow(PamhyrWindow):
|
|||
if node is None:
|
||||
return
|
||||
reach = self._data.reach(self._study.river)[0]
|
||||
if len(reach.profiles) == 0:
|
||||
self.message_box(
|
||||
text=self._trad["title_need_geometry"],
|
||||
informative_text=self._trad["msg_need_geometry"]
|
||||
)
|
||||
return
|
||||
|
||||
profile = reach.profiles[-1]
|
||||
z_min = profile.z_min()
|
||||
z_max = profile.z_max()
|
||||
|
|
|
|||
|
|
@ -44,3 +44,12 @@ class BCETranslate(BCTranslate):
|
|||
"z": self._dict["unit_elevation"],
|
||||
"solid": _translate("BoundaryCondition", "Solid (kg/s)"),
|
||||
}
|
||||
|
||||
self._dict["title_need_geometry"] = _translate(
|
||||
"Geometry", "No geometry"
|
||||
)
|
||||
self._dict["msg_need_geometry"] = _translate(
|
||||
"Geometry",
|
||||
"There is not geometry found for this reach, "
|
||||
"a geometry is needed to this features"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ class WindowToolKit(object):
|
|||
Returns:
|
||||
Nothing
|
||||
"""
|
||||
msg = QMessageBox()
|
||||
msg = QMessageBox(parent=self)
|
||||
|
||||
msg.setIcon(QMessageBox.Warning)
|
||||
msg.setText(text)
|
||||
|
|
|
|||
Loading…
Reference in New Issue