mirror of https://gitlab.com/pamhyr/pamhyr2
Results: PlotXY: Add water level.
parent
2faab43aed
commit
b04e325ab5
|
|
@ -47,7 +47,7 @@ class Profile(object):
|
||||||
def get_ts(self, timestamp):
|
def get_ts(self, timestamp):
|
||||||
return self._data[timestamp]
|
return self._data[timestamp]
|
||||||
|
|
||||||
def get_key(self, timestamp):
|
def get_key(self, key):
|
||||||
return list(
|
return list(
|
||||||
map(lambda ts: self._data[ts][key], self._data)
|
map(lambda ts: self._data[ts][key], self._data)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -595,4 +595,5 @@ class Mage8(Mage):
|
||||||
end = newline().size <= 0
|
end = newline().size <= 0
|
||||||
|
|
||||||
logger.debug(reachs[0].profiles[0]._data)
|
logger.debug(reachs[0].profiles[0]._data)
|
||||||
|
results.set("timestamps", ts)
|
||||||
logger.info(f"read_bin: ... end with {len(ts)} timestamp read")
|
logger.info(f"read_bin: ... end with {len(ts)} timestamp read")
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,8 @@
|
||||||
|
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from functools import reduce
|
||||||
|
|
||||||
from tools import timer, trace
|
from tools import timer, trace
|
||||||
from View.Plot.APlot import APlot
|
from View.Plot.APlot import APlot
|
||||||
|
|
||||||
|
|
@ -40,6 +42,7 @@ class PlotXY(APlot):
|
||||||
self.line_xy = []
|
self.line_xy = []
|
||||||
self.line_gl = []
|
self.line_gl = []
|
||||||
|
|
||||||
|
self._current_timestamp = max(results.get("timestamps"))
|
||||||
self._current_reach_id = reach_id
|
self._current_reach_id = reach_id
|
||||||
self._current_profile_id = profile_id
|
self._current_profile_id = profile_id
|
||||||
|
|
||||||
|
|
@ -106,9 +109,32 @@ class PlotXY(APlot):
|
||||||
for x, y in zip(x_complete, y_complete)
|
for x, y in zip(x_complete, y_complete)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Display point under water
|
||||||
|
for profile in reach.profiles:
|
||||||
|
water_z = profile.get_ts_key(
|
||||||
|
self._current_timestamp, "Z"
|
||||||
|
)
|
||||||
|
pgeo = profile.geometry
|
||||||
|
|
||||||
|
x, y = reduce(
|
||||||
|
lambda acc, pts: (acc[0] + [pts.x], acc[1] + [pts.y]),
|
||||||
|
filter(
|
||||||
|
lambda pts: pts.z < water_z,
|
||||||
|
pgeo.points
|
||||||
|
),
|
||||||
|
([], [])
|
||||||
|
)
|
||||||
|
|
||||||
|
self.canvas.axes.plot(
|
||||||
|
x, y, lw=1.,
|
||||||
|
color='b',
|
||||||
|
markersize=4,
|
||||||
|
marker='o'
|
||||||
|
)
|
||||||
|
|
||||||
if self.display_current:
|
if self.display_current:
|
||||||
# Current profile
|
# Current profile
|
||||||
profile = reach.geometry.profile(self._current_profile_id)
|
profile = reach.profile(self._current_profile_id).geometry
|
||||||
|
|
||||||
self.plot_selected, = self.canvas.axes.plot(
|
self.plot_selected, = self.canvas.axes.plot(
|
||||||
profile.x(),
|
profile.x(),
|
||||||
|
|
@ -134,5 +160,9 @@ class PlotXY(APlot):
|
||||||
self._current_profile_id = profile_id
|
self._current_profile_id = profile_id
|
||||||
self.draw()
|
self.draw()
|
||||||
|
|
||||||
|
def set_timestamp(self, timestamp):
|
||||||
|
self._current_timestamp = timestamp
|
||||||
|
self.draw()
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
self.draw()
|
self.draw()
|
||||||
|
|
|
||||||
|
|
@ -158,6 +158,17 @@ class ResultsWindow(ASubMainWindow, ListedSubWindow):
|
||||||
|
|
||||||
self._table[t].dataChanged.connect(fun[t])
|
self._table[t].dataChanged.connect(fun[t])
|
||||||
|
|
||||||
|
def plotXY(self, reach_id = None, profile_id = None, timestamp = None):
|
||||||
|
if reach_id is not None:
|
||||||
|
self.plot_xy.set_reach(reach_id)
|
||||||
|
if profile_id is not None:
|
||||||
|
self.plot_xy.set_profile(profile_id)
|
||||||
|
if timestamp is not None:
|
||||||
|
self.plot_xy.set_timestamp(timestamp)
|
||||||
|
|
||||||
|
self.plot_xy.draw()
|
||||||
|
|
||||||
|
|
||||||
def _set_current_reach(self):
|
def _set_current_reach(self):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue