Commit 4be43528 authored by Pierre-Antoine Rouby's avatar Pierre-Antoine Rouby
Browse files

Pamhyr: Fix Pep8.

Showing with 38 additions and 20 deletions
+38 -20
...@@ -298,7 +298,7 @@ class MeshingWithMageMailleurTT(AMeshingTool): ...@@ -298,7 +298,7 @@ class MeshingWithMageMailleurTT(AMeshingTool):
lplan: bool = False, lplan: bool = False,
lm: int = 3, lm: int = 3,
linear: bool = False, linear: bool = False,
origin_value = 0.0): origin_value=0.0):
if reach is None or len(reach.profiles) == 0: if reach is None or len(reach.profiles) == 0:
return reach return reach
...@@ -371,7 +371,7 @@ class MeshingWithMageMailleurTT(AMeshingTool): ...@@ -371,7 +371,7 @@ class MeshingWithMageMailleurTT(AMeshingTool):
lplan: bool = False, lplan: bool = False,
lm: int = 3, lm: int = 3,
linear: bool = False, linear: bool = False,
origin_value = 0.0): origin_value=0.0):
if reach is None or len(reach.profiles) == 0: if reach is None or len(reach.profiles) == 0:
return reach return reach
......
...@@ -583,27 +583,44 @@ class ProfileXYZ(Profile, SQLSubModel): ...@@ -583,27 +583,44 @@ class ProfileXYZ(Profile, SQLSubModel):
""" """
Remove points to keep at most np_purge points. Remove points to keep at most np_purge points.
""" """
if (self.nb_points <= np_purge):
return
if (self.nb_points <= np_purge): return nb_named = 2 # we consider the first and last point as named
nb_named = 2 # we consider the first and last point as named
area = [0.0] area = [0.0]
for i in range(1, self.nb_points-1): for i in range(1, self.nb_points-1):
if self.point(i).point_is_named(): if self.point(i).point_is_named():
area.append(9999999.999) area.append(9999999.999)
nb_named += 1 nb_named += 1
else: else:
area.append(PointXYZ.areatriangle3d(self.point(i-1),self.point(i),self.point(i+1))) area.append(
PointXYZ.areatriangle3d(
self.point(i-1),
self.point(i),
self.point(i+1))
)
area.append(0.0) area.append(0.0)
while (self.nb_points > max(np_purge, nb_named)): while self.nb_points > max(np_purge, nb_named):
to_rm = np.argmin(area[1:self.nb_points-1])+1 to_rm = np.argmin(area[1:self.nb_points - 1]) + 1
self.delete_i([to_rm]) self.delete_i([to_rm])
area.pop(to_rm) area.pop(to_rm)
for i in [to_rm-1, to_rm]: for i in [to_rm-1, to_rm]:
if (i == 0): continue if (i == 0):
if (i == self.nb_points - 1): continue continue
if (i == self.nb_points - 1):
continue
if self.point(i).point_is_named(): if self.point(i).point_is_named():
area[i] = 9999999.999 area[i] = 9999999.999
else: else:
area[i] = PointXYZ.areatriangle3d(self.point(i-1),self.point(i),self.point(i+1)) area[i] = PointXYZ.areatriangle3d(
self.point(i-1),
self.point(i),
self.point(i+1)
)
...@@ -74,8 +74,10 @@ class UpdateKPDialog(PamhyrDialog): ...@@ -74,8 +74,10 @@ class UpdateKPDialog(PamhyrDialog):
def changed_profile(self): def changed_profile(self):
origin = self.get_combobox_text("comboBox_origin") origin = self.get_combobox_text("comboBox_origin")
self.set_double_spin_box("doubleSpinBox_origin", self.set_double_spin_box(
self._reach.profile(self.profiles.index(origin)).kp) "doubleSpinBox_origin",
self._reach.profile(self.profiles.index(origin)).kp
)
@property @property
def profiles(self): def profiles(self):
......
...@@ -170,7 +170,8 @@ class InitialConditionsWindow(PamhyrWindow): ...@@ -170,7 +170,8 @@ class InitialConditionsWindow(PamhyrWindow):
self.find(QAction, "action_add").triggered.connect(self.add) self.find(QAction, "action_add").triggered.connect(self.add)
self.find(QAction, "action_del").triggered.connect(self.delete) self.find(QAction, "action_del").triggered.connect(self.delete)
self.find(QAction, "action_sort").triggered.connect(self.sort) self.find(QAction, "action_sort").triggered.connect(self.sort)
self.find(QAction, "action_import").triggered.connect(self.import_from_file) self.find(QAction, "action_import").triggered\
.connect(self.import_from_file)
self.find(QPushButton, "pushButton_generate_1").clicked.connect( self.find(QPushButton, "pushButton_generate_1").clicked.connect(
self.generate_growing_constante_height self.generate_growing_constante_height
...@@ -192,7 +193,6 @@ class InitialConditionsWindow(PamhyrWindow): ...@@ -192,7 +193,6 @@ class InitialConditionsWindow(PamhyrWindow):
return rows[0].row() return rows[0].row()
def update(self): def update(self):
self._update_plot() self._update_plot()
self._propagate_update(key=Modules.INITIAL_CONDITION) self._propagate_update(key=Modules.INITIAL_CONDITION)
......
...@@ -115,8 +115,8 @@ class PlotKPC(PamhyrPlot): ...@@ -115,8 +115,8 @@ class PlotKPC(PamhyrPlot):
lambda z, h: z - h[0], lambda z, h: z - h[0],
sl, z sl, z
), ),
z_min, # Original geometry z_min, # Original geometry
sl # Original sediment layers sl # Original sediment layers
) )
) )
...@@ -132,8 +132,8 @@ class PlotKPC(PamhyrPlot): ...@@ -132,8 +132,8 @@ class PlotKPC(PamhyrPlot):
lambda z, h: z + h[0], lambda z, h: z + h[0],
sl, z sl, z
), ),
z_br, # Bedrock elevation z_br, # Bedrock elevation
sl # Current sediment layers sl # Current sediment layers
) )
) )
......
...@@ -200,7 +200,6 @@ class PamhyrPlotToolbar(NavigationToolbar2QT): ...@@ -200,7 +200,6 @@ class PamhyrPlotToolbar(NavigationToolbar2QT):
self.icons.append(("save_figure", icon_save)) self.icons.append(("save_figure", icon_save))
def save_figure(self, *args): def save_figure(self, *args):
file_types = self.canvas.get_supported_filetypes_grouped() file_types = self.canvas.get_supported_filetypes_grouped()
default_file_type = self.canvas.get_default_filetype() default_file_type = self.canvas.get_default_filetype()
......
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