IC: Add speed column in table.

setup.py
Pierre-Antoine Rouby 2024-05-13 15:24:25 +02:00
parent 4cec45131e
commit 0c039793df
4 changed files with 17 additions and 5 deletions

View File

@ -104,7 +104,18 @@ class InitialConditionTableModel(PamhyrTableModel):
row = index.row()
column = index.column()
if self._headers[column] not in ["name", "comment"]:
if self._headers[column] is "speed":
z = self._lst.get(row)["elevation"]
q = self._lst.get(row)["discharge"]
profile = self._reach.reach.get_profiles_from_kp(
self._lst.get(row)["kp"]
)
if len(profile) >= 1:
speed = profile[0].speed(q, z)
return f"{speed:.4f}"
return ""
elif self._headers[column] not in ["name", "comment"]:
v = self._lst.get(row)[self._headers[column]]
return f"{v:.4f}"
else:

View File

@ -41,7 +41,7 @@ class ICTranslate(MainTranslate):
self._sub_dict["table_headers"] = {
# "name": _translate("InitialCondition", "Name"),
"kp": self._dict["unit_kp"],
# "speed": _translate("InitialCondition", "Speed (m/s)"),
"speed": self._dict["unit_speed"],
"discharge": self._dict["unit_discharge"],
"elevation": self._dict["unit_elevation"],
"height": self._dict["unit_height"],

View File

@ -61,6 +61,7 @@ class UnitTranslate(CommonWordTranslate):
self._dict["unit_water_elevation"] = _translate(
"Unit", "Water elevation (m)"
)
self._dict["unit_speed"] = _translate("Unit", "Speed (m/s)")
self._dict["unit_discharge"] = _translate("Unit", "Discharge (m³/s)")
self._dict["unit_area"] = _translate("Unit", "Area (hectare)")

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>889</width>
<height>480</height>
<width>1024</width>
<height>576</height>
</rect>
</property>
<property name="windowTitle">
@ -65,7 +65,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>889</width>
<width>1024</width>
<height>22</height>
</rect>
</property>