scenarios
Theophile Terraz 2025-10-23 14:50:06 +02:00
parent bf95b7f7e6
commit 990d44dd07
2 changed files with 30 additions and 10 deletions

View File

@ -160,8 +160,6 @@ class TableModel(PamhyrTableModel):
self._lst = _river.reachs
elif self._opt_data == "profile" or self._opt_data == "raw_data":
self._lst = _river.reach(reach).profiles
# self._lst = list(compress(_river.reach(reach).profiles,
# _river.reach(reach).profile_mask))
elif self._opt_data == "solver":
self._lst = self._parent._solvers

View File

@ -1234,29 +1234,51 @@ class ResultsWindow(PamhyrWindow):
if filename == "":
return
sep = " "
with open(filename, 'r', newline='') as f:
lines = f.readlines()
x = []
y = []
for line in lines:
if line[0] != "*" and line[0] != "#" and line[0] != "$":
row = line.split(" ")
row = line.split(sep)
print(row)
if len(row) > 1:
if len(row) >= 2:
try:
x.append(float(row[0]))
y.append(float(row[1]))
data_type_lst =['Q(t)', 'Z(x)']
except:
pass
print(x)
print(y)
# with open(filename, 'r', newline='') as f:
# reader = csv.reader(f, delimiter=sep, quotechar='|',
# quoting=csv.QUOTE_NONNUMERIC)
# for row in reader:
# print(row)
# if len(row) == 2:
# x.append(float(row[0]))
# y.append(float(row[1]))
data_type_lst = ['Q(t)', 'Z(t)', 'Z(x)']
data_type, ok = QInputDialog.getItem(
self, 'Data type', 'Chose the type of data:', data_type_lst)
if not ok:
return
print(x)
print(y)
if data_type == 'Z(x)':
self.canvas_2.axes.scatter(x, y, marker="+")
self.plot_rkc.idle()
if data_type == 'Q(t)':
self.canvas_4.axes.scatter(x, y, marker="+")
self.plot_h.idle()
if data_type == 'Z(t)':
for plot in self._additional_plot:
x_key = plot.split(": ")[0]
y_key = plot.split(": ")[1].split(",")
if 'time' in x_key and 'water_elevation' in y_key:
self._additional_plot[plot].canvas.axes.scatter(
x, y, marker="+")
self._additional_plot[plot].idle()