diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c4172794..2813dde7 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -638,7 +638,7 @@ shadow-release:
- job: pkg-hash
artifacts: true
rules:
- - if: $CI_COMMIT_BRANCH != 'master' && $CI_COMMIT_TAG
+ - if: $CI_COMMIT_TAG && $CI_COMMIT_TAG !~ /^v/
artifacts:
paths:
- linux/pamhyr-gnulinux.tar.xz
@@ -672,7 +672,7 @@ tag-release:
- job: pkg-hash
artifacts: true
rules:
- - if: $CI_COMMIT_BRANCH == 'master' && $CI_COMMIT_TAG
+ - if: $CI_COMMIT_TAG =~ /^v/
artifacts:
paths:
- linux/pamhyr-gnulinux.tar.xz
diff --git a/src/Meshing/Internal.py b/src/Meshing/Internal.py
index eacd04b4..c5999fb1 100644
--- a/src/Meshing/Internal.py
+++ b/src/Meshing/Internal.py
@@ -166,7 +166,6 @@ class InternalMeshing(AMeshingTool):
for i in range(len1):
ltot1 += sect1.point(start1+i).dist(sect1.point(start1+i+1))
alpha.append(ltot1)
- alpha = list(map(lambda x: x/ltot1, alpha)) # target ratios
for i in range(len2):
ltot2 += sect2.point(start2+i).dist(sect2.point(start2+i+1))
beta.append(ltot2)
@@ -181,6 +180,7 @@ class InternalMeshing(AMeshingTool):
sect2.add_npoints(len1-len2)
len2 = len1
else: # regular case
+ alpha = list(map(lambda x: x/ltot1, alpha)) # target ratios
beta = list(map(lambda x: x/ltot2, beta)) # current ratios
for i in range(len1 - len2):
beta.append(1.0)
diff --git a/src/Model/BoundaryCondition/BoundaryCondition.py b/src/Model/BoundaryCondition/BoundaryCondition.py
index 433da557..fdc9c0a5 100644
--- a/src/Model/BoundaryCondition/BoundaryCondition.py
+++ b/src/Model/BoundaryCondition/BoundaryCondition.py
@@ -514,42 +514,6 @@ class BoundaryCondition(SQLSubModel):
self._sigma = float(value)
self.modified()
- @property
- def d50(self):
- return self._d50
-
- @d50.setter
- def d50(self, value):
- self._d50 = float(value)
- self.modified()
-
- @property
- def sigma(self):
- return self._sigma
-
- @sigma.setter
- def sigma(self, value):
- self._sigma = float(value)
- self.modified()
-
- @property
- def d50(self):
- return self._d50
-
- @d50.setter
- def d50(self, value):
- self._d50 = float(value)
- self.modified()
-
- @property
- def sigma(self):
- return self._sigma
-
- @sigma.setter
- def sigma(self, value):
- self._sigma = float(value)
- self.modified()
-
@property
def header(self):
return self._header.copy()
diff --git a/src/Model/Pollutants/Pollutants.py b/src/Model/Pollutants/Pollutants.py
index e1cf72d3..55408b8d 100644
--- a/src/Model/Pollutants/Pollutants.py
+++ b/src/Model/Pollutants/Pollutants.py
@@ -350,6 +350,7 @@ class Pollutants(SQLSubModel):
CREATE TABLE pollutants{ext}(
{cls.create_db_add_pamhyr_id()},
deleted BOOLEAN NOT NULL DEFAULT FALSE,
+ enabled BOOLEAN NOT NULL DEFAULT TRUE,
name TEXT NOT NULL,
{Scenario.create_db_add_scenario()},
{Scenario.create_db_add_scenario_fk()}
@@ -373,6 +374,14 @@ class Pollutants(SQLSubModel):
cls._db_create(execute)
created = True
+ if major == "0" and minor == "2":
+ if int(release) < 6:
+ execute(f"ALTER TABLE pollutants " +
+ f"ADD COLUMN enabled BOOLEAN NOT NULL DEFAULT TRUE")
+
+ # cls._db_update_to_0_2_5(execute, data)
+ # # created = True
+
if not created:
return cls._update_submodel(execute, version, data)
@@ -410,7 +419,8 @@ class Pollutants(SQLSubModel):
return new
table = execute(
- "SELECT pamhyr_id, deleted, name, scenario FROM pollutants " +
+ "SELECT pamhyr_id, deleted, enabled, name, scenario " +
+ "FROM pollutants " +
f"WHERE scenario = {scenario.id} " +
f"AND pamhyr_id NOT IN ({', '.join(map(str, loaded))})"
)
@@ -421,6 +431,7 @@ class Pollutants(SQLSubModel):
pid = next(it)
deleted = (next(it) == 1)
+ enabled = (next(it) == 1)
name = next(it)
owner_scenario = next(it)
@@ -431,6 +442,8 @@ class Pollutants(SQLSubModel):
)
if deleted:
new_pollutant.set_as_deleted()
+ if not enabled:
+ new_pollutant.enabled = False
data["pollutant"] = new_pollutant
new_pollutant._data = PollutantCharacteristics._db_load(
@@ -472,9 +485,10 @@ class Pollutants(SQLSubModel):
execute(
"INSERT INTO " +
- "pollutants(pamhyr_id, deleted, name, scenario) " +
+ "pollutants(pamhyr_id, deleted, enabled, name, scenario) " +
"VALUES (" +
f"{self.id}, {self._db_format(self.is_deleted())}, " +
+ f"{self._db_format(self._enabled)}, " +
f"'{self._db_format(self._name)}', " +
f"{self._status.scenario_id}" +
")"
diff --git a/src/Model/Study.py b/src/Model/Study.py
index 05a04a9c..2be1069c 100644
--- a/src/Model/Study.py
+++ b/src/Model/Study.py
@@ -46,7 +46,7 @@ logger = logging.getLogger()
class Study(SQLModel):
- _version = "0.2.5"
+ _version = "0.2.6"
_sub_classes = [
Scenario,
diff --git a/src/Solver/AdisTS.py b/src/Solver/AdisTS.py
index 76f063d3..309153a7 100644
--- a/src/Solver/AdisTS.py
+++ b/src/Solver/AdisTS.py
@@ -280,8 +280,8 @@ class AdisTS(CommandLineSolver):
name = f"Reach_{e.id + 1:>3}".replace(" ", "0")
id = name
- n1 = f"{e.node1.id:3}".replace(" ", "x")
- n2 = f"{e.node2.id:3}".replace(" ", "x")
+ n1 = f"{self.get_node_name(e.node1):3}".replace(" ", "x")
+ n2 = f"{self.get_node_name(e.node2):3}".replace(" ", "x")
file = os.path.join("net", name + ".ST")
f.write(f"{id} {n1} {n2} {file}\n")
@@ -455,47 +455,6 @@ class AdisTS(CommandLineSolver):
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
-
- # print("node name id: ", n)
-
- # 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
-
#################################
# Adis-TS in weak coupling mode #
#################################
diff --git a/src/View/Geometry/PlotAC.py b/src/View/Geometry/PlotAC.py
index 1b846c5b..9e7127d4 100644
--- a/src/View/Geometry/PlotAC.py
+++ b/src/View/Geometry/PlotAC.py
@@ -143,7 +143,7 @@ class PlotAC(PamhyrPlot):
]
else:
color = self.color_incomplete_gl[
- lincomplete.index(txt)
+ lincomplete.index(txt) % len(self.color_incomplete_gl)
]
annotation = self.canvas.axes.annotate(
diff --git a/src/View/Geometry/Translate.py b/src/View/Geometry/Translate.py
index 3a2528af..879022eb 100644
--- a/src/View/Geometry/Translate.py
+++ b/src/View/Geometry/Translate.py
@@ -97,3 +97,15 @@ class GeometryTranslate(MainTranslate):
self._dict["format_not_exportable"] = _translate(
"Geometry", "The format of the file is not exportable."
)
+ self._dict["update_rk_error"] = _translate(
+ "Geometry",
+ "RK update can't be executed."
+ )
+ self._dict["update_rk_empty_profiles"] = _translate(
+ "Geometry",
+ "Some profiles don't contain any point."
+ )
+ self._dict["update_rk_empty_profiles_info"] = _translate(
+ "Geometry",
+ "Profiles concerned:"
+ )
diff --git a/src/View/Geometry/Window.py b/src/View/Geometry/Window.py
index 2744c190..6eadc4d3 100644
--- a/src/View/Geometry/Window.py
+++ b/src/View/Geometry/Window.py
@@ -371,6 +371,29 @@ class GeometryWindow(PamhyrWindow):
parent=self
)
if dlg.exec():
+ empty_profiles = [
+ profile for profile in self._reach.profiles
+ if profile.number_points == 0
+ ]
+ if empty_profiles:
+ profile_names = ", ".join(
+ profile.name or str(profile.num)
+ for profile in empty_profiles
+ )
+ self.message_box(
+ (
+ self._trad["update_rk_error"] +
+ "\n" +
+ self._trad["update_rk_empty_profiles"]
+ ),
+ (
+ self._trad["update_rk_empty_profiles_info"] +
+ f" {profile_names}"
+ ),
+ window_title=self._trad["warning"]
+ )
+ return
+
data = {
"origin": dlg.origin,
"directrices": [dlg.begin_dir, dlg.end_dir],
diff --git a/src/View/Pollutants/Table.py b/src/View/Pollutants/Table.py
index 994f2089..f1de40dd 100644
--- a/src/View/Pollutants/Table.py
+++ b/src/View/Pollutants/Table.py
@@ -128,7 +128,7 @@ class TableModel(PamhyrTableModel):
def enabled(self, row, enabled, parent=QModelIndex()):
self._undo.push(
SetEnabledCommand(
- self._data._Pollutants, row, enabled
+ self._lst, row, enabled
)
)
self.layoutChanged.emit()
diff --git a/src/View/Results/ReadingResultsDialog.py b/src/View/Results/ReadingResultsDialog.py
index 4d260844..4461bc8c 100644
--- a/src/View/Results/ReadingResultsDialog.py
+++ b/src/View/Results/ReadingResultsDialog.py
@@ -53,7 +53,7 @@ class Worker(QObject):
class ReadingResultsDialog(PamhyrDialog):
- _pamhyr_ui = "DialogReadingResults"
+ _pamhyr_ui = "WaitingDialog"
_pamhyr_name = "Reading results"
_spin = ["-", "\\", "|", "/"]
diff --git a/src/View/RunSolver/WindowAdisTS.py b/src/View/RunSolver/WindowAdisTS.py
index 47c7c803..1c162760 100644
--- a/src/View/RunSolver/WindowAdisTS.py
+++ b/src/View/RunSolver/WindowAdisTS.py
@@ -474,10 +474,10 @@ class SolverLogWindowAdisTS(PamhyrWindow):
self._solver.has_results_loaded()
def resultsMage(self):
+ mage_solver = next(filter(
+ lambda x: x._name == self._mage_rep, self._config.solvers
+ ))
if self._results_mage is None:
- mage_solver = next(filter(
- lambda x: x._name == self._mage_rep, self._config.solvers
- ))
workdir_mage = self._workdir_mage
def reading_fn():
diff --git a/src/lang/fr.ts b/src/lang/fr.ts
index bce458b1..bd8a71bd 100644
--- a/src/lang/fr.ts
+++ b/src/lang/fr.ts
@@ -771,12 +771,12 @@ Cette fonctionnalité nécessite un bief muni d'une géométrie.
Dernière modification :
-
+
X axis:
Axe X :
-
+
Y axis:
Axe Y :
@@ -943,12 +943,12 @@ Cette fonctionnalité nécessite un bief muni d'une géométrie.
Upstream height (m)
- Cote à l'amont (m)
+ Cote à l'amont (m)
Downstream height (m)
- Cote à l'aval (m)
+ Cote à l'aval (m)
@@ -991,7 +991,7 @@ Cette fonctionnalité nécessite un bief muni d'une géométrie.
Débit (m³/s)
-
+
Pollutant:
Polluant:
@@ -1040,6 +1040,21 @@ Cette fonctionnalité nécessite un bief muni d'une géométrie.
Image coordinates
Coordonnées de l'image
+
+
+ TextLabel
+
+
+
+
+ Upstream elevation (m)
+
+
+
+
+ Downstream elevation (m)
+
+
Documentation
@@ -1557,12 +1572,33 @@ Cette fonctionnalité nécessite un bief muni d'une géométrie.
Warning
- Avertissement
+ Avertissement
The format of the file is not exportable.
-
+ Le format de fichier n'est pas exportable.
+
+
+
+ RK update can't be executed
+Some profiles don't contain any point.
+ La mise à jour du PK ne peut pas être exécutée\nDes profils ne contiennent aucun points.
+
+
+
+ Profiles concerned:
+ Profils concernés:
+
+
+
+ RK update can't be executed.
+ La mise à jour du PK ne peut pas être exécutée.
+
+
+
+ Some profiles don't contain any point.
+ Des profils ne contiennent aucun points.
@@ -1647,12 +1683,12 @@ Cette fonctionnalité nécessite un bief muni d'une géométrie.
Évaporation
-
+
Start (m)
PK de départ (m)
-
+
End (m)
PK de fin (m)
@@ -1674,13 +1710,18 @@ Cette fonctionnalité nécessite un bief muni d'une géométrie.
Shapefile (*.LAT *.lat)
- Shapefile (*.LAT *.lat)
+ Shapefile (*.LAT *.lat)
-
+
All files (*)
Tous les fichiers (*)
+
+
+ Mage lateral contributions file (*.LAT *.lat)
+
+
LateralContributionAdisTS
@@ -2858,32 +2899,32 @@ Cette fonctionnalité nécessite un bief muni d'une géométrie.
AdisTS
-
+
Output RK
Pk de sortie
-
+
Run AdisTS
Lancer AdisTS
-
+
Pollutants
Polluants
-
+
D90
D90
-
+
DIF
DIF
-
+
Open results AdisTS
Ouvrir des résultats AdisTS
@@ -3008,7 +3049,7 @@ Cette fonctionnalité nécessite un bief muni d'une géométrie.
Non
-
+
Compare results
Comparaison de résultats
@@ -3168,7 +3209,7 @@ Cette fonctionnalité nécessite un bief muni d'une géométrie.
Editer l'arbre des scénarios
-
+
GeoTIFF
GeoTIFF
@@ -3432,22 +3473,22 @@ Cette fonctionnalité nécessite un bief muni d'une géométrie.
Results
-
+
days
jours
-
+
day
jour
-
+
X (m)
X (m)
-
+
Y (m)
Y (m)
@@ -3477,7 +3518,7 @@ Cette fonctionnalité nécessite un bief muni d'une géométrie.
Lecture des résultats
-
+
Water elevation
Cote de l'eau
@@ -3487,12 +3528,12 @@ Cette fonctionnalité nécessite un bief muni d'une géométrie.
Cote maximum de l'eau
-
+
Reach name
Nom du bief
-
+
Profile
Profil
@@ -3547,12 +3588,12 @@ Cette fonctionnalité nécessite un bief muni d'une géométrie.
Masse min
-
+
Variables names
Noms des variables
-
+
Pollutant name
Nom des polluants
@@ -3562,7 +3603,7 @@ Cette fonctionnalité nécessite un bief muni d'une géométrie.
enveloppe
-
+
Profile name
Nom du profil
@@ -3591,6 +3632,16 @@ Cette fonctionnalité nécessite un bief muni d'une géométrie.
All files (*)
Tous les fichiers (*)
+
+
+ An error occured when writing to file
+
+
+
+
+ If the file is in use, close it and try again
+
+
Scenarios