mirror of https://gitlab.com/pamhyr/pamhyr2
Results: Add overflow to KPC plot.
parent
aeae8fb710
commit
1c736df647
|
|
@ -42,7 +42,8 @@ class PlotKPC(PamhyrPlot):
|
||||||
parent=parent
|
parent=parent
|
||||||
)
|
)
|
||||||
|
|
||||||
self._current_timestamp = max(results.get("timestamps"))
|
self._timestamps = results.get("timestamps")
|
||||||
|
self._current_timestamp = max(self._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
|
||||||
|
|
||||||
|
|
@ -76,6 +77,7 @@ class PlotKPC(PamhyrPlot):
|
||||||
self.draw_bottom(reach)
|
self.draw_bottom(reach)
|
||||||
self.draw_water_elevation(reach)
|
self.draw_water_elevation(reach)
|
||||||
self.draw_water_elevation_max(reach)
|
self.draw_water_elevation_max(reach)
|
||||||
|
self.draw_water_elevation_overflow(reach)
|
||||||
self.draw_current(reach)
|
self.draw_current(reach)
|
||||||
|
|
||||||
# self.enable_legend()
|
# self.enable_legend()
|
||||||
|
|
@ -156,6 +158,45 @@ class PlotKPC(PamhyrPlot):
|
||||||
lw=1.
|
lw=1.
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def draw_water_elevation_overflow(self, reach):
|
||||||
|
overflow = []
|
||||||
|
|
||||||
|
for profile in reach.profiles:
|
||||||
|
z_max = max(profile.get_key("Z"))
|
||||||
|
z_max_ts = 0
|
||||||
|
for ts in self._timestamps:
|
||||||
|
z = profile.get_ts_key(ts, "Z")
|
||||||
|
if z == z_max:
|
||||||
|
z_max_ts = ts
|
||||||
|
break
|
||||||
|
|
||||||
|
pt_left, pt_right = profile.get_ts_key(z_max_ts, "water_limits")
|
||||||
|
|
||||||
|
if self.is_overflow_point(profile, pt_left):
|
||||||
|
overflow.append((profile, z_max))
|
||||||
|
elif self.is_overflow_point(profile, pt_right):
|
||||||
|
overflow.append((profile, z_max))
|
||||||
|
|
||||||
|
for profile, z in overflow:
|
||||||
|
self.canvas.axes.plot(
|
||||||
|
profile.kp, z,
|
||||||
|
lw=1.,
|
||||||
|
color=self.color_plot,
|
||||||
|
markersize=3,
|
||||||
|
marker='x'
|
||||||
|
)
|
||||||
|
|
||||||
|
def is_overflow_point(self, profile, point):
|
||||||
|
left_limit = profile.geometry.point(0)
|
||||||
|
right_limit = profile.geometry.point(
|
||||||
|
profile.geometry.number_points - 1
|
||||||
|
)
|
||||||
|
|
||||||
|
return (
|
||||||
|
point == left_limit
|
||||||
|
or point == right_limit
|
||||||
|
)
|
||||||
|
|
||||||
def set_reach(self, reach_id):
|
def set_reach(self, reach_id):
|
||||||
self._current_reach_id = reach_id
|
self._current_reach_id = reach_id
|
||||||
self._current_profile_id = 0
|
self._current_profile_id = 0
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,6 @@ class PlotXY(PamhyrPlot):
|
||||||
**self.plot_default_kargs
|
**self.plot_default_kargs
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def draw_water_elevation_max(self, reach):
|
def draw_water_elevation_max(self, reach):
|
||||||
l_x, l_y, r_x, r_y = [], [], [], []
|
l_x, l_y, r_x, r_y = [], [], [], []
|
||||||
overflow = []
|
overflow = []
|
||||||
|
|
@ -174,18 +173,16 @@ class PlotXY(PamhyrPlot):
|
||||||
marker='x'
|
marker='x'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def is_overflow_point(self, profile, point):
|
def is_overflow_point(self, profile, point):
|
||||||
left_limit = profile.geometry.point(0)
|
left_limit = profile.geometry.point(0)
|
||||||
right_limit = profile.geometry.point(
|
right_limit = profile.geometry.point(
|
||||||
profile.geometry.number_points - 1
|
profile.geometry.number_points - 1
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
|
||||||
point == left_limit
|
|
||||||
or point == right_limit
|
|
||||||
)
|
|
||||||
|
|
||||||
|
return (
|
||||||
|
point == left_limit
|
||||||
|
or point == right_limit
|
||||||
|
)
|
||||||
|
|
||||||
def draw_water_elevation(self, reach):
|
def draw_water_elevation(self, reach):
|
||||||
reach = self.results.river.reach(self._current_reach_id)
|
reach = self.results.river.reach(self._current_reach_id)
|
||||||
|
|
@ -285,15 +282,10 @@ class PlotXY(PamhyrPlot):
|
||||||
"water_limits"
|
"water_limits"
|
||||||
)
|
)
|
||||||
|
|
||||||
left_limit = profile.geometry.point(0)
|
if self.is_overflow_point(profile, pt_left):
|
||||||
right_limit = profile.geometry.point(
|
|
||||||
profile.geometry.number_points - 1
|
|
||||||
)
|
|
||||||
|
|
||||||
if pt_left == left_limit:
|
|
||||||
overflow.append(pt_left)
|
overflow.append(pt_left)
|
||||||
|
|
||||||
if pt_right == right_limit:
|
if self.is_overflow_point(profile, pt_right):
|
||||||
overflow.append(pt_right)
|
overflow.append(pt_right)
|
||||||
|
|
||||||
for plot in self.overflow:
|
for plot in self.overflow:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue