From 3b83cd3418d2ca1045e5519a2cd9a04f782065b8 Mon Sep 17 00:00:00 2001
From: Pierre-Antoine Rouby <pierre-antoine.rouby@inrae.fr>
Date: Mon, 23 Sep 2024 15:20:59 +0200
Subject: [PATCH] Results: CustomPlot: Fix index name 'max_depth'.

---
 src/View/Results/CustomPlot/Plot.py | 16 ++++++++--------
 src/View/Results/Window.py          |  8 ++++----
 src/View/Results/translate.py       |  2 +-
 3 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/View/Results/CustomPlot/Plot.py b/src/View/Results/CustomPlot/Plot.py
index a3073c7a..f1f2438f 100644
--- a/src/View/Results/CustomPlot/Plot.py
+++ b/src/View/Results/CustomPlot/Plot.py
@@ -34,7 +34,7 @@ unit = {
     "water_elevation": "0-meter",
     "discharge": "1-m3s",
     "velocity": "2-ms",
-    "depth": "3-meter",
+    "max_depth": "3-meter",
     "mean_depth": "3-meter",
     "froude": "4-dimensionless",
     "wet_area": "5-m2",
@@ -157,9 +157,9 @@ class CustomPlot(PamhyrPlot):
             )
             lines["velocity"] = line
 
-        if "depth" in self._y:
+        if "max_depth" in self._y:
 
-            ax = self._axes[unit["depth"]]
+            ax = self._axes[unit["max_depth"]]
             d = list(
                 map(
                     lambda p: p.geometry.max_water_depth(
@@ -171,7 +171,7 @@ class CustomPlot(PamhyrPlot):
                 rk, d,
                 color='brown', lw=1.,
             )
-            lines["depth"] = line
+            lines["max_depth"] = line
 
         if "mean_depth" in self._y:
 
@@ -361,9 +361,9 @@ class CustomPlot(PamhyrPlot):
             )
             lines["velocity"] = line
 
-        if "depth" in self._y:
+        if "max_depth" in self._y:
 
-            ax = self._axes[unit["depth"]]
+            ax = self._axes[unit["max_depth"]]
             d = list(
                 map(lambda z: profile.geometry.max_water_depth(z), z)
             )
@@ -372,7 +372,7 @@ class CustomPlot(PamhyrPlot):
                 ts, d,
                 color='brown', lw=1.,
             )
-            lines["depth"] = line
+            lines["max_depth"] = line
 
         if "mean_depth" in self._y:
 
@@ -385,7 +385,7 @@ class CustomPlot(PamhyrPlot):
                 ts, d,
                 color='orange', lw=1.,
             )
-            lines["depth"] = line
+            lines["mean_depth"] = line
 
         if "froude" in self._y:
 
diff --git a/src/View/Results/Window.py b/src/View/Results/Window.py
index 76c16b9d..eb4684cf 100644
--- a/src/View/Results/Window.py
+++ b/src/View/Results/Window.py
@@ -695,8 +695,8 @@ class ResultsWindow(PamhyrWindow):
                     reach.profiles
                 )
             )
-        if "depth" in y:
-            my_dict["depth"] = list(
+        if "max_depth" in y:
+            my_dict["max_depth"] = list(
                 map(
                     lambda p: p.geometry.max_water_depth(
                         p.get_ts_key(timestamp, "Z")),
@@ -760,8 +760,8 @@ class ResultsWindow(PamhyrWindow):
                     q, z
                 )
             )
-        if "depth" in y:
-            my_dict["depth"] = list(
+        if "max_depth" in y:
+            my_dict["max_depth"] = list(
                 map(lambda z: profile.geometry.max_water_depth(z), z)
             )
         if "mean_depth" in y:
diff --git a/src/View/Results/translate.py b/src/View/Results/translate.py
index b8e40d3b..8b66124e 100644
--- a/src/View/Results/translate.py
+++ b/src/View/Results/translate.py
@@ -77,7 +77,7 @@ class ResultsTranslate(MainTranslate):
             "water_elevation": self._dict["unit_water_elevation"],
             "discharge": self._dict["unit_discharge"],
             "velocity": self._dict["unit_speed"],
-            "depth": self._dict["unit_max_height"],
+            "max_depth": self._dict["unit_max_height"],
             "mean_depth": self._dict["unit_mean_height"],
             "froude": self._dict["unit_froude"],
             "wet_area": self._dict["unit_wet_area"],
-- 
GitLab