diff --git a/src/Meshing/Mage.py b/src/Meshing/Mage.py index 113850425f235fb96a6f59e2d9a2b70e38dfcb5e..51b425632b0acd0ecac0d1a09eae3e414bcc4e03 100644 --- a/src/Meshing/Mage.py +++ b/src/Meshing/Mage.py @@ -182,6 +182,9 @@ class MeshingWithMage(AMeshingTool): ########### def meshing(self, reach, step: float = 50): + if reach is None or len(reach.profiles) == 0: + return reach + with tempfile.TemporaryDirectory() as tmp: st_file = self.export_reach_to_st(reach, tmp) m_file = st_file.rsplit(".ST", 1)[0] + ".M" diff --git a/src/Solver/Mage.py b/src/Solver/Mage.py index 243c794f51de657cb1e2a38053f9a1a1f1142985..acd94fadefe1d842eda0632dafd763cc6cd9c7e2 100644 --- a/src/Solver/Mage.py +++ b/src/Solver/Mage.py @@ -234,7 +234,7 @@ class Mage(CommandLineSolver): def _export_BC(self, t, bounds, repertory, qlog, name="0"): files = [] - if len(bounds) == 0: + if len(bounds) == 0 or bounds.node is None: return files if qlog is not None: @@ -351,6 +351,9 @@ class Mage(CommandLineSolver): frictions = edge.frictions for friction in frictions.frictions: + if friction.begin_strickler is None: + continue + num = f"{id:>3}" bkp = f"{friction.begin_kp:>10.3f}" ekp = f"{friction.end_kp:>10.3f}" @@ -416,7 +419,7 @@ class Mage(CommandLineSolver): files = [] reservoirs = study.river.reservoir.lst - if len(reservoirs) == 0: + if len(reservoirs) == 0 or reservoirs.node is None: return files if qlog is not None: