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,29 +599,50 @@ class Mage(CommandLineSolver):
if qlog is not None:
qlog.put("Export VAR file")
with mage_file_open(os.path.join(repertory, f"{name}.VAR"), "w+") as f:
files.append(f"{name}.VAR")
for hs in hydraulic_structures:
if hs.input_reach is None:
continue
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.input_reach.is_enable():
continue
for bhs in hs.basic_structures:
if not hs.enabled:
continue
for bhs in hs.basic_structures:
if bhs.enabled:
logger.info(bhs._type)
if bhs._type != "CV":
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:
files.append(f"{name}.VAR")
for hs in hydraulic_structures:
if hs.input_reach is None:
continue
name = bhs.name
if name == "":
name = f"HS_{bhs.id:>3}".replace(" ", "0")
if not hs.input_reach.is_enable():
continue
f.write(
f"${name} clapet"
)
if not hs.enabled:
continue
for bhs in hs.basic_structures:
logger.info(bhs._type)
if bhs._type != "CV":
continue
name = bhs.name
if name == "":
name = f"HS_{bhs.id:>3}".replace(" ", "0")
f.write(
f"${name} clapet"
)
return files
def _export_DEV(self, study, repertory, qlog, name="0"):

View File

@ -146,8 +146,9 @@ class PlotXY(PamhyrPlot):
return
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_max(reach)
self.draw_guide_lines(reach)
@ -156,12 +157,12 @@ class PlotXY(PamhyrPlot):
self.idle()
self._init = True
def draw_profiles(self, reach):
def draw_profiles(self, reach, reaches):
if reach.geometry.number_profiles == 0:
self._init = False
return
self.line_xy = []
# TODO uncomment to draw all the reaches
# self.draw_other_profiles(reaches)
for xy in zip(reach.geometry.get_x(),
reach.geometry.get_y()):
self.line_xy.append(np.column_stack(xy))
@ -176,6 +177,19 @@ class PlotXY(PamhyrPlot):
)
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):
x_complete = reach.geometry.get_guidelines_x()
y_complete = reach.geometry.get_guidelines_y()