mirror of https://gitlab.com/pamhyr/pamhyr2
AdisTS: debug results AdisTS with disabled profiles
parent
64d9e456b7
commit
9161c54e18
|
|
@ -64,13 +64,15 @@ class Profile(object):
|
||||||
|
|
||||||
|
|
||||||
class Reach(object):
|
class Reach(object):
|
||||||
def __init__(self, reach, study):
|
def __init__(self, reach, study, profiles=None):
|
||||||
self._study = study
|
self._study = study
|
||||||
self._reach = reach # Source reach in the study
|
self._reach = reach # Source reach in the study
|
||||||
|
if profiles is None:
|
||||||
|
profiles = reach.profiles
|
||||||
self._profiles = list(
|
self._profiles = list(
|
||||||
map(
|
map(
|
||||||
lambda p: Profile(p, self._study),
|
lambda p: Profile(p, self._study),
|
||||||
reach.profiles
|
profiles
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -89,6 +91,10 @@ class Reach(object):
|
||||||
def profiles(self):
|
def profiles(self):
|
||||||
return self._profiles.copy()
|
return self._profiles.copy()
|
||||||
|
|
||||||
|
def get_rk(self):
|
||||||
|
"""Return the PK values for profiles present in the results."""
|
||||||
|
return [profile.rk for profile in self._profiles]
|
||||||
|
|
||||||
def profile(self, id):
|
def profile(self, id):
|
||||||
return self._profiles[id]
|
return self._profiles[id]
|
||||||
|
|
||||||
|
|
@ -119,10 +125,10 @@ class River(object):
|
||||||
def has_reach(self, id):
|
def has_reach(self, id):
|
||||||
return 0 <= id < len(self._reachs)
|
return 0 <= id < len(self._reachs)
|
||||||
|
|
||||||
def add(self, reach_id):
|
def add(self, reach_id, profiles=None):
|
||||||
reachs = self._study.river.enable_edges()
|
reachs = self._study.river.enable_edges()
|
||||||
|
|
||||||
new = Reach(reachs[reach_id].reach, self._study)
|
new = Reach(reachs[reach_id].reach, self._study, profiles=profiles)
|
||||||
|
|
||||||
self._reachs.append(new)
|
self._reachs.append(new)
|
||||||
return new
|
return new
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ class PlotAdis(PamhyrPlot):
|
||||||
reach = self.results.river.reach(self._current_reach_id)
|
reach = self.results.river.reach(self._current_reach_id)
|
||||||
profile = reach.profile(self._current_profile_id)
|
profile = reach.profile(self._current_profile_id)
|
||||||
|
|
||||||
if reach.geometry.number_profiles == 0:
|
if len(reach) == 0:
|
||||||
self._init = False
|
self._init = False
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
@ -195,7 +195,7 @@ class PlotAdis_dx(PlotAdis):
|
||||||
def draw_data(self):
|
def draw_data(self):
|
||||||
reach = self.results.river.reach(self._current_reach_id)
|
reach = self.results.river.reach(self._current_reach_id)
|
||||||
profile = reach.profile(self._current_profile_id)
|
profile = reach.profile(self._current_profile_id)
|
||||||
x = reach.geometry.get_rk()
|
x = reach.get_rk()
|
||||||
|
|
||||||
self._lines = []
|
self._lines = []
|
||||||
for i in range(len(self._current_pol_id)):
|
for i in range(len(self._current_pol_id)):
|
||||||
|
|
@ -225,7 +225,7 @@ class PlotAdis_dx(PlotAdis):
|
||||||
reach = self.results.river.reach(self._current_reach_id)
|
reach = self.results.river.reach(self._current_reach_id)
|
||||||
profile = reach.profile(self._current_profile_id)
|
profile = reach.profile(self._current_profile_id)
|
||||||
|
|
||||||
x = reach.geometry.get_rk()
|
x = reach.get_rk()
|
||||||
|
|
||||||
for i in range(len(self._current_pol_id)):
|
for i in range(len(self._current_pol_id)):
|
||||||
pol_id = self._current_pol_id[i]
|
pol_id = self._current_pol_id[i]
|
||||||
|
|
@ -244,7 +244,7 @@ class PlotAdis_dx(PlotAdis):
|
||||||
|
|
||||||
def draw_current(self):
|
def draw_current(self):
|
||||||
reach = self.results.river.reach(self._current_reach_id)
|
reach = self.results.river.reach(self._current_reach_id)
|
||||||
rk = reach.geometry.get_rk()
|
rk = reach.get_rk()
|
||||||
|
|
||||||
self._current, = self.canvas.axes.plot(
|
self._current, = self.canvas.axes.plot(
|
||||||
[rk[self._current_profile_id], rk[self._current_profile_id]],
|
[rk[self._current_profile_id], rk[self._current_profile_id]],
|
||||||
|
|
@ -260,7 +260,7 @@ class PlotAdis_dx(PlotAdis):
|
||||||
self.canvas.axes.autoscale_view()
|
self.canvas.axes.autoscale_view()
|
||||||
self.show_current()
|
self.show_current()
|
||||||
reach = self.results.river.reach(self._current_reach_id)
|
reach = self.results.river.reach(self._current_reach_id)
|
||||||
rk = reach.geometry.get_rk()
|
rk = reach.get_rk()
|
||||||
self._current.set_data(
|
self._current.set_data(
|
||||||
[rk[self._current_profile_id], rk[self._current_profile_id]],
|
[rk[self._current_profile_id], rk[self._current_profile_id]],
|
||||||
self.canvas.axes.get_ylim()
|
self.canvas.axes.get_ylim()
|
||||||
|
|
@ -269,13 +269,13 @@ class PlotAdis_dx(PlotAdis):
|
||||||
def get_min_and_max(self):
|
def get_min_and_max(self):
|
||||||
reach = self.results.river.reach(self._current_reach_id)
|
reach = self.results.river.reach(self._current_reach_id)
|
||||||
profile = reach.profile(self._current_profile_id)
|
profile = reach.profile(self._current_profile_id)
|
||||||
x = reach.geometry.get_rk()
|
x = reach.get_rk()
|
||||||
|
|
||||||
y = [-inf]*reach.geometry.number_profiles
|
y = [-inf]*len(reach)
|
||||||
z = [inf]*reach.geometry.number_profiles
|
z = [inf]*len(reach)
|
||||||
for pol_id in self._current_pol_id:
|
for pol_id in self._current_pol_id:
|
||||||
if self.val_id[self._key] > 0 and self._type_pol[pol_id] == 1:
|
if self.val_id[self._key] > 0 and self._type_pol[pol_id] == 1:
|
||||||
for i in range(reach.geometry.number_profiles):
|
for i in range(len(reach)):
|
||||||
y[i] = max(0.0, y[i])
|
y[i] = max(0.0, y[i])
|
||||||
z[i] = min(0.0, z[i])
|
z[i] = min(0.0, z[i])
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -726,7 +726,7 @@ class ResultsWindowAdisTS(PamhyrWindow):
|
||||||
dict_x = self._trad.get_dict("values_x")
|
dict_x = self._trad.get_dict("values_x")
|
||||||
dict_y = self._trad.get_dict("values_y_pol")
|
dict_y = self._trad.get_dict("values_y_pol")
|
||||||
my_dict = {}
|
my_dict = {}
|
||||||
my_dict[dict_x["rk"]] = reach.geometry.get_rk()
|
my_dict[dict_x["rk"]] = reach.get_rk()
|
||||||
val_id = {}
|
val_id = {}
|
||||||
val_id["unit_C"] = 0
|
val_id["unit_C"] = 0
|
||||||
val_id["unit_M"] = 2
|
val_id["unit_M"] = 2
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue