AdisTS: debug results AdisTS with disabled profiles

new_design_pol
Dylan Jeannin 2026-09-02 12:49:49 +02:00
parent 64d9e456b7
commit 9161c54e18
3 changed files with 20 additions and 14 deletions

View File

@ -64,13 +64,15 @@ class Profile(object):
class Reach(object):
def __init__(self, reach, study):
def __init__(self, reach, study, profiles=None):
self._study = study
self._reach = reach # Source reach in the study
if profiles is None:
profiles = reach.profiles
self._profiles = list(
map(
lambda p: Profile(p, self._study),
reach.profiles
profiles
)
)
@ -89,6 +91,10 @@ class Reach(object):
def profiles(self):
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):
return self._profiles[id]
@ -119,10 +125,10 @@ class River(object):
def has_reach(self, id):
return 0 <= id < len(self._reachs)
def add(self, reach_id):
def add(self, reach_id, profiles=None):
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)
return new

View File

@ -106,7 +106,7 @@ class PlotAdis(PamhyrPlot):
reach = self.results.river.reach(self._current_reach_id)
profile = reach.profile(self._current_profile_id)
if reach.geometry.number_profiles == 0:
if len(reach) == 0:
self._init = False
return
@ -195,7 +195,7 @@ class PlotAdis_dx(PlotAdis):
def draw_data(self):
reach = self.results.river.reach(self._current_reach_id)
profile = reach.profile(self._current_profile_id)
x = reach.geometry.get_rk()
x = reach.get_rk()
self._lines = []
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)
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)):
pol_id = self._current_pol_id[i]
@ -244,7 +244,7 @@ class PlotAdis_dx(PlotAdis):
def draw_current(self):
reach = self.results.river.reach(self._current_reach_id)
rk = reach.geometry.get_rk()
rk = reach.get_rk()
self._current, = self.canvas.axes.plot(
[rk[self._current_profile_id], rk[self._current_profile_id]],
@ -260,7 +260,7 @@ class PlotAdis_dx(PlotAdis):
self.canvas.axes.autoscale_view()
self.show_current()
reach = self.results.river.reach(self._current_reach_id)
rk = reach.geometry.get_rk()
rk = reach.get_rk()
self._current.set_data(
[rk[self._current_profile_id], rk[self._current_profile_id]],
self.canvas.axes.get_ylim()
@ -269,13 +269,13 @@ class PlotAdis_dx(PlotAdis):
def get_min_and_max(self):
reach = self.results.river.reach(self._current_reach_id)
profile = reach.profile(self._current_profile_id)
x = reach.geometry.get_rk()
x = reach.get_rk()
y = [-inf]*reach.geometry.number_profiles
z = [inf]*reach.geometry.number_profiles
y = [-inf]*len(reach)
z = [inf]*len(reach)
for pol_id in self._current_pol_id:
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])
z[i] = min(0.0, z[i])
else:

View File

@ -726,7 +726,7 @@ class ResultsWindowAdisTS(PamhyrWindow):
dict_x = self._trad.get_dict("values_x")
dict_y = self._trad.get_dict("values_y_pol")
my_dict = {}
my_dict[dict_x["rk"]] = reach.geometry.get_rk()
my_dict[dict_x["rk"]] = reach.get_rk()
val_id = {}
val_id["unit_C"] = 0
val_id["unit_M"] = 2