mirror of https://gitlab.com/pamhyr/pamhyr2
pep8
parent
e44bbd5a3c
commit
4d08f3c271
|
|
@ -167,8 +167,7 @@ class ProfileXYZ(Profile, SQLSubModel):
|
|||
filter(
|
||||
lambda s: s.id == sl,
|
||||
data["sediment_layers_list"].sediment_layers
|
||||
)
|
||||
, None)
|
||||
), None)
|
||||
|
||||
data["profile"] = new
|
||||
new._points = PointXYZ._db_load(execute, data.copy())
|
||||
|
|
|
|||
|
|
@ -57,7 +57,10 @@ class Profile(object):
|
|||
)
|
||||
|
||||
def get_ts_key(self, timestamp, key):
|
||||
if timestamp in self._data:
|
||||
if key in self._data[timestamp]:
|
||||
return self._data[timestamp][key]
|
||||
return None
|
||||
|
||||
def has_sediment(self):
|
||||
return any(map(lambda ts: "sl" in self._data[ts], self._data))
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ from View.RunSolver.Window import (
|
|||
SolverLogWindow,
|
||||
CompareSolversWindow
|
||||
)
|
||||
from View.Results.Window import ResultsWindow # , CompareResultsWindow
|
||||
from View.Results.Window import ResultsWindow
|
||||
from View.RunSolver.WindowAdisTS import (
|
||||
SelectSolverWindowAdisTS,
|
||||
SolverLogWindowAdisTS
|
||||
|
|
@ -1584,22 +1584,11 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
|||
# Windows already opened
|
||||
if self.sub_window_exists(
|
||||
ResultsWindow,
|
||||
data=[
|
||||
self._study,
|
||||
None] + # No config
|
||||
data=[self._study, None] +
|
||||
[r._solver 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
|
||||
|
||||
res = ResultsWindow(
|
||||
|
|
@ -1609,15 +1598,6 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
|||
)
|
||||
res.show()
|
||||
|
||||
#res = CompareResultsWindow(
|
||||
#study=self._study,
|
||||
#solver=results._solver,
|
||||
#results=results,
|
||||
#parent=self
|
||||
#)
|
||||
#res.show()
|
||||
|
||||
|
||||
def diff_results(self, solver1, solver2):
|
||||
if solver1 is None:
|
||||
# TODO message
|
||||
|
|
@ -1667,7 +1647,8 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
|||
result3.set("nb_profile", result1.get("nb_profile"))
|
||||
result4.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)
|
||||
result4.set("timestamps", ts)
|
||||
result5.set("timestamps", ts)
|
||||
|
|
@ -1685,7 +1666,8 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
|||
reach3 = result3.river.reach(r)
|
||||
reach4 = result4.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"]:
|
||||
d1 = profile1.get_ts_key(timestamp, key)
|
||||
d2 = profile2.get_ts_key(timestamp, key)
|
||||
|
|
|
|||
|
|
@ -1336,8 +1336,8 @@ class CustomPlot(PamhyrPlot):
|
|||
for axes in self._y_axes[1:]:
|
||||
print("axes: ", axes)
|
||||
if axes in self._axes.keys():
|
||||
for l in self._axes[axes].lines:
|
||||
l.remove()
|
||||
for ll in self._axes[axes].lines:
|
||||
ll.remove()
|
||||
else:
|
||||
ax_new = self.canvas.axes.twinx()
|
||||
self._axes[axes] = ax_new
|
||||
|
|
|
|||
|
|
@ -150,7 +150,8 @@ class PlotAC(PamhyrPlot):
|
|||
def set_timestamp(self, 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)
|
||||
x = profile.geometry.get_station()
|
||||
z = profile.geometry.z()
|
||||
|
|
@ -162,7 +163,8 @@ class PlotAC(PamhyrPlot):
|
|||
if not self._init:
|
||||
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)
|
||||
x = profile.geometry.get_station()
|
||||
z = profile.geometry.z()
|
||||
|
|
|
|||
|
|
@ -62,8 +62,8 @@ class PlotH(PamhyrPlot):
|
|||
|
||||
self._isometric_axis = False
|
||||
|
||||
#self._auto_relim_update = False
|
||||
#self._autoscale_update = False
|
||||
# self._auto_relim_update = False
|
||||
# self._autoscale_update = False
|
||||
|
||||
@property
|
||||
def results(self):
|
||||
|
|
@ -182,11 +182,6 @@ class PlotH(PamhyrPlot):
|
|||
|
||||
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):
|
||||
y = self._current.get_ydata()
|
||||
self._current.set_data(
|
||||
|
|
|
|||
|
|
@ -112,11 +112,12 @@ class PlotRKC(PamhyrPlot):
|
|||
self._river_bottom = z
|
||||
|
||||
def draw_profiles_hs(self, reach):
|
||||
results = self.results[self._current_res_id]
|
||||
lhs = filter(
|
||||
lambda hs: hs._input_reach.reach is reach.geometry,
|
||||
filter(
|
||||
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.name}"
|
||||
elif self._headers[column] == "water_elevation":
|
||||
try:
|
||||
v = self._lst[row].get_ts_key(self._timestamp, "Z")
|
||||
except:
|
||||
if v is None:
|
||||
v = 0.0
|
||||
return f"{v:.4f}"
|
||||
elif self._headers[column] == "discharge":
|
||||
try:
|
||||
v = self._lst[row].get_ts_key(self._timestamp, "Q")
|
||||
except:
|
||||
if v is None:
|
||||
v = 0.0
|
||||
return f"{v:.4f}"
|
||||
elif self._headers[column] == "velocity":
|
||||
try:
|
||||
v = self._lst[row].get_ts_key(self._timestamp, "V")
|
||||
except:
|
||||
if v is None:
|
||||
v = 0.0
|
||||
return f"{v:.4f}"
|
||||
elif self._headers[column] == "width":
|
||||
|
|
|
|||
|
|
@ -139,11 +139,14 @@ class ResultsTranslate(MainTranslate):
|
|||
"unit_thickness": self._dict["unit_thickness"],
|
||||
}
|
||||
|
||||
|
||||
class CompareResultsTranslate(ResultsTranslate):
|
||||
def __init__(self):
|
||||
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._sub_dict["table_headers_raw_data"] = {
|
||||
|
|
|
|||
Loading…
Reference in New Issue