quick fix for AdisTS

ci-test
Theophile Terraz 2025-11-18 17:25:48 +01:00
parent c1905aa7e1
commit c2a8f38ef5
4 changed files with 78 additions and 6 deletions

View File

@ -50,6 +50,9 @@ class Results(object):
self._phys_var_list = ["C", "G", "M", "D", "L", "N", "R"]
if solver is not None:
self.set("solver_type", solver._type)
@property
def date(self):
date = self._meta_data["creation_date"]

View File

@ -96,6 +96,69 @@ class AdisTS(CommandLineSolver):
return lst
##########
# Export #
##########
_alph = list(
map(
chr,
chain(
range(48, 58), # 0..9
range(65, 91), # A..Z
range(97, 123) # a..z
)
)
)
_l_alph = len(_alph)
_nodes_cnt = 0
_nodes_names = {}
_nodes_views = set()
def get_reach_name(self, reach):
return f"Reach_{reach.pamhyr_id:>3}".replace(" ", "0")
def get_node_name(self, node):
"""Generate a 3 char name for node
Args:
node: The node
Returns:
A 3 char name string
"""
n = node.pamhyr_id
if n in self._nodes_names:
return self._nodes_names[n]
name = ""
checked_new = False
while not checked_new:
self._nodes_cnt += 1
nc = self._nodes_cnt
name = "".join(
map(
lambda i: self._alph[i % self._l_alph],
[
int(nc / (self._l_alph * self._l_alph)),
int(nc / self._l_alph),
nc
]
)
)
checked_new = name not in self._nodes_views
self._nodes_views.add(name)
self._nodes_names[n] = name
return name
def cmd_args(self, study):
lst = super(AdisTS, self).cmd_args(study)
return lst
@ -365,8 +428,7 @@ class AdisTSwc(AdisTS):
node = next(filter(
lambda x: x.id == BC.node, study.river._nodes
))
node_name = f"{node.id:3}".replace(" ", "x")
f.write(f"${node_name}\n")
f.write(f"${self.get_node_name(node)}\n")
if BC.type == "Concentration":
f.write(f"*temps |concentration\n")

View File

@ -1615,8 +1615,11 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
os.path.dirname(results),
name=name
)
dlg = ReadingResultsDialog(reading_fn=reading_fn, parent=self)
dlg = WaitingDialog(
payload_fn=reading_fn,
title="waiting_result",
parent=self
)
dlg.exec_()
results = self._tmp_results

View File

@ -45,6 +45,7 @@ from PyQt5.QtWidgets import (
from View.RunSolver.Log.Window import SolverLogFileWindow
from View.Results.ReadingResultsDialog import ReadingResultsDialog
from View.WaitingDialog import WaitingDialog
try:
from signal import SIGTERM, SIGSTOP, SIGCONT
@ -82,7 +83,8 @@ class SelectSolverWindowAdisTS(PamhyrDialog):
# solvers = self._config.solvers
# solvers mage
solvers = list(filter(
lambda x: "mage" not in x._type, self._config.solvers
lambda x: "mage" not in x._type and "rubar" not in x._type,
self._config.solvers
))
solvers_name = list(
map(
@ -425,7 +427,9 @@ class SolverLogWindowAdisTS(PamhyrWindow):
self._study, dir_path, qlog=self._output
)
dlg = ReadingResultsDialog(reading_fn=reading_fn, parent=self)
dlg = WaitingDialog(payload_fn=reading_fn,
title="waiting_result",
parent=self)
dlg.exec_()
self._parent.set_results(self._solver, self._results)