debug VAR

compare_results
Theophile Terraz 2024-10-30 15:38:43 +01:00
parent 77baba0893
commit 15da23183b
4 changed files with 54 additions and 20 deletions

View File

@ -1 +0,0 @@
$Clapet_001 clapet

Binary file not shown.

View File

@ -599,6 +599,25 @@ class Mage(CommandLineSolver):
if qlog is not None: if qlog is not None:
qlog.put("Export VAR file") qlog.put("Export VAR file")
nb_cv = 0
for hs in hydraulic_structures:
if hs.input_reach is None:
continue
if not hs.input_reach.is_enable():
continue
if not hs.enabled:
continue
for bhs in hs.basic_structures:
if bhs.enabled:
logger.info(bhs._type)
if bhs._type == "CV":
nb_cv += 1
if nb_cv != 0:
with mage_file_open(os.path.join(repertory, f"{name}.VAR"), "w+") as f: with mage_file_open(os.path.join(repertory, f"{name}.VAR"), "w+") as f:
files.append(f"{name}.VAR") files.append(f"{name}.VAR")
@ -609,6 +628,9 @@ class Mage(CommandLineSolver):
if not hs.input_reach.is_enable(): if not hs.input_reach.is_enable():
continue continue
if not hs.enabled:
continue
for bhs in hs.basic_structures: for bhs in hs.basic_structures:
logger.info(bhs._type) logger.info(bhs._type)
if bhs._type != "CV": if bhs._type != "CV":
@ -621,7 +643,6 @@ class Mage(CommandLineSolver):
f.write( f.write(
f"${name} clapet" f"${name} clapet"
) )
return files return files
def _export_DEV(self, study, repertory, qlog, name="0"): def _export_DEV(self, study, repertory, qlog, name="0"):

View File

@ -146,8 +146,9 @@ class PlotXY(PamhyrPlot):
return return
reach = self.results.river.reach(self._current_reach_id) reach = self.results.river.reach(self._current_reach_id)
reaches = self.results.river.reachs
self.draw_profiles(reach) self.draw_profiles(reach, reaches)
self.draw_water_elevation(reach) self.draw_water_elevation(reach)
self.draw_water_elevation_max(reach) self.draw_water_elevation_max(reach)
self.draw_guide_lines(reach) self.draw_guide_lines(reach)
@ -156,12 +157,12 @@ class PlotXY(PamhyrPlot):
self.idle() self.idle()
self._init = True self._init = True
def draw_profiles(self, reach): def draw_profiles(self, reach, reaches):
if reach.geometry.number_profiles == 0: if reach.geometry.number_profiles == 0:
self._init = False self._init = False
return return
# TODO uncomment to draw all the reaches
self.line_xy = [] # self.draw_other_profiles(reaches)
for xy in zip(reach.geometry.get_x(), for xy in zip(reach.geometry.get_x(),
reach.geometry.get_y()): reach.geometry.get_y()):
self.line_xy.append(np.column_stack(xy)) self.line_xy.append(np.column_stack(xy))
@ -176,6 +177,19 @@ class PlotXY(PamhyrPlot):
) )
self.canvas.axes.add_collection(self.line_xy_collection) self.canvas.axes.add_collection(self.line_xy_collection)
def draw_other_profiles(self, reaches):
for reach in reaches:
for xy in zip(reach.geometry.get_x(),
reach.geometry.get_y()):
self.line_xy.append(np.column_stack(xy))
self.line_xy_collection = collections.LineCollection(
self.line_xy,
colors=self.color_plot_river_bottom,
)
self.canvas.axes.add_collection(self.line_xy_collection)
def draw_guide_lines(self, reach): def draw_guide_lines(self, reach):
x_complete = reach.geometry.get_guidelines_x() x_complete = reach.geometry.get_guidelines_x()
y_complete = reach.geometry.get_guidelines_y() y_complete = reach.geometry.get_guidelines_y()