diff --git a/doc/users/Tuto1/data/Hogneau.var b/doc/users/Tuto1/data/Hogneau.var deleted file mode 100644 index 33b537e6c6158f88fcada099b1debb469a5abcf3..0000000000000000000000000000000000000000 --- a/doc/users/Tuto1/data/Hogneau.var +++ /dev/null @@ -1 +0,0 @@ -$Clapet_001 clapet \ No newline at end of file diff --git a/doc/users/Tuto1/step3.pamhyr b/doc/users/Tuto1/step3.pamhyr index 00a39e3a44170e11157d417d529b9238a17d726a..49eb6beed088718d3dee8f1777f2e0e3fec52904 100644 Binary files a/doc/users/Tuto1/step3.pamhyr and b/doc/users/Tuto1/step3.pamhyr differ diff --git a/src/Solver/Mage.py b/src/Solver/Mage.py index daf5c4e7532253bccfc4d354b9d972dedb1547ff..98eb0bcab2139531938e93b9f159a713d546b0b0 100644 --- a/src/Solver/Mage.py +++ b/src/Solver/Mage.py @@ -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 + + if not hs.enabled: + continue - for bhs in hs.basic_structures: + 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"): diff --git a/src/View/Results/PlotXY.py b/src/View/Results/PlotXY.py index 8ae76c040ed98add1de2f862bce7fe75b2165785..615e96d5b8f6ee66dab203789de4611c132241f9 100644 --- a/src/View/Results/PlotXY.py +++ b/src/View/Results/PlotXY.py @@ -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()