mirror of https://gitlab.com/pamhyr/pamhyr2
pep8
parent
e44bbd5a3c
commit
4d08f3c271
|
|
@ -167,8 +167,7 @@ class ProfileXYZ(Profile, SQLSubModel):
|
||||||
filter(
|
filter(
|
||||||
lambda s: s.id == sl,
|
lambda s: s.id == sl,
|
||||||
data["sediment_layers_list"].sediment_layers
|
data["sediment_layers_list"].sediment_layers
|
||||||
)
|
), None)
|
||||||
, None)
|
|
||||||
|
|
||||||
data["profile"] = new
|
data["profile"] = new
|
||||||
new._points = PointXYZ._db_load(execute, data.copy())
|
new._points = PointXYZ._db_load(execute, data.copy())
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,10 @@ class Profile(object):
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_ts_key(self, timestamp, key):
|
def get_ts_key(self, timestamp, key):
|
||||||
return self._data[timestamp][key]
|
if timestamp in self._data:
|
||||||
|
if key in self._data[timestamp]:
|
||||||
|
return self._data[timestamp][key]
|
||||||
|
return None
|
||||||
|
|
||||||
def has_sediment(self):
|
def has_sediment(self):
|
||||||
return any(map(lambda ts: "sl" in self._data[ts], self._data))
|
return any(map(lambda ts: "sl" in self._data[ts], self._data))
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ from View.RunSolver.Window import (
|
||||||
SolverLogWindow,
|
SolverLogWindow,
|
||||||
CompareSolversWindow
|
CompareSolversWindow
|
||||||
)
|
)
|
||||||
from View.Results.Window import ResultsWindow # , CompareResultsWindow
|
from View.Results.Window import ResultsWindow
|
||||||
from View.RunSolver.WindowAdisTS import (
|
from View.RunSolver.WindowAdisTS import (
|
||||||
SelectSolverWindowAdisTS,
|
SelectSolverWindowAdisTS,
|
||||||
SolverLogWindowAdisTS
|
SolverLogWindowAdisTS
|
||||||
|
|
@ -1584,22 +1584,11 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||||
# Windows already opened
|
# Windows already opened
|
||||||
if self.sub_window_exists(
|
if self.sub_window_exists(
|
||||||
ResultsWindow,
|
ResultsWindow,
|
||||||
data=[
|
data=[self._study, None] +
|
||||||
self._study,
|
[r._solver for r in results] +
|
||||||
None] + # No config
|
[r._repertory for r in results] +
|
||||||
[r._solver for r in results] +
|
[r._name for r in results]
|
||||||
[r._repertory for r in results] +
|
|
||||||
[r._name for r in results]
|
|
||||||
):
|
):
|
||||||
#w = self.get_sub_window(
|
|
||||||
#ResultsWindow,
|
|
||||||
#data=[
|
|
||||||
#self._study,
|
|
||||||
#None, # No config
|
|
||||||
#results,
|
|
||||||
#parent=self
|
|
||||||
#])
|
|
||||||
#w.add_result(result[1], run.solver2)
|
|
||||||
return
|
return
|
||||||
|
|
||||||
res = ResultsWindow(
|
res = ResultsWindow(
|
||||||
|
|
@ -1609,15 +1598,6 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||||
)
|
)
|
||||||
res.show()
|
res.show()
|
||||||
|
|
||||||
#res = CompareResultsWindow(
|
|
||||||
#study=self._study,
|
|
||||||
#solver=results._solver,
|
|
||||||
#results=results,
|
|
||||||
#parent=self
|
|
||||||
#)
|
|
||||||
#res.show()
|
|
||||||
|
|
||||||
|
|
||||||
def diff_results(self, solver1, solver2):
|
def diff_results(self, solver1, solver2):
|
||||||
if solver1 is None:
|
if solver1 is None:
|
||||||
# TODO message
|
# TODO message
|
||||||
|
|
@ -1667,7 +1647,8 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||||
result3.set("nb_profile", result1.get("nb_profile"))
|
result3.set("nb_profile", result1.get("nb_profile"))
|
||||||
result4.set("nb_profile", result1.get("nb_profile"))
|
result4.set("nb_profile", result1.get("nb_profile"))
|
||||||
result5.set("nb_profile", result1.get("nb_profile"))
|
result5.set("nb_profile", result1.get("nb_profile"))
|
||||||
ts = list(result1.get("timestamps").intersection(result2.get("timestamps")))
|
ts = list(result1.get("timestamps").intersection(
|
||||||
|
result2.get("timestamps")))
|
||||||
result3.set("timestamps", ts)
|
result3.set("timestamps", ts)
|
||||||
result4.set("timestamps", ts)
|
result4.set("timestamps", ts)
|
||||||
result5.set("timestamps", ts)
|
result5.set("timestamps", ts)
|
||||||
|
|
@ -1685,7 +1666,8 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||||
reach3 = result3.river.reach(r)
|
reach3 = result3.river.reach(r)
|
||||||
reach4 = result4.river.reach(r)
|
reach4 = result4.river.reach(r)
|
||||||
reach5 = result5.river.reach(r)
|
reach5 = result5.river.reach(r)
|
||||||
for p, (profile1, profile2) in enumerate(zip(reach1.profiles, reach2.profiles)):
|
for p, (profile1, profile2) in enumerate(zip(
|
||||||
|
reach1.profiles, reach2.profiles)):
|
||||||
for key in ["Z", "Q", "V"]:
|
for key in ["Z", "Q", "V"]:
|
||||||
d1 = profile1.get_ts_key(timestamp, key)
|
d1 = profile1.get_ts_key(timestamp, key)
|
||||||
d2 = profile2.get_ts_key(timestamp, key)
|
d2 = profile2.get_ts_key(timestamp, key)
|
||||||
|
|
|
||||||
|
|
@ -241,8 +241,8 @@ class CustomPlot(PamhyrPlot):
|
||||||
self.lines["bed_elevation"] = line
|
self.lines["bed_elevation"] = line
|
||||||
|
|
||||||
if (self._envelop and
|
if (self._envelop and
|
||||||
reach.has_sediment() and
|
reach.has_sediment() and
|
||||||
self._current_res_id != 2):
|
self._current_res_id != 2):
|
||||||
|
|
||||||
ax = self._axes[unit["bed_elevation_envelop"]]
|
ax = self._axes[unit["bed_elevation_envelop"]]
|
||||||
|
|
||||||
|
|
@ -547,7 +547,7 @@ class CustomPlot(PamhyrPlot):
|
||||||
reach2.profiles
|
reach2.profiles
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
fr = list(
|
fr = list(
|
||||||
map(
|
map(
|
||||||
lambda x, y: x - y,
|
lambda x, y: x - y,
|
||||||
fr1, fr2
|
fr1, fr2
|
||||||
|
|
@ -1336,8 +1336,8 @@ class CustomPlot(PamhyrPlot):
|
||||||
for axes in self._y_axes[1:]:
|
for axes in self._y_axes[1:]:
|
||||||
print("axes: ", axes)
|
print("axes: ", axes)
|
||||||
if axes in self._axes.keys():
|
if axes in self._axes.keys():
|
||||||
for l in self._axes[axes].lines:
|
for ll in self._axes[axes].lines:
|
||||||
l.remove()
|
ll.remove()
|
||||||
else:
|
else:
|
||||||
ax_new = self.canvas.axes.twinx()
|
ax_new = self.canvas.axes.twinx()
|
||||||
self._axes[axes] = ax_new
|
self._axes[axes] = ax_new
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,8 @@ class PlotAC(PamhyrPlot):
|
||||||
def set_timestamp(self, timestamp):
|
def set_timestamp(self, timestamp):
|
||||||
self._current_timestamp = timestamp
|
self._current_timestamp = timestamp
|
||||||
|
|
||||||
reach = self.results[self._current_res_id].river.reach(self._current_reach_id)
|
reach = self.results[self._current_res_id].river.reach(
|
||||||
|
self._current_reach_id)
|
||||||
profile = reach.profile(self._current_profile_id)
|
profile = reach.profile(self._current_profile_id)
|
||||||
x = profile.geometry.get_station()
|
x = profile.geometry.get_station()
|
||||||
z = profile.geometry.z()
|
z = profile.geometry.z()
|
||||||
|
|
@ -162,7 +163,8 @@ class PlotAC(PamhyrPlot):
|
||||||
if not self._init:
|
if not self._init:
|
||||||
self.draw()
|
self.draw()
|
||||||
|
|
||||||
reach = self.results[self._current_res_id].river.reach(self._current_reach_id)
|
reach = self.results[self._current_res_id].river.reach(
|
||||||
|
self._current_reach_id)
|
||||||
profile = reach.profile(self._current_profile_id)
|
profile = reach.profile(self._current_profile_id)
|
||||||
x = profile.geometry.get_station()
|
x = profile.geometry.get_station()
|
||||||
z = profile.geometry.z()
|
z = profile.geometry.z()
|
||||||
|
|
|
||||||
|
|
@ -62,8 +62,8 @@ class PlotH(PamhyrPlot):
|
||||||
|
|
||||||
self._isometric_axis = False
|
self._isometric_axis = False
|
||||||
|
|
||||||
#self._auto_relim_update = False
|
# self._auto_relim_update = False
|
||||||
#self._autoscale_update = False
|
# self._autoscale_update = False
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def results(self):
|
def results(self):
|
||||||
|
|
@ -182,11 +182,6 @@ class PlotH(PamhyrPlot):
|
||||||
|
|
||||||
self._line.set_data(x, y)
|
self._line.set_data(x, y)
|
||||||
|
|
||||||
#self._current.set_data(
|
|
||||||
#[self._current_timestamp, self._current_timestamp],
|
|
||||||
#self.canvas.axes.get_ylim()
|
|
||||||
#)
|
|
||||||
|
|
||||||
def update_current(self):
|
def update_current(self):
|
||||||
y = self._current.get_ydata()
|
y = self._current.get_ydata()
|
||||||
self._current.set_data(
|
self._current.set_data(
|
||||||
|
|
|
||||||
|
|
@ -112,11 +112,12 @@ class PlotRKC(PamhyrPlot):
|
||||||
self._river_bottom = z
|
self._river_bottom = z
|
||||||
|
|
||||||
def draw_profiles_hs(self, reach):
|
def draw_profiles_hs(self, reach):
|
||||||
|
results = self.results[self._current_res_id]
|
||||||
lhs = filter(
|
lhs = filter(
|
||||||
lambda hs: hs._input_reach.reach is reach.geometry,
|
lambda hs: hs._input_reach.reach is reach.geometry,
|
||||||
filter(
|
filter(
|
||||||
lambda hs: hs._input_reach is not None,
|
lambda hs: hs._input_reach is not None,
|
||||||
self.results[self._current_res_id].study.river.hydraulic_structures.lst
|
results.study.river.hydraulic_structures.lst
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -89,21 +89,18 @@ class TableModel(PamhyrTableModel):
|
||||||
return f"{p.rk:.4f}"
|
return f"{p.rk:.4f}"
|
||||||
return f"{p.name}"
|
return f"{p.name}"
|
||||||
elif self._headers[column] == "water_elevation":
|
elif self._headers[column] == "water_elevation":
|
||||||
try:
|
v = self._lst[row].get_ts_key(self._timestamp, "Z")
|
||||||
v = self._lst[row].get_ts_key(self._timestamp, "Z")
|
if v is None:
|
||||||
except:
|
|
||||||
v = 0.0
|
v = 0.0
|
||||||
return f"{v:.4f}"
|
return f"{v:.4f}"
|
||||||
elif self._headers[column] == "discharge":
|
elif self._headers[column] == "discharge":
|
||||||
try:
|
v = self._lst[row].get_ts_key(self._timestamp, "Q")
|
||||||
v = self._lst[row].get_ts_key(self._timestamp, "Q")
|
if v is None:
|
||||||
except:
|
|
||||||
v = 0.0
|
v = 0.0
|
||||||
return f"{v:.4f}"
|
return f"{v:.4f}"
|
||||||
elif self._headers[column] == "velocity":
|
elif self._headers[column] == "velocity":
|
||||||
try:
|
v = self._lst[row].get_ts_key(self._timestamp, "V")
|
||||||
v = self._lst[row].get_ts_key(self._timestamp, "V")
|
if v is None:
|
||||||
except:
|
|
||||||
v = 0.0
|
v = 0.0
|
||||||
return f"{v:.4f}"
|
return f"{v:.4f}"
|
||||||
elif self._headers[column] == "width":
|
elif self._headers[column] == "width":
|
||||||
|
|
|
||||||
|
|
@ -957,7 +957,7 @@ class ResultsWindow(PamhyrWindow):
|
||||||
reach2.profiles
|
reach2.profiles
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
fr = list(
|
fr = list(
|
||||||
map(
|
map(
|
||||||
lambda x, y: x - y,
|
lambda x, y: x - y,
|
||||||
fr1, fr2
|
fr1, fr2
|
||||||
|
|
@ -1027,14 +1027,14 @@ class ResultsWindow(PamhyrWindow):
|
||||||
if self._current_results != 2:
|
if self._current_results != 2:
|
||||||
z_min = [profile.geometry.z_min()] * len(self._timestamps)
|
z_min = [profile.geometry.z_min()] * len(self._timestamps)
|
||||||
else:
|
else:
|
||||||
z_min1 = profile1.geometry.z_min()
|
z_min1 = profile1.geometry.z_min()
|
||||||
z_min2 = profile2.geometry.z_min()
|
z_min2 = profile2.geometry.z_min()
|
||||||
z_min = list(
|
z_min = list(
|
||||||
map(
|
map(
|
||||||
lambda ts: z_min1 - z_min2,
|
lambda ts: z_min1 - z_min2,
|
||||||
self._timestamps
|
self._timestamps
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
)
|
||||||
my_dict[dict_y["bed_elevation"]] = z_min
|
my_dict[dict_y["bed_elevation"]] = z_min
|
||||||
if "discharge" in y:
|
if "discharge" in y:
|
||||||
my_dict[dict_y["discharge"]] = q
|
my_dict[dict_y["discharge"]] = q
|
||||||
|
|
|
||||||
|
|
@ -555,7 +555,7 @@ class ResultsWindowAdisTS(PamhyrWindow):
|
||||||
self.update(pol_id=rows)
|
self.update(pol_id=rows)
|
||||||
|
|
||||||
def _set_current_profile_raw_data(self):
|
def _set_current_profile_raw_data(self):
|
||||||
return
|
return
|
||||||
|
|
||||||
def _set_current_timestamp(self):
|
def _set_current_timestamp(self):
|
||||||
timestamp = self._timestamps[self._slider_time.value()]
|
timestamp = self._timestamps[self._slider_time.value()]
|
||||||
|
|
|
||||||
|
|
@ -139,11 +139,14 @@ class ResultsTranslate(MainTranslate):
|
||||||
"unit_thickness": self._dict["unit_thickness"],
|
"unit_thickness": self._dict["unit_thickness"],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class CompareResultsTranslate(ResultsTranslate):
|
class CompareResultsTranslate(ResultsTranslate):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(CompareResultsTranslate, self).__init__()
|
super(CompareResultsTranslate, self).__init__()
|
||||||
|
|
||||||
self._dict['label_water'] = u"Δ "+_translate("Results", "Water elevation")
|
self._dict['label_water'] = u"Δ "+_translate(
|
||||||
|
"Results", "Water elevation"
|
||||||
|
)
|
||||||
self._dict['unit_elevation'] = u"Δ "+self._dict["unit_elevation"]
|
self._dict['unit_elevation'] = u"Δ "+self._dict["unit_elevation"]
|
||||||
|
|
||||||
self._sub_dict["table_headers_raw_data"] = {
|
self._sub_dict["table_headers_raw_data"] = {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue