diff --git a/src/View/InitialConditions/Table.py b/src/View/InitialConditions/Table.py index d6a70480887325ce3902cb7f9bdded18e5f57205..ee67a8acdd7f0d959b6cf8dcf94a33076159d510 100644 --- a/src/View/InitialConditions/Table.py +++ b/src/View/InitialConditions/Table.py @@ -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: diff --git a/src/View/InitialConditions/translate.py b/src/View/InitialConditions/translate.py index bd3c1eb3303fff9a7904311cee86b40ebde8e51d..d3cef4c188ac603474d8aafe00e2180c1d7562b8 100644 --- a/src/View/InitialConditions/translate.py +++ b/src/View/InitialConditions/translate.py @@ -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"], diff --git a/src/View/Translate.py b/src/View/Translate.py index f3041567e496b4c4c14d03426137c542bb7f2e76..fc91a5160dd89b3d32a5e8b021839910f4c97d00 100644 --- a/src/View/Translate.py +++ b/src/View/Translate.py @@ -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)") diff --git a/src/View/ui/InitialConditions.ui b/src/View/ui/InitialConditions.ui index 405adee54bdf0d7bb1e195e24b3299ca57ad6320..cdeb75bfee9fe19dccecb3c516a3ba0b2cef03c4 100644 --- a/src/View/ui/InitialConditions.ui +++ b/src/View/ui/InitialConditions.ui @@ -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>