Commit c4e965a6 authored by Theophile Terraz's avatar Theophile Terraz
Browse files

cleaning

No related merge requests found
Showing with 10 additions and 3 deletions
+10 -3
......@@ -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:
......
......@@ -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(
......
......@@ -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)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment