diff --git a/src/Solver/Mage.py b/src/Solver/Mage.py index 98eb0bcab2139531938e93b9f159a713d546b0b0..ce7423a2a7b608e74de8a22116d5e4925e2ab773 100644 --- a/src/Solver/Mage.py +++ b/src/Solver/Mage.py @@ -599,7 +599,6 @@ class Mage(CommandLineSolver): if qlog is not None: qlog.put("Export VAR file") - nb_cv = 0 for hs in hydraulic_structures: if hs.input_reach is None: @@ -618,7 +617,8 @@ class Mage(CommandLineSolver): nb_cv += 1 if nb_cv != 0: - with mage_file_open(os.path.join(repertory, f"{name}.VAR"), "w+") as f: + with mage_file_open(os.path.join( + repertory, f"{name}.VAR"), "w+") as f: files.append(f"{name}.VAR") for hs in hydraulic_structures: diff --git a/src/View/Results/PlotXY.py b/src/View/Results/PlotXY.py index 615e96d5b8f6ee66dab203789de4611c132241f9..290259f0cd32e637a33fd85254709f679cf2fafd 100644 --- a/src/View/Results/PlotXY.py +++ b/src/View/Results/PlotXY.py @@ -181,7 +181,7 @@ class PlotXY(PamhyrPlot): for reach in reaches: for xy in zip(reach.geometry.get_x(), - reach.geometry.get_y()): + reach.geometry.get_y()): self.line_xy.append(np.column_stack(xy)) self.line_xy_collection = collections.LineCollection( diff --git a/src/View/Results/Window.py b/src/View/Results/Window.py index eb4684cfa1be443b1dab8a69a51348245f8c67bc..661d25d61d54ed9e3cb41ff3b270f74d4a5e030f 100644 --- a/src/View/Results/Window.py +++ b/src/View/Results/Window.py @@ -606,11 +606,17 @@ class ResultsWindow(PamhyrWindow): def export_to(self, filename, x, y): timestamps = sorted(self._results.get("timestamps")) + reach = self._results.river.reachs[self._get_current_reach()] + first_line = [f"Study: {self._results.study.name}", + f"Reach: {reach.name}"] if x == "rk": timestamp = self._get_current_timestamp() + first_line.append(f"Time: {timestamp}s") val_dict = self._export_rk(timestamp, y, filename) elif x == "time": profile = self._get_current_profile() + pname = profile.name if profile.name != "" else profile.rk + first_line.append(f"Profile: {pname}") val_dict = self._export_time(profile, y, filename) with open(filename, 'w', newline='') as csvfile: @@ -619,6 +625,7 @@ class ResultsWindow(PamhyrWindow): dict_x = self._trad.get_dict("values_x") dict_y = self._trad.get_dict("values_y") header = [dict_x[x]] + writer.writerow(first_line) for text in y: header.append(dict_y[text]) writer.writerow(header)