compare_results
Theophile Terraz 2024-10-30 17:12:20 +01:00
parent 15da23183b
commit c4e965a631
3 changed files with 10 additions and 3 deletions

View File

@ -599,7 +599,6 @@ class Mage(CommandLineSolver):
if qlog is not None: if qlog is not None:
qlog.put("Export VAR file") qlog.put("Export VAR file")
nb_cv = 0 nb_cv = 0
for hs in hydraulic_structures: for hs in hydraulic_structures:
if hs.input_reach is None: if hs.input_reach is None:
@ -618,7 +617,8 @@ class Mage(CommandLineSolver):
nb_cv += 1 nb_cv += 1
if nb_cv != 0: 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") files.append(f"{name}.VAR")
for hs in hydraulic_structures: for hs in hydraulic_structures:

View File

@ -181,7 +181,7 @@ class PlotXY(PamhyrPlot):
for reach in reaches: for reach in reaches:
for xy in zip(reach.geometry.get_x(), 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.append(np.column_stack(xy))
self.line_xy_collection = collections.LineCollection( self.line_xy_collection = collections.LineCollection(

View File

@ -606,11 +606,17 @@ class ResultsWindow(PamhyrWindow):
def export_to(self, filename, x, y): def export_to(self, filename, x, y):
timestamps = sorted(self._results.get("timestamps")) 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": if x == "rk":
timestamp = self._get_current_timestamp() timestamp = self._get_current_timestamp()
first_line.append(f"Time: {timestamp}s")
val_dict = self._export_rk(timestamp, y, filename) val_dict = self._export_rk(timestamp, y, filename)
elif x == "time": elif x == "time":
profile = self._get_current_profile() 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) val_dict = self._export_time(profile, y, filename)
with open(filename, 'w', newline='') as csvfile: with open(filename, 'w', newline='') as csvfile:
@ -619,6 +625,7 @@ class ResultsWindow(PamhyrWindow):
dict_x = self._trad.get_dict("values_x") dict_x = self._trad.get_dict("values_x")
dict_y = self._trad.get_dict("values_y") dict_y = self._trad.get_dict("values_y")
header = [dict_x[x]] header = [dict_x[x]]
writer.writerow(first_line)
for text in y: for text in y:
header.append(dict_y[text]) header.append(dict_y[text])
writer.writerow(header) writer.writerow(header)