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

Geometry: Remove some warning when profile not fully defined.

Showing with 25 additions and 8 deletions
+25 -8
...@@ -63,13 +63,19 @@ class PlotAC(PamhyrPlot): ...@@ -63,13 +63,19 @@ class PlotAC(PamhyrPlot):
if self.data.number_profiles == 0: if self.data.number_profiles == 0:
return return
np = len(self.data.profiles)
if np < 2:
return
selected_profile = 0 selected_profile = 0
station = self.data.profile(selected_profile).get_station() station = self.data.profile(selected_profile).get_station()
station_plus_1 = self.data.profile(selected_profile + 1).get_station()
elevation = self.data.profile(selected_profile).z() elevation = self.data.profile(selected_profile).z()
elevation_i_plus_1 = self.data.profile(selected_profile + 1).z()
gl = self.data.profile(selected_profile).names() gl = self.data.profile(selected_profile).names()
station_plus_1 = self.data.profile(selected_profile + 1).get_station()
elevation_i_plus_1 = self.data.profile(selected_profile + 1).z()
self.canvas.axes.set_xlabel( self.canvas.axes.set_xlabel(
_translate("MainWindow_reach", "Transverse abscissa (m)"), _translate("MainWindow_reach", "Transverse abscissa (m)"),
color='black', fontsize=10 color='black', fontsize=10
......
...@@ -62,6 +62,17 @@ class PlotKPZ(PamhyrPlot): ...@@ -62,6 +62,17 @@ class PlotKPZ(PamhyrPlot):
if self.data.number_profiles == 0: if self.data.number_profiles == 0:
return return
profiles_defined = any(
filter(
lambda profile: len(profile.x()) > 0,
self.data.profiles
)
)
if not profiles_defined:
self._init = False
return
self.canvas.axes.set_xlabel( self.canvas.axes.set_xlabel(
_translate("MainWindow_reach", "Kp (m)"), _translate("MainWindow_reach", "Kp (m)"),
color='black', fontsize=10 color='black', fontsize=10
...@@ -75,9 +86,9 @@ class PlotKPZ(PamhyrPlot): ...@@ -75,9 +86,9 @@ class PlotKPZ(PamhyrPlot):
z_min = self.data.get_z_min() z_min = self.data.get_z_min()
z_max = self.data.get_z_max() z_max = self.data.get_z_max()
self.canvas.axes.set_xlim( # self.canvas.axes.set_xlim(
left=min(kp), right=max(kp) # left=min(kp), right=max(kp)
) # )
self.line_kp_zmin_zmax = self.canvas.axes.vlines( self.line_kp_zmin_zmax = self.canvas.axes.vlines(
x=kp, x=kp,
......
...@@ -74,9 +74,9 @@ class PlotXY(PamhyrPlot): ...@@ -74,9 +74,9 @@ class PlotXY(PamhyrPlot):
self.canvas.axes.axis("equal") self.canvas.axes.axis("equal")
kp = self.data.get_kp() kp = self.data.get_kp()
self.canvas.axes.set_xlim( # self.canvas.axes.set_xlim(
left=min(kp), right=max(kp) # left=min(kp), right=max(kp)
) # )
# Draw line for each profile # Draw line for each profile
self.line_xy = [ self.line_xy = [
......
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