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):
|
def inter_profiles_rk(self):
|
||||||
profiles = sorted(self.profiles, key=lambda p: p.rk)
|
profiles = sorted(self.profiles, key=lambda p: p.rk)
|
||||||
|
if len(profiles) == 0:
|
||||||
|
return []
|
||||||
|
|
||||||
first = profiles[0]
|
first = profiles[0]
|
||||||
last = profiles[-1]
|
last = profiles[-1]
|
||||||
|
|
||||||
|
|
@ -750,6 +753,9 @@ class Reach(SQLSubModel):
|
||||||
cnt += 1
|
cnt += 1
|
||||||
|
|
||||||
def get_incline(self):
|
def get_incline(self):
|
||||||
|
if len(self.profiles) == 0:
|
||||||
|
return 0.0
|
||||||
|
|
||||||
first = self.profile(0)
|
first = self.profile(0)
|
||||||
last = self.profile(len(self) - 1)
|
last = self.profile(len(self) - 1)
|
||||||
|
|
||||||
|
|
@ -767,6 +773,9 @@ class Reach(SQLSubModel):
|
||||||
|
|
||||||
def get_incline_mean(self):
|
def get_incline_mean(self):
|
||||||
profiles = self.profiles
|
profiles = self.profiles
|
||||||
|
if len(profiles) == 0:
|
||||||
|
return 0.0
|
||||||
|
|
||||||
previous = profiles[0]
|
previous = profiles[0]
|
||||||
|
|
||||||
incline_acc = 0
|
incline_acc = 0
|
||||||
|
|
@ -790,6 +799,9 @@ class Reach(SQLSubModel):
|
||||||
|
|
||||||
def get_incline_median(self):
|
def get_incline_median(self):
|
||||||
profiles = self.profiles
|
profiles = self.profiles
|
||||||
|
if len(profiles) == 0:
|
||||||
|
return 0.0
|
||||||
|
|
||||||
previous = profiles[0]
|
previous = profiles[0]
|
||||||
|
|
||||||
incline_acc = []
|
incline_acc = []
|
||||||
|
|
@ -814,6 +826,9 @@ class Reach(SQLSubModel):
|
||||||
|
|
||||||
def get_incline_median_mean(self):
|
def get_incline_median_mean(self):
|
||||||
profiles = self.profiles
|
profiles = self.profiles
|
||||||
|
if len(profiles) == 0:
|
||||||
|
return 0.0
|
||||||
|
|
||||||
previous = profiles[0]
|
previous = profiles[0]
|
||||||
|
|
||||||
incline_acc = []
|
incline_acc = []
|
||||||
|
|
|
||||||
|
|
@ -347,6 +347,13 @@ class EditBoundaryConditionWindow(PamhyrWindow):
|
||||||
if node is None:
|
if node is None:
|
||||||
return
|
return
|
||||||
reach = self._data.reach(self._study.river)[0]
|
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]
|
profile = reach.profiles[-1]
|
||||||
dlg = GenerateDialog(self.slope_value,
|
dlg = GenerateDialog(self.slope_value,
|
||||||
reach,
|
reach,
|
||||||
|
|
@ -379,6 +386,13 @@ class EditBoundaryConditionWindow(PamhyrWindow):
|
||||||
if node is None:
|
if node is None:
|
||||||
return
|
return
|
||||||
reach = self._data.reach(self._study.river)[0]
|
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]
|
profile = reach.profiles[-1]
|
||||||
z_min = profile.z_min()
|
z_min = profile.z_min()
|
||||||
z_max = profile.z_max()
|
z_max = profile.z_max()
|
||||||
|
|
|
||||||
|
|
@ -44,3 +44,12 @@ class BCETranslate(BCTranslate):
|
||||||
"z": self._dict["unit_elevation"],
|
"z": self._dict["unit_elevation"],
|
||||||
"solid": _translate("BoundaryCondition", "Solid (kg/s)"),
|
"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:
|
Returns:
|
||||||
Nothing
|
Nothing
|
||||||
"""
|
"""
|
||||||
msg = QMessageBox()
|
msg = QMessageBox(parent=self)
|
||||||
|
|
||||||
msg.setIcon(QMessageBox.Warning)
|
msg.setIcon(QMessageBox.Warning)
|
||||||
msg.setText(text)
|
msg.setText(text)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue