mirror of https://gitlab.com/pamhyr/pamhyr2
Results: PlotRKC: Use table to get results table.
parent
ffad53a331
commit
b87f82f74d
|
|
@ -17,6 +17,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
from functools import reduce
|
from functools import reduce
|
||||||
|
|
||||||
|
|
@ -167,14 +168,18 @@ class PlotRKC(PamhyrPlot):
|
||||||
|
|
||||||
def draw_water_elevation(self, reach):
|
def draw_water_elevation(self, reach):
|
||||||
if len(reach.geometry.profiles) != 0:
|
if len(reach.geometry.profiles) != 0:
|
||||||
|
result = self.results[self._current_res_id]
|
||||||
rk = reach.geometry.get_rk()
|
rk = reach.geometry.get_rk()
|
||||||
z_min = reach.geometry.get_z_min()
|
z_min = reach.geometry.get_z_min()
|
||||||
|
|
||||||
|
table = result.get("table")["Z"]
|
||||||
|
ts = result.get_timestamp_id(self._current_timestamp)
|
||||||
|
|
||||||
water_z = list(
|
water_z = list(
|
||||||
map(
|
map(
|
||||||
lambda p: p.get_ts_key(
|
lambda p: table[
|
||||||
self._current_timestamp, "Z"
|
ts, p.global_index
|
||||||
),
|
],
|
||||||
reach.profiles
|
reach.profiles
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -194,12 +199,18 @@ class PlotRKC(PamhyrPlot):
|
||||||
|
|
||||||
def draw_water_elevation_max(self, reach):
|
def draw_water_elevation_max(self, reach):
|
||||||
if len(reach.geometry.profiles) != 0:
|
if len(reach.geometry.profiles) != 0:
|
||||||
|
result = self.results[self._current_res_id]
|
||||||
rk = reach.geometry.get_rk()
|
rk = reach.geometry.get_rk()
|
||||||
z_min = reach.geometry.get_z_min()
|
z_min = reach.geometry.get_z_min()
|
||||||
|
|
||||||
|
table = result.get("table")["Z"]
|
||||||
|
ts = result.get_timestamp_id(self._current_timestamp)
|
||||||
|
|
||||||
water_z = list(
|
water_z = list(
|
||||||
map(
|
map(
|
||||||
lambda p: max(p.get_key("Z")),
|
lambda p: table[
|
||||||
|
ts, p.global_index
|
||||||
|
],
|
||||||
reach.profiles
|
reach.profiles
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -253,12 +264,14 @@ class PlotRKC(PamhyrPlot):
|
||||||
|
|
||||||
def draw_water_elevation_overflow(self, reach):
|
def draw_water_elevation_overflow(self, reach):
|
||||||
overflow = []
|
overflow = []
|
||||||
|
result = self.results[self._current_res_id]
|
||||||
|
table = result.get("table")["Z"]
|
||||||
|
|
||||||
for profile in reach.profiles:
|
for profile in reach.profiles:
|
||||||
z_max = max(profile.get_key("Z"))
|
z_max = max(table[:, profile.global_index])
|
||||||
z_max_ts = 0
|
z_max_ts = 0
|
||||||
for ts in self._timestamps:
|
for i, ts in enumerate(self._timestamps):
|
||||||
z = profile.get_ts_key(ts, "Z")
|
z = table[i, profile.global_index]
|
||||||
if z == z_max:
|
if z == z_max:
|
||||||
z_max_ts = ts
|
z_max_ts = ts
|
||||||
break
|
break
|
||||||
|
|
@ -329,16 +342,18 @@ class PlotRKC(PamhyrPlot):
|
||||||
self.update()
|
self.update()
|
||||||
|
|
||||||
def update_water_elevation(self):
|
def update_water_elevation(self):
|
||||||
results = self.results[self._current_res_id]
|
result = self.results[self._current_res_id]
|
||||||
reach = results.river.reach(self._current_reach_id)
|
reach = result.river.reach(self._current_reach_id)
|
||||||
rk = reach.geometry.get_rk()
|
rk = reach.geometry.get_rk()
|
||||||
z_min = reach.geometry.get_z_min()
|
z_min = reach.geometry.get_z_min()
|
||||||
|
table = result.get("table")["Z"]
|
||||||
|
ts = result.get_timestamp_id(self._current_timestamp)
|
||||||
|
|
||||||
water_z = list(
|
water_z = list(
|
||||||
map(
|
map(
|
||||||
lambda p: p.get_ts_key(
|
lambda p: table[
|
||||||
self._current_timestamp, "Z"
|
ts, p.global_index
|
||||||
),
|
],
|
||||||
reach.profiles
|
reach.profiles
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue