Commit 6852b08c authored by Theophile Terraz's avatar Theophile Terraz
Browse files

debug CI

No related merge requests found
Showing with 19 additions and 43 deletions
+19 -43
...@@ -360,26 +360,11 @@ class InitialConditions(SQLSubModel): ...@@ -360,26 +360,11 @@ class InitialConditions(SQLSubModel):
def get_discharge(self): def get_discharge(self):
return self._data_get("discharge") return self._data_get("discharge")
def _sort_by_z_and_rk(self, profiles):
profiles.sort(
reverse=False,
key=lambda p: p.rk
)
first_z = profiles[0].z()
last_z = profiles[-1].z()
if first_z > last_z:
profiles.sort(
reverse=True,
key=lambda p: p.rk
)
def generate_growing_constant_depth(self, height: float, def generate_growing_constant_depth(self, height: float,
compute_discharge: bool): compute_discharge: bool):
profiles = self._reach.reach.profiles.copy() profiles = self._reach.reach.profiles.copy()
self._sort_by_z_and_rk(profiles) profiles.reverse()
previous_elevation = -99999.99 previous_elevation = -99999.99
...@@ -433,12 +418,12 @@ class InitialConditions(SQLSubModel): ...@@ -433,12 +418,12 @@ class InitialConditions(SQLSubModel):
previous_elevation = elevation previous_elevation = elevation
self._data.append(new) self._data.append(new)
self._generate_resort_data(profiles) self._data.reverse()
def generate_discharge(self, discharge: float, compute_height: bool): def generate_discharge(self, discharge: float, compute_height: bool):
profiles = self._reach.reach.profiles.copy() profiles = self._reach.reach.profiles.copy()
self._sort_by_z_and_rk(profiles) profiles.reverse()
previous_elevation = -99999.99 previous_elevation = -99999.99
...@@ -491,7 +476,7 @@ class InitialConditions(SQLSubModel): ...@@ -491,7 +476,7 @@ class InitialConditions(SQLSubModel):
previous_elevation = elevation previous_elevation = elevation
self._data.append(new) self._data.append(new)
self._generate_resort_data(profiles) self._data.reverse()
def generate_height(self, def generate_height(self,
elevation1: float, elevation1: float,
...@@ -525,13 +510,3 @@ class InitialConditions(SQLSubModel): ...@@ -525,13 +510,3 @@ class InitialConditions(SQLSubModel):
new["discharge"] = d new["discharge"] = d
new["elevation"] = elevation new["elevation"] = elevation
self._data.append(new) self._data.append(new)
def _generate_resort_data(self, profiles):
is_reverse = False
if profiles[0].rk > profiles[-1].rk:
is_reverse = True
self._data.sort(
reverse=not is_reverse,
key=lambda d: d['rk']
)
...@@ -77,31 +77,32 @@ class PlotDRK(PamhyrPlot): ...@@ -77,31 +77,32 @@ class PlotDRK(PamhyrPlot):
rk = self.data.get_rk() rk = self.data.get_rk()
elevation = self.data.get_elevation() elevation = self.data.get_elevation()
sorted_rk, sorted_elevation = zip(
*sorted(zip(rk, elevation))
)
self.line_rk_elevation = self.canvas.axes.plot( self.line_rk_elevation = self.canvas.axes.plot(
rk, elevation, sorted_rk, sorted_elevation,
color=self.color_plot_river_water, color=self.color_plot_river_water,
**self.plot_default_kargs **self.plot_default_kargs
) )
z_min = self.data.reach.reach.get_z_min() z_min = self.data.reach.reach.get_z_min()
geometry_rk = self.data.reach.reach.get_rk() geometry_rk = self.data.reach.reach.get_rk()
sorted_geometry_rk, sorted_z_min = zip(
filtred_elevation = list( *sorted(zip(geometry_rk, z_min), reverse=True)
map(
lambda x: elevation[x[0]],
filter(
lambda x: x[1] in geometry_rk,
enumerate(rk)
)
)
) )
self.collection = self.canvas.axes.fill_between( poly_x = sorted_rk + sorted_geometry_rk
geometry_rk, z_min, filtred_elevation, poly_y = sorted_elevation + sorted_z_min
self.collection = self.canvas.axes.fill(
poly_x, poly_y,
color=self.color_plot_river_water_zone, color=self.color_plot_river_water_zone,
alpha=0.7, interpolate=True alpha=0.7,
) )
@timer @timer
def update(self, ind=None): def update(self, ind=None):
self.draw() self.draw()
...@@ -782,7 +782,7 @@ class CustomPlot(PamhyrPlot): ...@@ -782,7 +782,7 @@ class CustomPlot(PamhyrPlot):
@timer @timer
def update(self): def update(self):
#if not self._init: # if not self._init:
self.draw_update() self.draw_update()
self.draw_current() self.draw_current()
return return
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment