Geometry: Remove some warning when profile not fully defined.

setup.py
Pierre-Antoine Rouby 2024-01-16 09:05:27 +01:00
parent 0ace259d2d
commit cf53985fed
3 changed files with 25 additions and 8 deletions

View File

@ -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

View File

@ -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):
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,

View File

@ -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 = [