mirror of https://gitlab.com/pamhyr/pamhyr2
more work on compare results
parent
84486c03ed
commit
e6dd983f97
|
|
@ -841,11 +841,6 @@ class ProfileXYZ(Profile, SQLSubModel):
|
|||
if zz[i] > z and zz[i+1] <= z:
|
||||
fact = (z - zz[i]) / (zz[i+1] - zz[i])
|
||||
y = station[i] + fact * (station[i+1] - station[i])
|
||||
#y = np.interp(
|
||||
#z,
|
||||
#[zz[i+1], zz[i]],
|
||||
#[station[i+1], station[i]]
|
||||
#)
|
||||
start.append(y)
|
||||
|
||||
end = []
|
||||
|
|
@ -856,11 +851,6 @@ class ProfileXYZ(Profile, SQLSubModel):
|
|||
if zz[i] <= z and zz[i+1] > z:
|
||||
fact = (z - zz[i]) / (zz[i+1] - zz[i])
|
||||
y = station[i] + fact * (station[i+1] - station[i])
|
||||
#y = np.interp(
|
||||
#z,
|
||||
#[zz[i], zz[i+1]],
|
||||
#[station[i], station[i+1]]
|
||||
#)
|
||||
end.append(y)
|
||||
|
||||
if len(start) != len(end):
|
||||
|
|
@ -891,38 +881,24 @@ class ProfileXYZ(Profile, SQLSubModel):
|
|||
|
||||
# Interpolate points at river left side
|
||||
if (i_left > 0):
|
||||
fact = (z - self.point(i_left).z) / (self.point(i_left - 1).z - self.point(i_left).z)
|
||||
x = self.point(i_left).x + fact * (self.point(i_left - 1).x - self.point(i_left).x)
|
||||
y = self.point(i_left).y + fact * (self.point(i_left - 1).y - self.point(i_left).y)
|
||||
#x = np.interp(
|
||||
#z,
|
||||
#[self.point(i_left - 1).z, self.point(i_left).z],
|
||||
#[self.point(i_left - 1).x, self.point(i_left).x]
|
||||
#)
|
||||
#y = np.interp(
|
||||
#z,
|
||||
#[self.point(i_left).z, self.point(i_left - 1).z],
|
||||
#[self.point(i_left).y, self.point(i_left - 1).y]
|
||||
#)
|
||||
fact = (z - self.point(i_left).z) / (self.point(i_left - 1).z
|
||||
- self.point(i_left).z)
|
||||
x = self.point(i_left).x + fact * (self.point(i_left - 1).x
|
||||
- self.point(i_left).x)
|
||||
y = self.point(i_left).y + fact * (self.point(i_left - 1).y
|
||||
- self.point(i_left).y)
|
||||
pt_left = PointXYZ(x=x, y=y, z=z, name="wl_left")
|
||||
else:
|
||||
pt_left = self.point(0)
|
||||
|
||||
# Interpolate points at river right side
|
||||
if (i_right < self.number_points - 1):
|
||||
fact = (z - self.point(i_right).z) / (self.point(i_right + 1).z - self.point(i_right).z)
|
||||
x = self.point(i_right).x + fact * (self.point(i_right + 1).x - self.point(i_right).x)
|
||||
y = self.point(i_right).y + fact * (self.point(i_right + 1).y - self.point(i_right).y)
|
||||
#x = np.interp(
|
||||
#z,
|
||||
#[self.point(i_right).z, self.point(i_right + 1).z],
|
||||
#[self.point(i_right).x, self.point(i_right + 1).x]
|
||||
#)
|
||||
#y = np.interp(
|
||||
#z,
|
||||
#[self.point(i_right).z, self.point(i_right + 1).z],
|
||||
#[self.point(i_right).y, self.point(i_right + 1).y]
|
||||
#)
|
||||
fact = (z - self.point(i_right).z) / (self.point(i_right + 1).z -
|
||||
self.point(i_right).z)
|
||||
x = self.point(i_right).x + fact * (self.point(i_right + 1).x -
|
||||
self.point(i_right).x)
|
||||
y = self.point(i_right).y + fact * (self.point(i_right + 1).y -
|
||||
self.point(i_right).y)
|
||||
pt_right = PointXYZ(x=x, y=y, z=z, name="wl_right")
|
||||
else:
|
||||
pt_right = self.point(self.number_points - 1)
|
||||
|
|
|
|||
|
|
@ -1416,3 +1416,16 @@ class CustomPlot(PamhyrPlot):
|
|||
)
|
||||
labs = list(map(lambda line: self._trad[line], self.lines))
|
||||
self.canvas.axes.legend(lns, labs, loc="best")
|
||||
|
||||
def add_imported_plot(self, data):
|
||||
if (data["type_x"] == self._x and
|
||||
data["type_y"] in self._y):
|
||||
while data["legend"] in self.lines:
|
||||
data["legend"] += '*'
|
||||
self._trad._dict[data["legend"]] = data["legend"] + data["unit"]
|
||||
self.lines[data["legend"]] = self.canvas.axes.plot(data["x"],
|
||||
data["y"],
|
||||
marker="+",
|
||||
linestyle="--")
|
||||
self.update_legend()
|
||||
self.idle()
|
||||
|
|
|
|||
|
|
@ -1243,24 +1243,12 @@ class ResultsWindow(PamhyrWindow):
|
|||
for line in lines:
|
||||
if line[0] != "*" and line[0] != "#" and line[0] != "$":
|
||||
row = line.split(sep)
|
||||
print(row)
|
||||
if len(row) >= 2:
|
||||
try:
|
||||
x.append(float(row[0]))
|
||||
y.append(float(row[1]))
|
||||
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(
|
||||
|
|
@ -1269,8 +1257,7 @@ class ResultsWindow(PamhyrWindow):
|
|||
if not ok:
|
||||
return
|
||||
|
||||
legend, ok = QInputDialog.getText(
|
||||
self, 'Legend','Legend:' )
|
||||
legend, ok = QInputDialog.getText(self, 'Legend', 'Legend:')
|
||||
|
||||
if not ok:
|
||||
return
|
||||
|
|
@ -1286,28 +1273,25 @@ class ResultsWindow(PamhyrWindow):
|
|||
tmp_unit = {'Z': ' (m)',
|
||||
'Q': ' (m³/s)'}
|
||||
|
||||
data = {'type_x': tmp_dict[data_type[2]],
|
||||
'type_y': tmp_dict[data_type[0]],
|
||||
'legend': legend,
|
||||
'unit': tmp_unit[data_type[0]],
|
||||
'x': x,
|
||||
'y': y}
|
||||
|
||||
if data_type == 'Z(x)':
|
||||
line = self.canvas_2.axes.plot(x, y, marker="+",
|
||||
label=legend + ' (m)')
|
||||
self.plot_rkc.canvas.draw_idle()
|
||||
self.plot_rkc.update_idle()
|
||||
if data_type == 'Q(t)':
|
||||
line = self.canvas_4.axes.plot(x, y,
|
||||
marker="+",
|
||||
line = self.canvas_4.axes.plot(x, y, marker="+",
|
||||
label=legend + ' (m³/s)')
|
||||
self.plot_h._line.append(line)
|
||||
self.plot_h.enable_legend()
|
||||
self.plot_h.canvas.draw_idle()
|
||||
self.plot_h.update_idle
|
||||
|
||||
for p in self._additional_plot:
|
||||
plot = self._additional_plot[p]
|
||||
x_key = p.split(": ")[0]
|
||||
y_key = p.split(": ")[1].split(",")
|
||||
if (tmp_dict[data_type[2]] in x_key and
|
||||
tmp_dict[data_type[0]] in y_key):
|
||||
while legend in plot.lines:
|
||||
legend += '*'
|
||||
plot._trad._dict[legend] = legend + tmp_unit[data_type[0]]
|
||||
plot.lines[legend] = plot.canvas.axes.plot(x, y,
|
||||
marker="+",
|
||||
linestyle="--")
|
||||
plot.update_legend()
|
||||
plot.idle()
|
||||
self._additional_plot[p].add_imported_plot(data)
|
||||
|
|
|
|||
Loading…
Reference in New Issue