Compare commits

...

27 Commits

Author SHA1 Message Date
Theophile Terraz 7ef41ad886 optimize results visu 2026-03-06 11:12:43 +01:00
Theophile Terraz ada396f26d debug 2026-03-05 16:46:22 +01:00
Theophile Terraz 674247db09 add talweg in update_rk 2026-03-04 11:14:05 +01:00
Theophile Terraz 5fecd29666 Claude François 2026-02-26 16:57:42 +01:00
Theophile Terraz 71e1324a0f debug open results from file 2026-02-24 17:19:59 +01:00
Theophile Terraz 07cae542b0 pep8 2026-02-24 09:18:47 +01:00
Theophile Terraz b693f67b99 debug RubarBE 2026-02-24 09:15:31 +01:00
Theophile Terraz 18a3d51d75 add adists with rubar3 + rubar3 in release 2026-02-23 10:46:05 +01:00
Theophile Terraz 118a39bd5c debug Rubar3 (from scenario branch) 2026-02-09 14:24:09 +01:00
Theophile Terraz 2009e8223b debug adists view 2026-01-30 11:32:06 +01:00
Theophile Terraz bdaa38ea5c Merge branch 'master' of gitlab.com:pamhyr/pamhyr2 2026-01-13 08:58:46 +01:00
Lionel Pénard 713732b1dd Fix doc links in README 2026-01-12 11:03:56 +01:00
Theophile Terraz f053539cdd debug 2025-12-19 11:29:02 +01:00
Theophile Terraz fc6916bb3e lot of debug 2025-12-12 14:18:09 +01:00
Theophile Terraz 97c26cb4fb debug HS 2025-12-12 11:33:13 +01:00
Theophile Terraz 10c98bb96e release for Jerome 2025-12-09 14:25:38 +01:00
Theophile Terraz 7c2d9891d0 debug IC 2025-12-05 16:51:39 +01:00
Theophile Terraz 3c3ac1f1df pep8 2025-12-05 10:19:43 +01:00
Theophile Terraz 80af278a0f add label in custom export results 2025-12-05 10:18:38 +01:00
Theophile Terraz f254eaee25 debug adists 2025-12-02 09:31:07 +01:00
Theophile Terraz 5adb0bdee5 debug GL in resluts 2025-11-28 15:31:07 +01:00
Theophile Terraz 64c99d46d4 debug named points in meshed profiles 2025-11-28 14:12:06 +01:00
Theophile Terraz 0f0defb36f Revert "debug ci"
This reverts commit 1e1ee67d4b.
2025-11-27 16:10:00 +01:00
Theophile Terraz 1e1ee67d4b debug ci 2025-11-27 16:03:09 +01:00
Theophile Terraz 5bc514c565 pep8 2025-11-26 11:58:58 +01:00
Theophile Terraz 1da3461dfe debug meshing 2025-11-26 11:16:19 +01:00
Theophile Terraz dd5eecb1e2 pep8 2025-11-24 15:18:28 +01:00
55 changed files with 1272 additions and 453 deletions

View File

@ -31,6 +31,7 @@ stages:
variables:
MAGE_8_VERSION: "permalink/latest"
ADISTS_VERSION: "permalink/latest"
RUBAR_VERSION: "permalink/latest"
dl-mage8-doc:
stage: downloads
@ -104,6 +105,37 @@ dl-adists-windows:
paths:
- adists-windows/adists.exe
dl-rubar-linux:
stage: downloads
tags:
- linux
rules:
- if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG
script:
- mkdir -p rubar-linux
- cd rubar-linux
- curl -L -o rubar.tgz https://forge.inrae.fr/river-hydraulics/rubarbe/-/releases/$RUBAR_VERSION/downloads/packages/rubar_linux.tgz
- tar xf rubar.tgz
artifacts:
paths:
- rubar-linux/rubarbe
dl-rubar-windows:
stage: downloads
tags:
- linux
rules:
- if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG
script:
- mkdir -p rubar-windows
- cd rubar-windows
- curl -L -o rubar.tgz https://forge.inrae.fr/river-hydraulics/rubarbe/-/releases/$RUBAR_VERSION/downloads/packages/rubar_windows.tgz
- tar xf rubar.tgz
artifacts:
paths:
- rubar-windows/rubarbe.exe
#############
# CONFIGURE #
#############
@ -266,6 +298,8 @@ build-linux:
needs:
- job: dl-adists-linux
artifacts: true
- job: dl-rubar-linux
artifacts: true
- job: dl-mage8-linux
artifacts: true
- job: dl-mage8-doc
@ -307,6 +341,9 @@ build-linux:
# Copy adists
- mkdir -p pamhyr/adists
- cp -v ../adists-linux/* pamhyr/adists/
# Copy rubar
- mkdir -p pamhyr/rubar
- cp -v ../rubar-linux/* pamhyr/rubar/
# Copy Pamhyr
- cp -r dist/pamhyr/* pamhyr/
# Pamhyr script to force x11
@ -372,6 +409,8 @@ build-windows:
artifacts: true
- job: dl-adists-windows
artifacts: true
- job: dl-rubar-windows
artifacts: true
- job: dl-mage8-doc
artifacts: true
- job: set-version

View File

@ -3,7 +3,7 @@
Pamhyr is a free and open source graphical user interface for 1D hydro-sedimentary
modelling of rivers.
![logo](https://gitlab.irstea.fr/theophile.terraz/pamhyr/-/raw/master/src/View/ui/ressources/Pamhyr2_logo.png)
![logo](https://gitlab.com/pamhyr/pamhyr2/-/raw/master/src/View/ui/ressources/Pamhyr2_logo.png)
## Features
@ -20,9 +20,9 @@ modelling of rivers.
+ Run Mage 8 on a study and visualize results
Let see the
[documentation](https://gitlab.irstea.fr/theophile.terraz/pamhyr/-/wikis/home)
([:fr:](https://gitlab.irstea.fr/theophile.terraz/pamhyr/-/wikis/home-fr),
[:gb:](https://gitlab.irstea.fr/theophile.terraz/pamhyr/-/wikis/home-en))
[documentation](https://gitlab.com/pamhyr/pamhyr2/-/wikis/home)
([:fr:](https://gitlab.com/pamhyr/pamhyr2/-/wikis/home-fr),
[:gb:](https://gitlab.com/pamhyr/pamhyr2/-/wikis/home-en))
for more details.
## Install
@ -30,11 +30,11 @@ for more details.
### GNU/Linux
See documentation:
- [French :fr:](https://gitlab.irstea.fr/theophile.terraz/pamhyr/-/wikis/home/fr/Install%20on%20GNULinux)
- [English :gb:](https://gitlab.irstea.fr/theophile.terraz/pamhyr/-/wikis/home/en/Install%20on%20GNULinux)
- [French :fr:](https://gitlab.com/pamhyr/pamhyr2/-/wikis/home/fr/Install%20on%20GNULinux)
- [English :gb:](https://gitlab.com/pamhyr/pamhyr2/-/wikis/home/en/Install%20on%20GNULinux)
### Windows
See documentation:
- [French :fr:](https://gitlab.irstea.fr/theophile.terraz/pamhyr/-/wikis/home/fr/Install%20on%20Windows)
- [English :gb:](https://gitlab.irstea.fr/theophile.terraz/pamhyr/-/wikis/home/en/Install%20on%20Windows)
- [French :fr:](https://gitlab.com/pamhyr/pamhyr2/-/wikis/home/fr/Install%20on%20Windows)
- [English :gb:](https://gitlab.com/pamhyr/pamhyr2/-/wikis/home/en/Install%20on%20Windows)

View File

@ -46,6 +46,10 @@ copy /y ..\mage8-windows\mage_extraire.exe pamhyr\mage8\
copy /y ..\mage8-windows\mailleurTT.exe pamhyr\mage8\
copy /y ..\mage8-windows\libbief.dll pamhyr\mage8\
rem rubar
mkdir pamhyr\rubar
copy /y ..\rubar-windows\rubarbe.exe pamhyr\rubar\
rem adists
mkdir pamhyr\adists
copy /y ..\adists-windows\adists.exe pamhyr\adists\

View File

@ -63,8 +63,6 @@ class InternalMeshing(AMeshingTool):
gl = reach.compute_guidelines()
profiles = reach.profiles[limites[0]:limites[1]+1]
print(profiles)
# we make sure that the lines are in the left-to-right order
guide_list = [
x.name
@ -72,38 +70,30 @@ class InternalMeshing(AMeshingTool):
if x.name in gl[0]
]
gl1 = [""] + guide_list
gl2 = guide_list + [""]
max_values = [0] * (len(guide_list) + 1)
max_values_index = [0] * (len(guide_list) + 1)
guide_list = ["un"] + guide_list + ["np"]
max_values = [0] * (len(guide_list) - 1)
max_values_index = [0] * (len(guide_list) - 1)
# we work between each couple of guidelines
for j, p in enumerate(profiles):
index1 = 0
index2 = p.named_point_index(guide_list[0])
if index2 - index1 > max_values[0]:
max_values[0] = index2 - index1
max_values_index[0] = j
for i in range(len(guide_list) - 1):
index1 = p.named_point_index(guide_list[i])
index2 = p.named_point_index(guide_list[i+1])
if index2 - index1 > max_values[i + 1]:
max_values[i + 1] = index2 - index1
max_values_index[i + 1] = j
index1 = p.named_point_index(guide_list[-1])
index2 = len(p) - 1
if index2 - index1 > max_values[-1]:
max_values[-1] = index2 - index1
max_values_index[-1] = j
if index2 - index1 > max_values[i]:
max_values[i] = index2 - index1
max_values_index[i] = j
for i in range(len(max_values)):
for isect in range(max_values_index[i], len(profiles)-1):
self.compl_sect(profiles[isect],
profiles[isect+1],
gl1[i], gl2[i])
guide_list[i],
guide_list[i+1])
for isect in reversed(range(0, max_values_index[i])):
self.compl_sect(profiles[isect+1],
profiles[isect],
gl1[i], gl2[i])
guide_list[i],
guide_list[i+1])
def interpolate_transversal_step(self,
reach,
@ -112,8 +102,8 @@ class InternalMeshing(AMeshingTool):
# calcul number of intermediate profiles
np = []
for i in range(limites[0], limites[1]):
np.append(int((reach.profiles[i+1].rk -
reach.profiles[i].rk) / step) - 1)
np.append(int(abs(reach.profiles[i+1].rk -
reach.profiles[i].rk) / step) - 1)
if np[-1] < 0:
np[-1] = 0
@ -124,11 +114,13 @@ class InternalMeshing(AMeshingTool):
d = 1.0/float(np[i]+1)
ptr0 = ptr
for j in range(np[i]):
p = reach.profiles[ptr0].copy()
p = ProfileXYZ(reach=reach, status=reach._status)
# RATIO entre les deux sections initiales
dj = float(j+1)*d
ptr += 1 # next profile, original
for k in range(len(reach.profiles[ptr0].points)):
p.add()
p.points[k].name = reach.profiles[ptr0].points[k].name
p.points[k].x = reach.profiles[ptr0].points[k].x + \
dj*(reach.profiles[ptr].points[k].x -
reach.profiles[ptr0].points[k].x)
@ -153,19 +145,11 @@ class InternalMeshing(AMeshingTool):
# len1 and 2: number of intervals
# len1: target len
if tag1 == '': # left end point
start1 = 0
start2 = 0
else:
start1 = sect1.named_point_index(tag1)
start2 = sect2.named_point_index(tag1)
start1 = sect1.named_point_index(tag1)
start2 = sect2.named_point_index(tag1)
if tag2 == '': # right end point
end1 = sect1.nb_points-1
end2 = sect2.nb_points-1
else:
end1 = sect1.named_point_index(tag2)
end2 = sect2.named_point_index(tag2)
end1 = sect1.named_point_index(tag2)
end2 = sect2.named_point_index(tag2)
len1 = end1 - start1
len2 = end2 - start2
@ -201,10 +185,6 @@ class InternalMeshing(AMeshingTool):
for i in range(len1-len2):
p = sect2.point(start2).copy()
sect2.insert_point(start2, p)
if tag1 == '': # left end point
sect2.point(start2).name = ''
if tag2 == '': # left end point
sect2.point(start2+1).name = ''
len2 += 1
elif ltot1 < 0.0001:
sect2.add_npoints(len1-len2)
@ -268,8 +248,10 @@ class InternalMeshing(AMeshingTool):
p = sect2.point(start2+len2).copy()
sect2.insert_point(start2+len2, p)
sect2.point(start2+len2).name = ''
sect2.point(start2).name = tag1
sect2.point(start2+len2).name = tag2
if tag1 != "un":
sect2.point(start2).name = tag1
if tag2 != "np":
sect2.point(start2+len2).name = tag2
sect2.modified()
def update_rk(self, reach,
@ -302,6 +284,8 @@ class InternalMeshing(AMeshingTool):
sgn = -1.0
else:
sgn = sign(reach.profiles[-1].rk - reach.profiles[0].rk)
if abs(sgn) < 0.5:
sgn = 1.0
reach.profiles[origin].rk = origin_value

View File

@ -45,7 +45,7 @@ class AddFile(SQLSubModel):
self._path = path
self._text = text
AddFile._id_cnt = max(id, AddFile._id_cnt+1)
AddFile._id_cnt = max(self.id + 1, AddFile._id_cnt + 1)
def __getitem__(self, key):
value = None

View File

@ -53,7 +53,8 @@ class BoundaryCondition(SQLSubModel):
self._header = []
self._types = [float, float]
BoundaryCondition._id_cnt = max(BoundaryCondition._id_cnt + 1, self.id)
BoundaryCondition._id_cnt = max(BoundaryCondition._id_cnt + 1,
self.id + 1)
@classmethod
def _db_create(cls, execute):

View File

@ -54,7 +54,7 @@ class BoundaryConditionAdisTS(SQLSubModel):
self._types = [self.time_convert, float]
BoundaryConditionAdisTS._id_cnt = max(
BoundaryConditionAdisTS._id_cnt + 1, self.id)
BoundaryConditionAdisTS._id_cnt + 1, self.id + 1)
@classmethod
def _db_create(cls, execute):

View File

@ -53,7 +53,7 @@ class D90AdisTS(SQLSubModel):
D90AdisTS._id_cnt = max(
D90AdisTS._id_cnt + 1,
self.id
self.id + 1
)
@classmethod

View File

@ -49,7 +49,7 @@ class D90AdisTSSpec(SQLSubModel):
self._d90 = None
self._enabled = True
D90AdisTSSpec._id_cnt = max(D90AdisTSSpec._id_cnt + 1, self.id)
D90AdisTSSpec._id_cnt = max(D90AdisTSSpec._id_cnt + 1, self.id + 1)
@classmethod
def _db_create(cls, execute):

View File

@ -57,7 +57,7 @@ class DIFAdisTS(SQLSubModel):
DIFAdisTS._id_cnt = max(
DIFAdisTS._id_cnt + 1,
self.id
self.id + 1
)
@classmethod

View File

@ -51,7 +51,7 @@ class DIFAdisTSSpec(SQLSubModel):
self._c = None
self._enabled = True
DIFAdisTSSpec._id_cnt = max(DIFAdisTSSpec._id_cnt + 1, self.id)
DIFAdisTSSpec._id_cnt = max(DIFAdisTSSpec._id_cnt + 1, self.id + 1)
@classmethod
def _db_create(cls, execute):

View File

@ -41,7 +41,7 @@ class Friction(SQLSubModel):
else:
self.id = id
Friction._id_cnt = max(self.id, Friction._id_cnt+1)
Friction._id_cnt = max(self.id + 1, Friction._id_cnt + 1)
self._name = name
self._edge = None

View File

@ -44,7 +44,7 @@ class Profile(object):
else:
self.id = id
Profile._id_cnt = max(self.id, Profile._id_cnt+1)
Profile._id_cnt = max(self.id + 1, Profile._id_cnt + 1)
self._num = int(num)
self._code1 = int(code1)
@ -89,12 +89,32 @@ class Profile(object):
return self.points[index]
def named_point(self, name):
return next((p for p in self.points if p.name == name), None)
if name == "un":
return self.points[0]
elif name == "np":
return self.points[-1]
elif name == "talweg":
zm = self.z_min()
return next((p for p in self.points if p.z == zm), None)
else:
return next((p for p in self.points if p.name == name), None)
def named_point_index(self, name):
return next(
(p for p in enumerate(self.points) if p[1].name == name), None
)[0]
if name == "un":
return 0
elif name == "np":
return len(self.points) - 1
elif name == "talweg":
zm = self.z_min()
return next(
(p for p in enumerate(self.points) if p[1].z == zm),
None
)[0]
else:
return next(
(p for p in enumerate(self.points) if p[1].name == name),
None
)[0]
@property
def reach(self):

View File

@ -900,14 +900,12 @@ class ProfileXYZ(Profile, SQLSubModel):
self.point(i+1).z = 0.5 * self.point(i).z + 0.5 * self.point(i+2).z
def copy(self):
p = ProfileXYZ(self.id,
self.name,
self.rk,
self.reach,
self.num,
0,
0, 0,
self._status)
p = ProfileXYZ(name=self.name,
rk=self.rk,
reach=self.reach,
nb_point=0,
code1=0, code2=0,
status=self.reach._status)
for i, k in enumerate(self.points):
p.insert_point(i, k.copy())

View File

@ -52,7 +52,7 @@ class BasicHS(SQLSubModel):
self._enabled = True
self._data = []
BasicHS._id_cnt = max(BasicHS._id_cnt + 1, self.id)
BasicHS._id_cnt = max(BasicHS._id_cnt + 1, self.id + 1)
@classmethod
def _db_create(cls, execute):

View File

@ -59,7 +59,7 @@ class HydraulicStructure(SQLSubModel):
HydraulicStructure._id_cnt = max(
HydraulicStructure._id_cnt + 1,
self.id
self.id + 1
)
@classmethod

View File

@ -395,7 +395,10 @@ class InitialConditions(SQLSubModel):
strickler = 25.0
if not compute_discharge:
discharge = data_discharge[profile.rk]
if profile.rk in data_discharge:
discharge = data_discharge[profile.rk]
else:
discharge = 0.0
else:
discharge = (
# ((width * 0.8)
@ -461,7 +464,10 @@ class InitialConditions(SQLSubModel):
strickler = 25.0
if not compute_height:
height = data_height[profile.rk]
if profile.rk in data_height:
height = data_height[profile.rk]
else:
height = 0.0
else:
if abs(incline) <= 0:
height = 0.0
@ -513,7 +519,10 @@ class InitialConditions(SQLSubModel):
for profile in profiles:
if not compute_discharge:
d = data_discharge[profile.rk]
if profile.rk in data_discharge:
d = data_discharge[profile.rk]
else:
d = 0.0
else:
d = discharge
elevation = interp(profile.rk,

View File

@ -58,7 +58,7 @@ class InitialConditionsAdisTS(SQLSubModel):
InitialConditionsAdisTS._id_cnt = max(
InitialConditionsAdisTS._id_cnt + 1,
self.id
self.id + 1
)
@classmethod

View File

@ -53,7 +53,7 @@ class ICAdisTSSpec(SQLSubModel):
self._rate = None
self._enabled = True
ICAdisTSSpec._id_cnt = max(ICAdisTSSpec._id_cnt + 1, self.id)
ICAdisTSSpec._id_cnt = max(ICAdisTSSpec._id_cnt + 1, self.id + 1)
@classmethod
def _db_create(cls, execute):

View File

@ -55,7 +55,7 @@ class LateralContribution(SQLSubModel):
self._types = [float, float]
LateralContribution._id_cnt = max(
LateralContribution._id_cnt + 1, self.id)
LateralContribution._id_cnt + 1, self.id + 1)
@classmethod
def _db_create(cls, execute):

View File

@ -31,11 +31,12 @@ class Edge(object):
self._status = status
if id == -1:
type(self)._id_cnt += 1
self.id = type(self)._id_cnt
else:
self.id = id
type(self)._id_cnt = max(self.id + 1, type(self)._id_cnt + 1)
self._name = name
self.node1 = node1

View File

@ -30,11 +30,12 @@ class Node(object):
self._status = status
if id == -1:
type(self)._id_cnt += 1
self.id = type(self)._id_cnt
else:
self.id = id
type(self)._id_cnt = max(self.id + 1, type(self)._id_cnt + 1)
self._name = name
self.pos = Point(x, y)

View File

@ -52,7 +52,7 @@ class OutputRKAdists(SQLSubModel):
self._enabled = True
OutputRKAdists._id_cnt = max(
OutputRKAdists._id_cnt + 1, self.id)
OutputRKAdists._id_cnt + 1, self.id + 1)
@property
def reach(self):

View File

@ -54,7 +54,7 @@ class Pollutants(SQLSubModel):
self._data = []
Pollutants._id_cnt = max(
Pollutants._id_cnt + 1, self.id)
Pollutants._id_cnt + 1, self.id + 1)
@property
def name(self):

View File

@ -45,7 +45,7 @@ class REPLine(SQLSubModel):
self._line = line
self._solvers = solvers
REPLine._id_cnt = max(id, REPLine._id_cnt+1)
REPLine._id_cnt = max(self.id + 1, REPLine._id_cnt + 1)
def __getitem__(self, key):
value = None

View File

@ -42,7 +42,7 @@ class Reservoir(SQLSubModel):
self._node = None
self._data = []
Reservoir._id_cnt = max(Reservoir._id_cnt + 1, self.id)
Reservoir._id_cnt = max(Reservoir._id_cnt + 1, self.id + 1)
@classmethod
def _db_create(cls, execute):
@ -97,7 +97,7 @@ class Reservoir(SQLSubModel):
new_reservoir._node = next(
filter(
lambda n: n.id == node_id, data["nodes"]
)
), None
)
new_data = []

View File

@ -51,7 +51,7 @@ class Layer(SQLSubModel):
else:
self.id = id
Layer._id_cnt = max(id, Layer._id_cnt+1)
Layer._id_cnt = max(self.id + 1, Layer._id_cnt + 1)
@property
def name(self):

View File

@ -108,6 +108,187 @@ class AdisTS(CommandLineSolver):
name = self._study.name
return f"{name}.TRA"
def _export_ST(self, study, repertory, qlog, name="0"):
files = []
if qlog is not None:
qlog.put("Export ST file")
os.makedirs(os.path.join(repertory, "net"), exist_ok=True)
# Write header
edges = study.river.enable_edges()
for edge in edges:
name = f"Reach_{edge.id + 1:>3}".replace(" ", "0")
with adists_file_open(
os.path.join(repertory, "net", f"{name}.ST"),
"w+"
) as f:
files.append(str(os.path.join("net", f"{name}.ST")))
cnt_num = 1
for profile in edge.reach.profiles:
self._export_ST_profile_header(
f, files, profile, cnt_num
)
cnt_num += 1
# Points
for point in profile.points:
self._export_ST_point_line(
f, files, point
)
# Profile last line
f.write(f" 999.9990 999.9990 999.9990\n")
def _export_ST_profile_header(self, wfile, files,
profile, cnt):
num = f"{cnt:>6}"
c1 = f"{profile.code1:>6}"
c2 = f"{profile.code2:>6}"
t = f"{len(profile.points):>6}"
rk = f"{profile.rk:>12f}"[0:12]
pname = profile.name
if profile.name == "":
# Generate name from profile id prefixed with
# 'p' (and replace space char with '0' char)
pname = f"p{profile.id:>3}".replace(" ", "0")
name = f"{pname:<19}"
# Generate sediment additional data if available
sediment = ""
if profile.sl is not None:
if not any(filter(lambda f: ".GRA" in f, files)):
files.append(self._gra_file)
# Number of layers
nl = len(profile.sl)
sediment = f" {nl:>3}"
# Layers data
for layer in profile.sl.layers:
sediment += (
f" {layer.height:>10} {layer.d50:>10} " +
f"{layer.sigma:>10} " +
f"{layer.critical_constraint:>10}"
)
# Profile header line
wfile.write(f"{num}{c1}{c2}{t} {rk} {pname} {sediment}\n")
def _export_ST_point_line(self, wfile, files, point):
x = f"{point.x:<12.4f}"[0:12]
y = f"{point.y:<12.4f}"[0:12]
z = f"{point.z:<12.4f}"[0:12]
n = f"{point.name:<3}"
# Generate sediment additional data if available
sediment = ""
prev = point.z
if point.sl is not None:
# Number of layers
nl = len(point.sl)
sediment = f"{nl:>3}"
# Layers data
for layer in point.sl.layers:
prev = round(prev - layer.height, 5)
sediment += (
f" {prev:>10} {layer.d50:>10} " +
f"{layer.sigma:>10} " +
f"{layer.critical_constraint:>10}"
)
# Point line
wfile.write(f"{x} {y} {z} {n} {sediment}\n")
def _export_NET(self, study, repertory, qlog=None, name="0"):
if qlog is not None:
qlog.put("Export NET file")
with adists_file_open(
os.path.join(repertory, f"{name}.NET"), "w+") as f:
edges = study.river.enable_edges()
for e in edges:
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")
file = os.path.join("net", name + ".ST")
f.write(f"{id} {n1} {n2} {file}\n")
def _export_fake_INI(self, study, repertory, qlog=None, name="0"):
if qlog is not None:
qlog.put("Export fake INI file")
with adists_file_open(
os.path.join(
repertory, "Mage_fin.ini"
), "w+"
) as f:
edges = study.river.enable_edges()
for i, edge in enumerate(edges):
lst = list(filter(
lambda f: f.is_full_defined(),
edge.frictions.frictions
))
rk_min = 9999999.9
rk_max = -9999999.9
coeff_min = -1.0
coeff_max = -1.0
for s in lst: # TODO optimise ?
if s.begin_rk > rk_max:
rk_max = s.begin_rk
coeff_max = s.begin_strickler
if s.begin_rk < rk_min:
rk_min = s.begin_rk
coeff_min = s.begin_strickler
if s.end_rk > rk_max:
rk_max = s.end_rk
coeff_max = s.end_strickler
if s.end_rk < rk_min:
rk_min = s.end_rk
coeff_min = s.end_strickler
print("min max", rk_min, rk_max)
def get_stricklers_from_rk(rk, lst):
print("rk", rk)
coeff = None
if rk > rk_max:
coeff = coeff_max
elif rk < rk_min:
coeff = coeff_min
else:
for s in lst:
if (rk >= s.begin_rk and rk <= s.end_rk or
rk <= s.begin_rk and rk >= s.end_rk):
coeff = s.begin_strickler # TODO: inerpolate
break
# TODO interpolation if rk is not in frictons
if coeff is None:
logger.error(
"Study frictions are not fully defined"
)
return None
return coeff.minor, coeff.medium
for j, profile in enumerate(edge.reach.profiles):
coef_min, coef_moy = get_stricklers_from_rk(profile.rk,
lst)
f.write(
f" {i+1:3}{j+1:4}{' '*116}{coef_min:9}{coef_moy:9}\n")
def _export_REP_additional_lines(self, study, rep_file):
lines = filter(
lambda line: line.is_enabled(),
@ -129,7 +310,7 @@ class AdisTS(CommandLineSolver):
), "w+"
) as f:
path = os.path.join("..", mage_rep, name)
f.write(f"NET {path}.NET\n")
f.write(f"NET {name}.NET\n")
f.write(f"REP {path}.REP\n")
for file in files:
@ -138,13 +319,25 @@ class AdisTS(CommandLineSolver):
self._export_REP_additional_lines(study, f)
path_mage_net = os.path.join(os.path.abspath(
os.path.join(repertory, os.pardir)
), os.path.join(mage_rep, "net"))
path_adists_net = os.path.join(repertory, "net")
self._export_ST(study, repertory, qlog, name=name)
self._export_NET(study, repertory, qlog, name=name)
if os.path.exists(path_mage_net):
shutil.copytree(path_mage_net, path_adists_net, dirs_exist_ok=True)
# fake mage_fin.ini:
path_mage = os.path.join(os.path.abspath(
os.path.join(repertory, os.pardir)), mage_rep)
self._export_fake_INI(study, path_mage,
qlog, name=name)
# path_mage_net = os.path.join(os.path.abspath(
# os.path.join(repertory, os.pardir)
# ), os.path.join(mage_rep, "net"))
# path_adists_net = os.path.join(repertory, "net")
# if os.path.exists(path_mage_net):
# shutil.copytree(path_mage_net,
# path_adists_net,
# dirs_exist_ok=True)
@timer
def export(self, study, repertory, qlog=None):
@ -197,7 +390,7 @@ class AdisTS(CommandLineSolver):
_nodes_views = set()
def get_reach_name(self, reach):
return f"Reach_{reach.id:>3}".replace(" ", "0")
return f"Reach_{reach.id + 1:>3}".replace(" ", "0")
def get_node_name(self, node):
"""Generate a 3 char name for node
@ -338,9 +531,9 @@ class AdisTSwc(AdisTS):
) as f:
for LC in POL_LC:
reach = next(filter(
lambda edge: edge.id == LC.edge, study.river.edges()
lambda edge: edge.id == LC.edge, study.river.enable_edges()
)) # .name
reach_name = self.get_reach_name(self, reach)
reach_name = self.get_reach_name(reach)
f.write(f"${reach_name} {LC.begin_rk} {LC.end_rk}\n")
f.write(f"*temps |débit massique (kg/s)\n")
f.write(f"*---------++++++++++\n")

View File

@ -1,5 +1,5 @@
# RubarBE.py -- Pamhyr
# Copyright (C) 2024 INRAE
# Copyright (C) 2024-2025 INRAE
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -20,7 +20,7 @@ import os
import logging
import numpy as np
from tools import timer, trace, old_pamhyr_date_to_timestamp
from tools import timer, trace, old_pamhyr_date_to_timestamp, logger_exception
from Solver.CommandLine import CommandLineSolver
@ -39,7 +39,7 @@ class Rubar3(CommandLineSolver):
self._type = "rubar3"
self._cmd_input = ""
self._cmd_solver = "@path @input -o @output"
self._cmd_solver = "@path @args @input"
self._cmd_output = ""
@classmethod
@ -58,12 +58,12 @@ class Rubar3(CommandLineSolver):
("rubarbe_iovis", "n"),
("rubarbe_rep", "n"),
("rubarbe_tinit", "000:00:00:00"),
("rubarbe_tmax", "999:99:99:00"),
("rubarbe_tmax", "000:01:00:00"), # 1 day
("rubarbe_tiopdt", "000:00:00:00"),
("rubarbe_dt", "5.0"),
("rubarbe_ts", "999:99:99:00"),
("rubarbe_dtsauv", "00:00:00:05"),
("rubarbe_psave", "00:00:00:05"),
("rubarbe_dtsauv", "00:00:05:00"),
("rubarbe_psave", "00:00:05:00"),
("rubarbe_fdeb1", "1"),
("rubarbe_fdeb2", "10"),
("rubarbe_fdeb3", "100"),
@ -73,11 +73,12 @@ class Rubar3(CommandLineSolver):
("rubarbe_tf_4", "y"),
("rubarbe_tf_5", "y"),
("rubarbe_tf_6", "n"),
("rubarbe_trased", "y"),
# ("rubarbe_optfpc", "0"),
# ("rubarbe_ros", "2650.0"),
# ("rubarbe_dm", "0.1"),
# ("rubarbe_segma", "1.0"),
("rubarbe_trased", "n"),
("rubarbe_optfpc", "0"),
# trased parameters
("rubarbe_ros", "2650.0"),
("rubarbe_dm", "0.1"),
("rubarbe_segma", "1.0"),
# Sediment parameters
("rubarbe_sediment_ros", "2650.0"),
("rubarbe_sediment_por", "0.4"),
@ -129,11 +130,11 @@ class Rubar3(CommandLineSolver):
def output_param(self):
name = self._study.name
return f"{name}"
return f"profil.{name}"
def log_file(self):
name = self._study.name
return f"{name}"
return f"geomac-i.{name}"
def export(self, study, repertory, qlog=None):
self._study = study
@ -143,10 +144,12 @@ class Rubar3(CommandLineSolver):
self._export_ts(study, repertory, qlog, name=name)
self._export_geomac_i(study, repertory, qlog, name=name)
self._export_mail(study, repertory, qlog, name=name)
self._export_devers(study, repertory, qlog, name=name)
self._export_condin(study, repertory, qlog, name=name)
self._export_stricklers(study, repertory, qlog, name=name)
self._export_hydro(study, repertory, qlog, name=name)
self._export_condav(study, repertory, qlog, name=name)
# self._export_abshyd(study, repertory, qlog, name=name)
return True
@ -166,9 +169,8 @@ class Rubar3(CommandLineSolver):
it = iter(params)
line = 0
while line < 25:
param = next(it)
param = next(it, None)
while param is not None:
name = param.name
value = param.value
@ -196,12 +198,12 @@ class Rubar3(CommandLineSolver):
v2 = next(it).value
v3 = next(it).value
f.write(f"{v2}{v3}")
# f.write(f"{v2}{v3}")
# New line
f.write(f"\n")
line += 1
param = next(it, None)
def _export_ts(self, study, repertory, qlog, name="0"):
if qlog is not None:
@ -330,6 +332,50 @@ class Rubar3(CommandLineSolver):
if ind % 3 != 0:
f.write("\n")
def _export_abshyd(self, study, repertory, qlog, name="0"):
if qlog is not None:
qlog.put("Export ABSHYD file")
with open(
os.path.join(
repertory, f"abshyd.{name}"
), "w+"
) as f:
reach_ind = 1
for edge in study.river.enable_edges():
reach = edge.reach
lm = len(reach) + 1
f.write(f"{lm:>13}\n")
ind = 1
for mail in reach.inter_profiles_rk():
f.write(f"{ind:>4} {mail:15.3f} {reach_ind:>4}\n")
ind += 1
reach_ind += 1
def _export_devers(self, study, repertory, qlog, name="0"):
if qlog is not None:
qlog.put("Export DEVERS file")
with open(
os.path.join(
repertory, f"devers.{name}"
), "w+"
) as f:
reach_ind = 1
for edge in study.river.enable_edges():
reach = edge.reach
lm = len(reach) + 1
f.write(f"{lm:>13}\n")
ind = 1
for mail in reach.inter_profiles_rk():
f.write(f"{ind:>4} {0.0:15.3f} {0.0:15.3f} {1.0:>15.3f}\n")
ind += 1
reach_ind += 1
def _export_stricklers(self, study, repertory, qlog, name="0"):
self._export_frot(study, repertory, qlog, name=name, version="")
self._export_frot(study, repertory, qlog, name=name, version="2")
@ -348,25 +394,58 @@ class Rubar3(CommandLineSolver):
lm = len(reach) + 1
f.write(f"{lm:>6}\n")
def get_stricklers_from_rk(rk):
return next(
map(
lambda s: (
s.begin_strickler.medium if version == "2"
else s.begin_strickler.minor
),
filter(
lambda f: rk in f,
edge.frictions.lst
)
lst = list(filter(
lambda f: f.is_full_defined(),
edge.frictions.frictions
))
rk_min = 9999999.9
rk_max = -9999999.9
coeff_min = -1.0
coeff_max = -1.0
for s in lst: # TODO optimise ?
if s.begin_rk > rk_max:
rk_max = s.begin_rk
coeff_max = s.begin_strickler
if s.begin_rk < rk_min:
rk_min = s.begin_rk
coeff_min = s.begin_strickler
if s.end_rk > rk_max:
rk_max = s.end_rk
coeff_max = s.end_strickler
if s.end_rk < rk_min:
rk_min = s.end_rk
coeff_min = s.end_strickler
def get_stricklers_from_rk(rk, lst):
coeff = None
if rk > rk_max:
coeff = coeff_max
elif rk < rk_min:
coeff = coeff_min
else:
for s in lst:
if (rk >= s.begin_rk and rk <= s.end_rk or
rk <= s.begin_rk and rk >= s.end_rk):
coeff = s.begin_strickler # TODO: inerpolate
break
# TODO interpolation if rk is not in frictons
if coeff is None:
logger.error(
"Study frictions are not fully defined"
)
)
return None
return coeff.medium if version == "2" else coeff.minor
ind = 1
for mail in edge.reach.inter_profiles_rk():
coef = get_stricklers_from_rk(mail)
f.write(f"{ind:>6} {coef:>12.5f}")
coef = get_stricklers_from_rk(mail, lst)
if coef is not None:
f.write(f"{ind:>6} {coef:>12.5f}")
ind += 1
f.write("\n")
@ -383,7 +462,7 @@ class Rubar3(CommandLineSolver):
for edge in study.river.enable_edges():
reach = edge.reach
f.write(f"0.0\n")
f.write(f"{0.0}\n")
ics = study.river.initial_conditions.get(edge)
data = self._export_condin_init_data(ics)
@ -392,7 +471,9 @@ class Rubar3(CommandLineSolver):
first = profiles[0]
last = profiles[-1]
# if first not in data or last not in data:
if first.rk not in data or last.rk not in data:
print(data)
logger.error(
"Study initial condition is not fully defined"
)
@ -493,8 +574,219 @@ class Rubar3(CommandLineSolver):
for bc in bcs:
f.write(f"{len(bc)}\n")
for d0, d1 in bc.data:
f.write(f"{d1} {d0}\n")
if bc.bctype == "ZD":
for d0, d1 in bc.data:
f.write(f"{d1} {d0}\n")
else:
for d0, d1 in bc.data:
f.write(f"{d0} {d1}\n")
def read_profil(self, study, fname, results, qlog=None, name="0"):
logger.info(f"read: profil.{name}")
with open(fname, "r") as f:
reachs = []
for i, edge in enumerate(study.river.enable_edges()):
reach = edge.reach
# Add results reach to reach list
res_reach = results.river.add(i)
reachs.append((res_reach, len(reach) + 1))
def read_data_line(f):
line = f.readline().split()
if len(line) > 3:
return tuple(map(float, line))
else:
return (0.0, 0.0, 0.0, 0.0)
def set_and_compute_limites(reach, ind, z, q, s):
reach.set(ind, timestamp, "Z", z)
reach.set(ind, timestamp, "Q", q)
reach.set(ind, timestamp, "V", s)
profile = reach.profile(ind)
limits = profile.geometry.get_water_limits(z)
reach.set(
ind, timestamp, "water_limits", limits
)
ts = set()
timestamp = next(filter(
lambda p: p.name == 'rubarbe_tinit',
study.river.get_params(self._type).parameters
)).value
if timestamp.count(':') == 3:
timestamp = old_pamhyr_date_to_timestamp(timestamp)
ts.add(timestamp)
# add initial condition
for r, edge in enumerate(study.river.enable_edges()):
reach = edge.reach
ics = study.river.initial_conditions.get(edge)
q = ics.get_discharge()
z = ics.get_elevation()
k = 0
for i, j in zip(z, q):
v = reach.profiles[k].speed(i, j)
set_and_compute_limites(reachs[r][0], k, i, j, v)
k += 1
# start read
end = False
while True:
line = f.readline()
if line == "":
results.set("timestamps", ts)
return
timestamp = float(line)
ts.add(timestamp)
logger.info(f"read: profil.{name}: timestamp = {timestamp}")
for reach, lm in reachs:
# First profile
h, s, q, z = read_data_line(f)
set_and_compute_limites(reach, 0, z+h, q, s)
# For each profile
ind = 1
ph, ps, pq, pz = read_data_line(f)
while ind < lm - 2:
h, s, q, z = read_data_line(f)
set_and_compute_limites(
reach, ind,
(pz + z + ph + h) / 2,
(pq + q) / 2,
(ps + s) / 2
)
ph = h
ps = s
pq = q
pz = z
ind += 1
# Last profile
h, s, q, z = read_data_line(f)
set_and_compute_limites(reach, ind, z+h, q, s)
@timer
def write_bin(self, study, fname, results, qlog=None, name="0"):
logger.info(f"write_bin: Start writing '{fname}' ...")
with open(fname, "wb") as f:
def newline(j): return np.asarray([j], dtype=np.int32).tofile(f)
def endline(j): return np.asarray([j], dtype=np.int32).tofile(f)
def write_int(i):
newline(len(i)*4)
np.array(i, dtype=np.int32).tofile(f)
endline(len(i)*4)
def write_float(i):
newline(len(i)*4)
np.array(i, dtype=np.float32).tofile(f)
endline(len(i)*4)
def write_float64(i):
newline(len(i)*8)
np.array(i, dtype=np.float64).tofile(f)
endline(len(i)*8)
def write_float64(i):
newline(len(i)*8)
np.array(i, dtype=np.float64).tofile(f)
endline(len(i)*8)
def write_data(npts, t, a, val):
newline(npts*4 + 13)
np.array(npts, dtype=np.int32).tofile(f)
np.array(t, dtype=np.float64).tofile(f)
np.array(bytearray(a.encode()), dtype=np.byte).tofile(f)
np.array(val, dtype=np.float32).tofile(f)
endline(npts*4 + 13)
ts_list = sorted(results.get("timestamps"))
profiles = []
for r in results.river.reachs:
profiles += r.profiles
# Meta data (1st line)
nb_reach = len(results.river)
nb_profile = len(profiles)
write_int([nb_reach, nb_profile, "82"])
# Reach information (2nd line)
is1 = []
is2 = []
ltmp = []
i = 1
for r in results.river.reachs:
j = i+len(r)-1
ltmp += [i, j]
is1.append(i)
is2.append(j)
i += i+len(r)
write_int(ltmp)
# X (3rd line)
rk = []
for r in results.river.reachs:
rk += r.geometry.get_rk()
write_float(rk)
# Z and Y (4th line)
# ltmp = []
# for r in results.river.reachs:
# for p in r.prifiles:
# ltpm.append(p.rk)
write_float(3*nb_profile*[0.0])
# Data
for timestamp in ts_list:
q = list(
map(
lambda p: p.get_ts_key(timestamp, "Q"),
profiles
)
)
write_data(nb_profile, timestamp, "Q", q)
z = list(
map(
lambda p: p.get_ts_key(timestamp, "Z"),
profiles
)
)
write_data(nb_profile, timestamp, "Z", z)
logger.info(f"write_bin: ... end with {len(ts_list)} timestamps")
@timer
def results(self, study, repertory, qlog=None, name="0"):
results = Results(
study=study,
solver=self,
repertory=repertory,
name=name,
)
results_file = f"profil.{name}"
fname = os.path.join(repertory, results_file)
if not os.path.isfile(fname):
logger.warning(f"Result file {results_file} does not exist")
return None
try:
self.read_profil(study, fname, results, qlog, name=name)
except Exception as e:
logger.error(f"Failed to read results")
logger_exception(e)
return None
fname = os.path.join(repertory, f"{name}.BIN")
self.write_bin(study, fname, results, qlog, name)
return results
class RubarBE(Rubar3):
@ -506,5 +798,5 @@ class RubarBE(Rubar3):
self._type = "rubarbe"
self._cmd_input = ""
self._cmd_solver = "@path @input -o @output"
self._cmd_solver = "@path @args @input"
self._cmd_output = ""

View File

@ -55,7 +55,7 @@ class AboutWindow(PamhyrDialog):
label = self.get_label_text("label_version")
label = label.replace("@version", version)
label = label.replace("@codename", "(Adis-TS)")
label = label.replace("@codename", "(Claude François)")
self.set_label_text("label_version", label)
# Authors

View File

@ -119,8 +119,8 @@ class UpdateRKDialog(PamhyrDialog):
return name
def _init_default_values_guidelines(self):
bgl = ['un'] + self._gl + ['np']
egl = ['un'] + self._gl + ['np']
bgl = ['un'] + self._gl + ['np', 'talweg']
egl = ['un'] + self._gl + ['np', 'talweg']
self.combobox_add_items("comboBox_begin_gl", bgl)
self.combobox_add_items("comboBox_end_gl", egl)

View File

@ -320,7 +320,9 @@ class GeometryWindow(PamhyrWindow):
index = QItemSelection()
if len(ind) > 0:
for i in ind:
index.append(QItemSelectionRange(self.tableView.model().index(i, 0)))
index.append(QItemSelectionRange(
self.tableView.model().index(i, 0))
)
selection.select(
index,
QItemSelectionModel.Rows |
@ -356,14 +358,11 @@ class GeometryWindow(PamhyrWindow):
def _update_rk(self, data):
try:
mesher = MeshingWithMageMailleurTT()
mesher = InternalMeshing()
self._table.update_rk(mesher, data)
except Exception as e:
logger_exception(e)
raise ExternFileMissingError(
module="mage",
filename="MailleurTT",
path=MeshingWithMageMailleurTT._path(),
src_except=e
)

View File

@ -296,11 +296,11 @@ class InitialConditionTableModel(PamhyrTableModel):
formated = False
if len(line_split[0]) > 3:
formated = True
elif len(line_split[2]) > 10:
elif len(line_split[2]) > 10:
formated = True
elif len(line_split[3]) > 11:
elif len(line_split[3]) > 11:
formated = True
elif len(line_split[4]) > 9:
elif len(line_split[4]) > 9:
formated = True
if formated: # old PamHyr format

View File

@ -53,7 +53,8 @@ class LCTranslate(MainTranslate):
self._dict["y"] = _translate("Geometry", "Y (m)")
self._dict["z"] = _translate("Geometry", "Z (m)")
self._dict["file_lat"] = _translate(
"LateralContribution", "Shapefile (*.LAT *.lat)")
"LateralContribution",
"Mage lateral contributions file (*.LAT *.lat)")
self._dict["file_all"] = _translate(
"LateralContribution", "All files (*)")

View File

@ -30,6 +30,7 @@ from platformdirs import user_cache_dir
from Solver.AdisTS import AdisTS
from Solver.Mage import Mage8
from Solver.RubarBE import Rubar3
from tools import logger_exception
from PyQt5 import QtGui
@ -194,10 +195,10 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
title = "(dbg) " if self.conf.debug else ""
if self._study is not None:
title += f"Pamhyr2 - {self._study.name}"
title += f"Pamhyr2 (Claude François) - {self._study.name}"
self.setWindowTitle(title)
else:
title += "Pamhyr2"
title += "Pamhyr2 (Claude François)"
self.setWindowTitle(title)
def setup_tab(self):
@ -1414,7 +1415,10 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
if type(results) is str:
logger.info(f"Open results from {os.path.dirname(results)}")
name = os.path.basename(results).replace(".BIN", "")
if ".BIN" in results:
name = os.path.basename(results).replace(".BIN", "")
elif "profil." in results:
name = os.path.basename(results).replace("profil.", "")
def reading_fn():
self._tmp_results = solver.results(
@ -1545,7 +1549,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
dialog.setFileMode(QFileDialog.FileMode.ExistingFile)
dialog.setDefaultSuffix(".BIN")
# dialog.setFilter(dialog.filter() | QtCore.QDir.Hidden)
dialog.setNameFilters(['Mage (*.BIN)'])
dialog.setNameFilters(['Mage (*.BIN)', 'Rubar3 (profil.*)'])
if self._study.filename is not None:
if self._last_solver is None:
@ -1559,9 +1563,16 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
if dialog.exec_():
file_name = dialog.selectedFiles()
logger.info(f"Select results: {file_name}")
logger.info(f"Select results: {file_name[0]}")
solver = None
if ".BIN" in file_name[0]:
solver = Mage8("Mage8")
else:
solver = Rubar3("Rubar3")
self.open_solver_results(
Mage8("Mage"),
solver,
results=file_name[0]
)
@ -1730,7 +1741,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
path = os.path.normpath(dir_path)
solver_name = path.split(os.sep)[-2]
solver_results = next(filter(lambda x: x.name == solver_name,
self.conf.solvers))
self.conf.solvers), None)
solver_results_adists = solver_results.results(
self._study,
repertory=dir_path, qlog=None) # self._output)

View File

@ -19,7 +19,7 @@
from View.Tools.PamhyrWindow import PamhyrDialog
from PyQt5.QtWidgets import (
QRadioButton, QCheckBox, QVBoxLayout, QLabel,
QRadioButton, QCheckBox, QVBoxLayout, QLabel, QFrame
)
from View.Results.translate import ResultsTranslate
@ -43,6 +43,7 @@ class CustomExportDialog(PamhyrDialog):
self.setup_radio_buttons_x()
self.setup_radio_buttons_res()
self.setup_label()
self.setup_envelop_box()
self.setup_check_boxes()
@ -87,6 +88,22 @@ class CustomExportDialog(PamhyrDialog):
layout.addStretch()
def setup_label(self):
self._label = self.find(QLabel, "label_4")
self._label.setFrameStyle(QFrame.StyledPanel)
self._label.setStyleSheet('background-color: white')
self.set_label()
for r in self._radio:
r[1].clicked.connect(self.set_label)
def set_label(self):
if self._radio[0][1].isChecked():
self._label.setText(self._parent.text_bief() + "\n" +
self._parent.text_time())
else:
self._label.setText(self._parent.text_bief() + "\n" +
self._parent.text_profile())
def setup_envelop_box(self):
layout = self.find(QVBoxLayout, "verticalLayout_x")
self._envelop = QCheckBox(

View File

@ -19,7 +19,7 @@
from View.Tools.PamhyrWindow import PamhyrDialog
from PyQt5.QtWidgets import (
QRadioButton, QCheckBox, QVBoxLayout,
QRadioButton, QCheckBox, QVBoxLayout, QLabel, QFrame
)
from View.Results.translate import ResultsTranslate
@ -50,6 +50,7 @@ class CustomExportAdisDialog(PamhyrDialog):
self.setup_radio_buttons_x()
self.setup_radio_buttons_pol()
self.setup_label()
self.setup_check_boxes()
self.value = None
@ -84,6 +85,22 @@ class CustomExportAdisDialog(PamhyrDialog):
self._radio2[0][1].setChecked(True)
layout.addStretch()
def setup_label(self):
self._label = self.find(QLabel, "label_4")
self._label.setFrameStyle(QFrame.StyledPanel)
self._label.setStyleSheet('background-color: white')
self.set_label()
for r in self._radio:
r[1].clicked.connect(self.set_label)
def set_label(self):
if self._radio[0][1].isChecked():
self._label.setText(self._parent.text_bief() + "\n" +
self._parent.text_time())
else:
self._label.setText(self._parent.text_bief() + "\n" +
self._parent.text_profile())
def setup_check_boxes(self):
self._check = []
layout = self.find(QVBoxLayout, "verticalLayout_y")

View File

@ -19,7 +19,7 @@
from View.Tools.PamhyrWindow import PamhyrDialog
from PyQt5.QtWidgets import (
QRadioButton, QCheckBox, QVBoxLayout,
QRadioButton, QCheckBox, QVBoxLayout, QLabel, QFrame
)
from View.Results.CustomPlot.Translate import CustomPlotTranslate
@ -38,10 +38,12 @@ class CustomPlotValuesSelectionDialog(PamhyrDialog):
parent=parent
)
self._parent = parent
self._available_values_x = self._trad.get_dict("values_x")
self._available_values_y = self._trad.get_dict("values_y")
self.setup_radio_buttons()
self.setup_label()
self.setup_envelop_box()
self.setup_check_boxs()
@ -62,6 +64,22 @@ class CustomPlotValuesSelectionDialog(PamhyrDialog):
self._radio[0][1].setChecked(True)
layout.addStretch()
def setup_label(self):
self._label = self.find(QLabel, "label_3")
self._label.setFrameStyle(QFrame.StyledPanel)
self._label.setStyleSheet('background-color: white')
self.set_label()
for r in self._radio:
r[1].clicked.connect(self.set_label)
def set_label(self):
if self._radio[0][1].isChecked():
self._label.setText(self._parent.text_bief() + "\n" +
self._parent.text_time())
else:
self._label.setText(self._parent.text_bief() + "\n" +
self._parent.text_profile())
def setup_envelop_box(self):
self._envelop = []
layout = self.find(QVBoxLayout, "verticalLayout_x")

View File

@ -62,9 +62,9 @@ class CustomPlot(PamhyrPlot):
self._x = x
self._y = y
self._envelop = envelop
self._reach = reach
self._profile = profile
self._timestamp = timestamp
self._current_reach = reach
self._current_profile_id = profile
self._current_timestamp = timestamp
self._current_res_id = res_id[0]
self._parent = parent
@ -133,7 +133,7 @@ class CustomPlot(PamhyrPlot):
"""
Get SL list for profile p at initial time (initial data)
"""
t0 = min(list(self.data[self._current_res_id[0]].get("timestamps")))
t0 = min(list(self.data[self._current_res_id].get("timestamps")))
return map(
lambda p: p.get_ts_key(t0, "sl")[0],
reach.profiles
@ -144,14 +144,14 @@ class CustomPlot(PamhyrPlot):
Get SL list for profile p at current time
"""
return map(
lambda p: p.get_ts_key(self._timestamp, "sl")[0],
lambda p: p.get_ts_key(self._current_timestamp, "sl")[0],
reach.profiles
)
def get_ts_zmin(self, profile, res_id):
results = self.data[res_id]
nt = len(list(results.get("timestamps")))
reach = results.river.reach(self._reach)
reach = results.river.reach(self._current_reach)
berdrock = self.sl_compute_bedrock(reach)
sl = reach.profile(profile).get_key("sl")
@ -171,10 +171,10 @@ class CustomPlot(PamhyrPlot):
def _draw_rk(self):
results = self.data[self._current_res_id]
reach = results.river.reach(self._reach)
reach = results.river.reach(self._current_reach)
if self._current_res_id == 2: # compare results
reach1 = self.data[0].river.reach(self._reach)
reach2 = self.data[1].river.reach(self._reach)
reach1 = self.data[0].river.reach(self._current_reach)
reach2 = self.data[1].river.reach(self._current_reach)
rk = reach.geometry.get_rk()
if reach.has_sediment():
z_min = self.draw_bottom_with_bedload(reach)
@ -183,19 +183,19 @@ class CustomPlot(PamhyrPlot):
q = list(
map(
lambda p: p.get_ts_key(self._timestamp, "Q"),
lambda p: p.get_ts_key(self._current_timestamp, "Q"),
reach.profiles
)
)
z = list(
map(
lambda p: p.get_ts_key(self._timestamp, "Z"),
lambda p: p.get_ts_key(self._current_timestamp, "Z"),
reach.profiles
)
)
v = list(
map(
lambda p: p.get_ts_key(self._timestamp, "V"),
lambda p: p.get_ts_key(self._current_timestamp, "V"),
reach.profiles
)
)
@ -248,7 +248,8 @@ class CustomPlot(PamhyrPlot):
e = list(
map(
lambda p: max(self.get_ts_zmin(p, res_id)),
lambda p: max(self.get_ts_zmin(
p, self._current_res_id)),
range(len(reach))
)
)
@ -261,7 +262,8 @@ class CustomPlot(PamhyrPlot):
e = list(
map(
lambda p: min(self.get_ts_zmin(p, res_id)),
lambda p: min(self.get_ts_zmin(
p, self._current_res_id)),
range(len(reach))
)
)
@ -402,7 +404,7 @@ class CustomPlot(PamhyrPlot):
d = list(
map(
lambda p: p.geometry.max_water_depth(
p.get_ts_key(self._timestamp, "Z")),
p.get_ts_key(self._current_timestamp, "Z")),
reach.profiles
)
)
@ -410,14 +412,14 @@ class CustomPlot(PamhyrPlot):
d1 = list(
map(
lambda p: p.geometry.max_water_depth(
p.get_ts_key(self._timestamp, "Z")),
p.get_ts_key(self._current_timestamp, "Z")),
reach1.profiles
)
)
d2 = list(
map(
lambda p: p.geometry.max_water_depth(
p.get_ts_key(self._timestamp, "Z")),
p.get_ts_key(self._current_timestamp, "Z")),
reach2.profiles
)
)
@ -471,7 +473,7 @@ class CustomPlot(PamhyrPlot):
d = list(
map(
lambda p: p.geometry.mean_water_depth(
p.get_ts_key(self._timestamp, "Z")),
p.get_ts_key(self._current_timestamp, "Z")),
reach.profiles
)
)
@ -479,14 +481,14 @@ class CustomPlot(PamhyrPlot):
d1 = list(
map(
lambda p: p.geometry.mean_water_depth(
p.get_ts_key(self._timestamp, "Z")),
p.get_ts_key(self._current_timestamp, "Z")),
reach1.profiles
)
)
d2 = list(
map(
lambda p: p.geometry.mean_water_depth(
p.get_ts_key(self._timestamp, "Z")),
p.get_ts_key(self._current_timestamp, "Z")),
reach2.profiles
)
)
@ -510,12 +512,12 @@ class CustomPlot(PamhyrPlot):
fr = list(
map(
lambda p:
p.get_ts_key(self._timestamp, "V") /
p.get_ts_key(self._current_timestamp, "V") /
sqrt(9.81 * (
p.geometry.wet_area(
p.get_ts_key(self._timestamp, "Z")) /
p.geometry.wet_width(
p.get_ts_key(self._timestamp, "Z"))
p.geometry.wet_area(p.get_ts_key(
self._current_timestamp, "Z")) /
p.geometry.wet_width(p.get_ts_key(
self._current_timestamp, "Z"))
)),
reach.profiles
)
@ -524,12 +526,12 @@ class CustomPlot(PamhyrPlot):
fr1 = list(
map(
lambda p:
p.get_ts_key(self._timestamp, "V") /
p.get_ts_key(self._current_timestamp, "V") /
sqrt(9.81 * (
p.geometry.wet_area(
p.get_ts_key(self._timestamp, "Z")) /
p.geometry.wet_width(
p.get_ts_key(self._timestamp, "Z"))
p.geometry.wet_area(p.get_ts_key(
self._current_timestamp, "Z")) /
p.geometry.wet_width(p.get_ts_key(
self._current_timestamp, "Z"))
)),
reach1.profiles
)
@ -537,12 +539,12 @@ class CustomPlot(PamhyrPlot):
fr2 = list(
map(
lambda p:
p.get_ts_key(self._timestamp, "V") /
p.get_ts_key(self._current_timestamp, "V") /
sqrt(9.81 * (
p.geometry.wet_area(
p.get_ts_key(self._timestamp, "Z")) /
p.geometry.wet_width(
p.get_ts_key(self._timestamp, "Z"))
p.geometry.wet_area(p.get_ts_key(
self._current_timestamp, "Z")) /
p.geometry.wet_width(p.get_ts_key(
self._current_timestamp, "Z"))
)),
reach2.profiles
)
@ -566,7 +568,7 @@ class CustomPlot(PamhyrPlot):
d = list(
map(
lambda p: p.geometry.wet_area(
p.get_ts_key(self._timestamp, "Z")),
p.get_ts_key(self._current_timestamp, "Z")),
reach.profiles
)
)
@ -574,14 +576,14 @@ class CustomPlot(PamhyrPlot):
d1 = list(
map(
lambda p: p.geometry.wet_area(
p.get_ts_key(self._timestamp, "Z")),
p.get_ts_key(self._current_timestamp, "Z")),
reach1.profiles
)
)
d2 = list(
map(
lambda p: p.geometry.wet_area(
p.get_ts_key(self._timestamp, "Z")),
p.get_ts_key(self._current_timestamp, "Z")),
reach2.profiles
)
)
@ -609,10 +611,10 @@ class CustomPlot(PamhyrPlot):
def _redraw_rk(self):
results = self.data[self._current_res_id]
reach = results.river.reach(self._reach)
reach = results.river.reach(self._current_reach)
if self._current_res_id == 2: # compare results
reach1 = self.data[0].river.reach(self._reach)
reach2 = self.data[1].river.reach(self._reach)
reach1 = self.data[0].river.reach(self._current_reach)
reach2 = self.data[1].river.reach(self._current_reach)
rk = reach.geometry.get_rk()
z_min = reach.geometry.get_z_min()
@ -623,19 +625,19 @@ class CustomPlot(PamhyrPlot):
q = list(
map(
lambda p: p.get_ts_key(self._timestamp, "Q"),
lambda p: p.get_ts_key(self._current_timestamp, "Q"),
reach.profiles
)
)
z = list(
map(
lambda p: p.get_ts_key(self._timestamp, "Z"),
lambda p: p.get_ts_key(self._current_timestamp, "Z"),
reach.profiles
)
)
v = list(
map(
lambda p: p.get_ts_key(self._timestamp, "V"),
lambda p: p.get_ts_key(self._current_timestamp, "V"),
reach.profiles
)
)
@ -679,7 +681,7 @@ class CustomPlot(PamhyrPlot):
d = list(
map(
lambda p: p.geometry.max_water_depth(
p.get_ts_key(self._timestamp, "Z")),
p.get_ts_key(self._current_timestamp, "Z")),
reach.profiles
)
)
@ -687,14 +689,14 @@ class CustomPlot(PamhyrPlot):
d1 = list(
map(
lambda p: p.geometry.max_water_depth(
p.get_ts_key(self._timestamp, "Z")),
p.get_ts_key(self._current_timestamp, "Z")),
reach1.profiles
)
)
d2 = list(
map(
lambda p: p.geometry.max_water_depth(
p.get_ts_key(self._timestamp, "Z")),
p.get_ts_key(self._current_timestamp, "Z")),
reach2.profiles
)
)
@ -712,7 +714,7 @@ class CustomPlot(PamhyrPlot):
d = list(
map(
lambda p: p.geometry.mean_water_depth(
p.get_ts_key(self._timestamp, "Z")),
p.get_ts_key(self._current_timestamp, "Z")),
reach.profiles
)
)
@ -720,14 +722,14 @@ class CustomPlot(PamhyrPlot):
d1 = list(
map(
lambda p: p.geometry.mean_water_depth(
p.get_ts_key(self._timestamp, "Z")),
p.get_ts_key(self._current_timestamp, "Z")),
reach1.profiles
)
)
d2 = list(
map(
lambda p: p.geometry.mean_water_depth(
p.get_ts_key(self._timestamp, "Z")),
p.get_ts_key(self._current_timestamp, "Z")),
reach2.profiles
)
)
@ -745,12 +747,12 @@ class CustomPlot(PamhyrPlot):
fr = list(
map(
lambda p:
p.get_ts_key(self._timestamp, "V") /
p.get_ts_key(self._current_timestamp, "V") /
sqrt(9.81 * (
p.geometry.wet_area(
p.get_ts_key(self._timestamp, "Z")) /
p.geometry.wet_width(
p.get_ts_key(self._timestamp, "Z"))
p.geometry.wet_area(p.get_ts_key(
self._current_timestamp, "Z")) /
p.geometry.wet_width(p.get_ts_key(
self._current_timestamp, "Z"))
)),
reach.profiles
)
@ -759,12 +761,12 @@ class CustomPlot(PamhyrPlot):
fr1 = list(
map(
lambda p:
p.get_ts_key(self._timestamp, "V") /
p.get_ts_key(self._current_timestamp, "V") /
sqrt(9.81 * (
p.geometry.wet_area(
p.get_ts_key(self._timestamp, "Z")) /
p.geometry.wet_width(
p.get_ts_key(self._timestamp, "Z"))
p.geometry.wet_area(p.get_ts_key(
self._current_timestamp, "Z")) /
p.geometry.wet_width(p.get_ts_key(
self._current_timestamp, "Z"))
)),
reach1.profiles
)
@ -772,12 +774,12 @@ class CustomPlot(PamhyrPlot):
fr2 = list(
map(
lambda p:
p.get_ts_key(self._timestamp, "V") /
p.get_ts_key(self._current_timestamp, "V") /
sqrt(9.81 * (
p.geometry.wet_area(
p.get_ts_key(self._timestamp, "Z")) /
p.geometry.wet_width(
p.get_ts_key(self._timestamp, "Z"))
p.geometry.wet_area(p.get_ts_key(
self._current_timestamp, "Z")) /
p.geometry.wet_width(p.get_ts_key(
self._current_timestamp, "Z"))
)),
reach2.profiles
)
@ -796,7 +798,7 @@ class CustomPlot(PamhyrPlot):
d = list(
map(
lambda p: p.geometry.wet_area(
p.get_ts_key(self._timestamp, "Z")),
p.get_ts_key(self._current_timestamp, "Z")),
reach.profiles
)
)
@ -804,14 +806,14 @@ class CustomPlot(PamhyrPlot):
d1 = list(
map(
lambda p: p.geometry.wet_area(
p.get_ts_key(self._timestamp, "Z")),
p.get_ts_key(self._current_timestamp, "Z")),
reach1.profiles
)
)
d2 = list(
map(
lambda p: p.geometry.wet_area(
p.get_ts_key(self._timestamp, "Z")),
p.get_ts_key(self._current_timestamp, "Z")),
reach2.profiles
)
)
@ -868,8 +870,8 @@ class CustomPlot(PamhyrPlot):
def _draw_time(self):
results = self.data[self._current_res_id]
reach = results.river.reach(self._reach)
profile = reach.profile(self._profile)
reach = results.river.reach(self._current_reach)
profile = reach.profile(self._current_profile_id)
shift = 0
compt = 0
@ -884,10 +886,10 @@ class CustomPlot(PamhyrPlot):
ts = self._parent._timestamps
if self._current_res_id == 2: # compare results
reach1 = self.data[0].river.reach(self._reach)
reach2 = self.data[1].river.reach(self._reach)
profile1 = reach1.profile(self._profile)
profile2 = reach2.profile(self._profile)
reach1 = self.data[0].river.reach(self._current_reach)
reach2 = self.data[1].river.reach(self._current_reach)
profile1 = reach1.profile(self._current_profile_id)
profile2 = reach2.profile(self._current_profile_id)
q1 = profile1.get_key("Q")
z1 = profile1.get_key("Z")
@ -903,7 +905,8 @@ class CustomPlot(PamhyrPlot):
z_min = profile.geometry.z_min()
if self._current_res_id < 2:
if reach.has_sediment():
ts_z_min = self.get_ts_zmin(self._profile, res_id)
ts_z_min = self.get_ts_zmin(
self._current_profile_id, self._current_res_id)
else:
ts_z_min = list(
map(
@ -920,8 +923,8 @@ class CustomPlot(PamhyrPlot):
if self._current_res_id == 2:
if reach.has_sediment():
ts_z_min1 = self.get_ts_zmin(self._profile1, 0)
ts_z_min2 = self.get_ts_zmin(self._profile2, 1)
ts_z_min1 = self.get_ts_zmin(self._current_profile_id1, 0)
ts_z_min2 = self.get_ts_zmin(self._current_profile_id2, 1)
ts_z_min = list(
map(
lambda x, y: x - y,
@ -1114,16 +1117,16 @@ class CustomPlot(PamhyrPlot):
def _redraw_time(self):
results = self.data[self._current_res_id]
reach = results.river.reach(self._reach)
profile = reach.profile(self._profile)
reach = results.river.reach(self._current_reach)
profile = reach.profile(self._current_profile_id)
ts = list(results.get("timestamps"))
ts.sort()
if self._current_res_id == 2: # compare results
reach1 = self.data[0].river.reach(self._reach)
reach2 = self.data[1].river.reach(self._reach)
profile1 = reach1.profile(self._profile)
profile2 = reach2.profile(self._profile)
reach1 = self.data[0].river.reach(self._current_reach)
reach2 = self.data[1].river.reach(self._current_reach)
profile1 = reach1.profile(self._current_profile_id)
profile2 = reach2.profile(self._current_profile_id)
q1 = profile1.get_key("Q")
z1 = profile1.get_key("Z")
@ -1138,7 +1141,8 @@ class CustomPlot(PamhyrPlot):
v = profile.get_key("V")
if self._current_res_id < 2:
if reach.has_sediment():
ts_z_min = self.get_ts_zmin(self._profile)
ts_z_min = self.get_ts_zmin(
self._current_profile_id, self._current_res_id)
else:
z_min = profile.geometry.z_min()
ts_z_min = list(
@ -1150,8 +1154,8 @@ class CustomPlot(PamhyrPlot):
if "bed_elevation" in self._y:
if self._current_res_id == 2:
if reach.has_sediment():
ts_z_min1 = self.get_ts_zmin(self._profile1, 0)
ts_z_min2 = self.get_ts_zmin(self._profile2, 1)
ts_z_min1 = self.get_ts_zmin(self._current_profile_id1, 0)
ts_z_min2 = self.get_ts_zmin(self._current_profile_id2, 1)
ts_z_min = list(
map(
lambda x, y: x - y,
@ -1358,11 +1362,12 @@ class CustomPlot(PamhyrPlot):
elif self._x == "time":
self._draw_time()
if self._x == "rk":
reach = self.data[self._current_res_id].river.reach(self._reach)
profile = reach.profile(self._profile)
reach = self.data[self._current_res_id].river.reach(
self._current_reach)
profile = reach.profile(self._current_profile_id)
x = profile.rk
elif self._x == "time":
x = self._timestamp
x = self._current_timestamp
self._current, = self.canvas.axes.plot(
[x, x],
@ -1385,13 +1390,13 @@ class CustomPlot(PamhyrPlot):
return
def set_reach(self, reach_id):
self._reach = reach_id
self._profile = 0
self._current_reach = reach_id
self._current_profile_id = 0
self.draw()
def set_profile(self, profile_id):
self._profile = profile_id
self._current_profile_id = profile_id
if self._x != "rk":
self.update()
@ -1403,19 +1408,27 @@ class CustomPlot(PamhyrPlot):
self.draw()
def set_timestamp(self, timestamp):
self._timestamp = timestamp
self._current_timestamp = timestamp
if self._x != "time":
self.update()
else:
self.draw_current()
def update_all(self):
self._current_reach_id = self._parent._get_current_reach()
self._current_profile_id = self._parent._get_current_profile()
self._current_res_id = self._parent._get_current_results()[0]
self._current_timestamp = self._parent._get_current_timestamp()
self.draw()
def draw_current(self):
if self._x == "rk":
reach = self.data[self._current_res_id].river.reach(self._reach)
profile = reach.profile(self._profile)
reach = self.data[self._current_res_id].river.reach(
self._current_reach)
profile = reach.profile(self._current_profile_id)
x = profile.rk
elif self._x == "time":
x = self._timestamp
x = self._current_timestamp
self._current.set_data([x, x], self.canvas.axes.get_ylim())
self.canvas.draw_idle()

View File

@ -39,6 +39,7 @@ class PlotAC(PamhyrPlot):
parent=parent
)
self._parent = parent
self._current_reach_id = reach_id
self._current_profile_id = profile_id
self._current_res_id = res_id[0]
@ -116,7 +117,7 @@ class PlotAC(PamhyrPlot):
self.collection = self.canvas.axes.fill_between(
x, z, water_z,
where=z <= water_z,
where=list(map(lambda x: x <= water_z, z)),
color=self.color_plot_river_water_zone,
alpha=0.7, interpolate=True
)
@ -150,8 +151,17 @@ class PlotAC(PamhyrPlot):
self.annotation = []
self.cgl, self.igl = reach.geometry.compute_guidelines()
lcomplete = list(self.cgl)
lincomplete = list(self.igl)
# we make sure that the lines are in the left-to-right order
lcomplete = [
x.name
for x in profile.geometry.named_points()
if x.name in self.cgl
]
lincomplete = [
x.name
for x in profile.geometry.named_points()
if x.name in self.igl
]
self.color_complete_gl = self.colors
self.color_incomplete_gl = 2 * ["grey"]
@ -171,7 +181,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(
@ -234,6 +244,14 @@ class PlotAC(PamhyrPlot):
self.update_idle()
def update_all(self):
self._current_reach_id = self._parent._get_current_reach()
self._current_profile_id = self._parent._get_current_profile()
self._current_res_id = self._parent._get_current_results()[0]
self._current_timestamp = self._parent._get_current_timestamp()
self._init = False
self.update()
def update_gl(self):
for a in self.annotation:
a.remove()
@ -254,7 +272,7 @@ class PlotAC(PamhyrPlot):
self.collection.remove()
self.collection = self.canvas.axes.fill_between(
x, z, water_z,
where=z <= water_z,
where=list(map(lambda x: x <= water_z, z)),
color=self.color_plot_river_water_zone,
alpha=0.7, interpolate=True
)

View File

@ -47,6 +47,7 @@ class PlotH(PamhyrPlot):
self._mode = "time"
self._parent = parent
self._current_reach_id = reach_id
self._current_profile_id = profile_id
self._current_res_id = res_id
@ -216,20 +217,16 @@ class PlotH(PamhyrPlot):
if not self._init:
self.draw()
self.update_data()
self.update_current()
self.update_idle()
def update_data(self):
for res, res_id in enumerate(self._current_res_id):
results = self.results[res_id]
reach = results.river.reach(self._current_reach_id)
profile = reach.profile(self._current_profile_id)
x = self._timestamps
y = profile.get_key("Q")
self._line[res].set_data(x, y)
def update_all(self):
self._current_reach_id = self._parent._get_current_reach()
self._current_profile_id = self._parent._get_current_profiles_list()
self._current_res_id = self._parent._get_current_results()
self._current_timestamp = self._parent._get_current_timestamp()
self._init = False
self.update()
def update_current(self):
y = self._current.get_ydata()

View File

@ -42,6 +42,7 @@ class PlotRKC(PamhyrPlot):
parent=parent
)
self._parent = parent
self._current_reach_id = reach_id
self._current_profile_id = profile_id
self._current_res_id = res_id[0]
@ -343,6 +344,14 @@ class PlotRKC(PamhyrPlot):
self.update_idle()
def update_all(self):
self._current_reach_id = self._parent._get_current_reach()
self._current_profile_id = self._parent._get_current_profile()
self._current_res_id = self._parent._get_current_results()[0]
self._current_timestamp = self._parent._get_current_timestamp()
self._init = False
self.update()
def update_water_elevation(self):
results = self.results[self._current_res_id]
reach = results.river.reach(self._current_reach_id)

View File

@ -52,6 +52,7 @@ class PlotXY(PamhyrPlot):
self.line_gl = []
self.overflow = []
self._parent = parent
self._timestamps = parent._timestamps
self._current_timestamp = max(self._timestamps)
self._current_reach_id = reach_id
@ -332,6 +333,14 @@ class PlotXY(PamhyrPlot):
self.update_idle()
def update_all(self):
self._current_reach_id = self._parent._get_current_reach()
self._current_profile_id = self._parent._get_current_profile()
self._current_res_id = self._parent._get_current_results()[0]
self._current_timestamp = self._parent._get_current_timestamp()
self._init = False
self.update()
def update_profile(self):
results = self.results[self._current_res_id]
reach = results.river.reach(self._current_reach_id)

View File

@ -157,8 +157,6 @@ class TableModel(PamhyrTableModel):
self._lst = _river.reachs
elif self._opt_data == "profile" or self._opt_data == "raw_data":
self._lst = _river.reach(reach).profiles
# self._lst = list(compress(_river.reach(reach).profiles,
# _river.reach(reach).profile_mask))
elif self._opt_data == "solver":
self._lst = self._parent._solvers

View File

@ -288,16 +288,12 @@ class ResultsWindow(PamhyrWindow):
super(ResultsWindow, self).closeEvent(event)
def _compute_status_label(self):
# Timestamp
ts = self._timestamps[self._slider_time.value()]
t0 = datetime.fromtimestamp(0)
fts = str(
datetime.fromtimestamp(ts) - t0
)
fts.replace("days", _translate("Results", "days"))\
.replace("day", _translate("Results", "day"))
return (self.text_bief() + " | " +
self.text_profile() + " | " +
self.text_time())
def text_bief(self):
# Reach
table = self.find(QTableView, f"tableView_reach")
indexes = table.selectedIndexes()
@ -305,7 +301,16 @@ class ResultsWindow(PamhyrWindow):
reach = self._study.river.enable_edges()[0]
else:
reach = self._study.river.enable_edges()[indexes[0].row()]
return f"{self._trad['reach']}: {reach.name}"
def text_profile(self):
# Reach
table = self.find(QTableView, f"tableView_reach")
indexes = table.selectedIndexes()
if len(indexes) == 0:
reach = self._study.river.enable_edges()[0]
else:
reach = self._study.river.enable_edges()[indexes[0].row()]
# Profile
table = self.find(QTableView, f"tableView_profile")
indexes = table.selectedIndexes()
@ -315,10 +320,22 @@ class ResultsWindow(PamhyrWindow):
profile = reach.reach.profile(indexes[0].row())
pname = profile.name if profile.name != "" else profile.rk
return f"{self._trad['cross_section']}: {pname}"
return (f"{self._trad['reach']}: {reach.name} | " +
f"{self._trad['cross_section']}: {pname} | " +
f"{self._trad['unit_time_s']} : {fts} ({ts} sec)")
def text_time(self):
# Timestamp
ts = self._timestamps[self._slider_time.value()]
t0 = datetime.fromtimestamp(0)
fts = str(
datetime.fromtimestamp(ts) - t0
)
fts = str(
datetime.fromtimestamp(ts) - t0
)
fts.replace("days", _translate("Results", "days"))\
.replace("day", _translate("Results", "day"))
return f"{self._trad['time']} : {fts} ({ts} sec)"
def setup_statusbar(self):
txt = self._compute_status_label()
@ -428,49 +445,69 @@ class ResultsWindow(PamhyrWindow):
solver_id=None,
timestamp=None):
if reach_id is not None:
self.plot_xy.set_reach(reach_id)
self.plot_ac.set_reach(reach_id)
self.plot_rkc.set_reach(reach_id)
self.plot_h.set_reach(reach_id)
tab_widget = self.find(QTabWidget, f"tabWidget")
tab_index = tab_widget.currentIndex()
name = tab_widget.tabText(tab_index)
for plot in self._additional_plot:
self._additional_plot[plot].set_reach(reach_id)
if reach_id is not None:
if tab_index == 1:
self.plot_xy.set_reach(reach_id)
self.plot_ac.set_reach(reach_id)
self.plot_rkc.set_reach(reach_id)
elif tab_index == 2:
self.plot_h.set_reach(reach_id)
elif tab_index > 2:
self._additional_plot[name].set_reach(reach_id)
# for plot in self._additional_plot:
# self._additional_plot[plot].set_reach(reach_id)
self.update_table_selection_reach(reach_id)
self.update_table_selection_profile(0)
if profile_id is not None:
self.plot_xy.set_profile(profile_id[0])
self.plot_ac.set_profile(profile_id[0])
self.plot_rkc.set_profile(profile_id[0])
self.plot_h.set_profile(profile_id)
if tab_index == 1:
self.plot_xy.set_profile(profile_id[0])
self.plot_ac.set_profile(profile_id[0])
self.plot_rkc.set_profile(profile_id[0])
elif tab_index == 2:
self.plot_h.set_profile(profile_id)
elif tab_widget.currentIndex() > 2:
self._additional_plot[name].set_profile(profile_id[0])
for plot in self._additional_plot:
self._additional_plot[plot].set_profile(profile_id[0])
# for plot in self._additional_plot:
# self._additional_plot[plot].set_profile(profile_id[0])
tab_widget = self.find(QTabWidget, f"tabWidget")
if tab_widget.currentIndex() != 2:
self.update_table_selection_profile(profile_id[0])
if solver_id is not None:
self._current_results = solver_id
self.plot_xy.set_result(solver_id)
self.plot_ac.set_result(solver_id)
self.plot_rkc.set_result(solver_id)
self.plot_h.set_result(solver_id)
if tab_index == 1:
self._current_results = solver_id
self.plot_xy.set_result(solver_id)
self.plot_ac.set_result(solver_id)
self.plot_rkc.set_result(solver_id)
elif tab_index == 2:
self.plot_h.set_result(solver_id)
elif tab_widget.currentIndex() > 2:
self._additional_plot[name].set_result(solver_id)
for plot in self._additional_plot:
self._additional_plot[plot].set_result(solver_id)
# for plot in self._additional_plot:
# self._additional_plot[plot].set_result(solver_id)
if timestamp is not None:
self.plot_xy.set_timestamp(timestamp)
self.plot_ac.set_timestamp(timestamp)
self.plot_rkc.set_timestamp(timestamp)
self.plot_h.set_timestamp(timestamp)
if tab_index == 2:
self.plot_h.set_timestamp(timestamp)
for plot in self._additional_plot:
self._additional_plot[plot].set_timestamp(timestamp)
if tab_widget.currentIndex() > 2:
self._additional_plot[name].set_timestamp(timestamp)
# for plot in self._additional_plot:
# self._additional_plot[plot].set_timestamp(timestamp)
self._table["raw_data"].timestamp = timestamp
@ -505,6 +542,14 @@ class ResultsWindow(PamhyrWindow):
self._slider_time.value()
]
def _get_current_results(self):
table = self.find(QTableView, f"tableView_solver")
indexes = table.selectedIndexes()
if len(indexes) == 0:
return
return [i.row() for i in indexes]
def _set_current_reach(self):
table = self.find(QTableView, f"tableView_reach")
indexes = table.selectedIndexes()
@ -721,20 +766,29 @@ class ResultsWindow(PamhyrWindow):
first_line.append(f"Profile: {pname}")
val_dict = self._export_time(profile_id, y, solver_id)
with open(filename, 'w', newline='') as csvfile:
writer = csv.writer(csvfile, delimiter=',',
quotechar='|', quoting=csv.QUOTE_MINIMAL)
dict_x = self._trad.get_dict("values_x")
header = []
writer.writerow(first_line)
for text in val_dict.keys():
header.append(text)
writer.writerow(header)
for row in range(len(val_dict[dict_x[x]])):
line = []
for var in val_dict.keys():
line.append(val_dict[var][row])
writer.writerow(line)
try:
with open(filename, 'w', newline='') as csvfile:
writer = csv.writer(csvfile, delimiter=',',
quotechar='|', quoting=csv.QUOTE_MINIMAL)
dict_x = self._trad.get_dict("values_x")
header = []
writer.writerow(first_line)
for text in val_dict.keys():
header.append(text)
writer.writerow(header)
for row in range(len(val_dict[dict_x[x]])):
line = []
for var in val_dict.keys():
line.append(val_dict[var][row])
writer.writerow(line)
self._timer.stop()
except Exception as e:
self.message_box(
window_title=self._trad["Warning"],
text=self._trad["mb_write_error"],
informative_text=self._trad["mb_close_file"]
)
logger_exception(e)
def export_all(self, reach, directory, timestamps):
name = reach.name
@ -747,17 +801,25 @@ class ResultsWindow(PamhyrWindow):
f"reach_{name}.csv"
)
with open(file_name, 'w', newline='') as csvfile:
writer = csv.writer(csvfile, delimiter=',',
quotechar='|', quoting=csv.QUOTE_MINIMAL)
ts = timestamps[0]
writer.writerow(self._table["raw_data"]._headers)
for row in range(self._table["raw_data"].rowCount()):
line = []
for column in range(self._table["raw_data"].columnCount()):
index = self._table["raw_data"].index(row, column)
line.append(self._table["raw_data"].data(index))
writer.writerow(line)
try:
with open(file_name, 'w', newline='') as csvfile:
writer = csv.writer(csvfile, delimiter=',',
quotechar='|', quoting=csv.QUOTE_MINIMAL)
ts = timestamps[0]
writer.writerow(self._table["raw_data"]._headers)
for row in range(self._table["raw_data"].rowCount()):
line = []
for column in range(self._table["raw_data"].columnCount()):
index = self._table["raw_data"].index(row, column)
line.append(self._table["raw_data"].data(index))
writer.writerow(line)
except Exception as e:
self.message_box(
window_title=self._trad["Warning"],
text=self._trad["mb_write_errore"],
informative_text=self._trad["mb_close_file"]
)
logger_exception(e)
def export_current(self):
self.file_dialog(
@ -1166,50 +1228,17 @@ class ResultsWindow(PamhyrWindow):
# unselect all profiles but the first one
profile_id = self._get_current_profile()
self.update_table_selection_profile(profile_id)
tab_widget = self.find(QTabWidget, f"tabWidget")
tab_index = tab_widget.currentIndex()
name = tab_widget.tabText(tab_index)
if tab_index == 1:
self.plot_xy.update_all()
self.plot_ac.update_all()
self.plot_rkc.update_all()
elif tab_index == 2:
self.plot_h.update_all()
elif tab_index > 2:
self._additional_plot[name].update_all()
def import_geotiff(self):
# options = QFileDialog.Options()
# settings = QSettings(QSettings.IniFormat,
# QSettings.UserScope, 'MyOrg', )
# options |= QFileDialog.DontUseNativeDialog
#
# file_types = [
# self._trad["file_geotiff"],
# self._trad["file_all"],
# ]
#
# filename, _ = QFileDialog.getOpenFileName(
# self,
# self._trad["open_file"],
# "",
# ";; ".join(file_types),
# options=options
# )
#
# if filename != "":
# with rasterio.open(filename) as data:
# img = data.read()
# b = data.bounds[:]
# # b[0] left
# # b[1] bottom
# # b[2] right
# # b[3] top
# xlim = self.canvas.axes.get_xlim()
# ylim = self.canvas.axes.get_ylim()
# if b[2] > b[0] and b[1] < b[3]:
# self.canvas.axes.imshow(img.transpose((1, 2, 0)),
# extent=[b[0], b[2], b[1], b[3]])
# else:
# dlg = CoordinatesDialog(
# xlim,
# ylim,
# trad=self._trad,
# parent=self
# )
# if dlg.exec():
# self.canvas.axes.imshow(img.transpose((1, 2, 0)),
# extent=dlg.values)
# self.plot_xy.idle()
# self.canvas.axes.set_xlim(xlim)
# self.canvas.axes.set_ylim(ylim)
return

View File

@ -345,24 +345,29 @@ class ResultsWindowAdisTS(PamhyrWindow):
super(ResultsWindowAdisTS, self).closeEvent(event)
def _compute_status_label(self):
# Timestamp
ts = self._timestamps[self._slider_time.value()]
t0 = datetime.fromtimestamp(0)
fts = str(
datetime.fromtimestamp(ts) - t0
)
fts.replace("days", _translate("Results", "days"))\
.replace("day", _translate("Results", "day"))
return (self.text_bief() + " | " +
self.text_profile() + " | " +
self.text_pollutant() + " | " +
self.text_time())
def text_bief(self):
# Reach
table = self.find(QTableView, f"tableView_reach")
indexes = table.selectedIndexes()
if len(indexes) == 0:
reach = self._study.river.edges()[0]
reach = self._study.river.enable_edges()[0]
else:
reach = self._study.river.edges()[indexes[0].row()]
reach = self._study.river.enable_edges()[indexes[0].row()]
return f"{self._trad['reach']}: {reach.name}"
def text_profile(self):
# Reach
table = self.find(QTableView, f"tableView_reach")
indexes = table.selectedIndexes()
if len(indexes) == 0:
reach = self._study.river.enable_edges()[0]
else:
reach = self._study.river.enable_edges()[indexes[0].row()]
# Profile
table = self.find(QTableView, f"tableView_profile")
indexes = table.selectedIndexes()
@ -372,7 +377,24 @@ class ResultsWindowAdisTS(PamhyrWindow):
profile = reach.reach.profile(indexes[0].row())
pname = profile.name if profile.name != "" else profile.rk
return f"{self._trad['cross_section']}: {pname}"
def text_time(self):
# Timestamp
ts = self._timestamps[self._slider_time.value()]
t0 = datetime.fromtimestamp(0)
fts = str(
datetime.fromtimestamp(ts) - t0
)
fts = str(
datetime.fromtimestamp(ts) - t0
)
fts.replace("days", _translate("Results", "days"))\
.replace("day", _translate("Results", "day"))
return f"{self._trad['time']} : {fts} ({ts} sec)"
def text_pollutant(self):
# Pollutant
table = self.find(QTableView, f"tableView_pollutants")
indexes = table.selectedIndexes()
@ -381,10 +403,7 @@ class ResultsWindowAdisTS(PamhyrWindow):
self._results.pollutants_list[i.row()+1] for i in indexes
]
return (f"{self._trad['reach']}: {reach.name} | " +
f"{self._trad['cross_section']}: {pname} | " +
f"Pollutant: {', '.join(self.pollutant_label)} | " +
f"{self._trad['unit_time_s']} : {fts} ({ts} sec)")
return (f"Pollutant: {', '.join(self.pollutant_label)}")
def setup_statusbar(self):
txt = self._compute_status_label()

View File

@ -59,6 +59,13 @@ class ResultsTranslate(MainTranslate):
self._dict["ImageCoordinates"] = _translate(
"Results", "Image coordinates"
)
self._dict["mb_write_error"] = _translate(
"Results", "An error occured when writing to file"
)
self._dict["mb_close_file"] = _translate(
"Results",
"If the file is in use, close it and try again"
)
self._sub_dict["table_headers_reach"] = {
"name": _translate("Results", "Reach name"),

View File

@ -486,7 +486,8 @@ class SolverLogWindow(PamhyrWindow):
if self._results is None:
def reading_fn():
self._results = self._solver.results(
self._study, self._workdir, qlog=self._output
self._study, self._workdir,
qlog=self._output, name=self._study.name
)
dlg = ReadingResultsDialog(reading_fn=reading_fn, parent=self)

View File

@ -82,7 +82,7 @@ class SelectSolverWindowAdisTS(PamhyrDialog):
# solvers = self._config.solvers
# solvers mage
solvers = list(filter(
lambda x: "mage" not in x._type, self._config.solvers
lambda x: "adists" in x._type, self._config.solvers
))
solvers_name = list(
map(
@ -92,7 +92,8 @@ class SelectSolverWindowAdisTS(PamhyrDialog):
)
solvers_mage = list(filter(
lambda x: "mage" in x._type.lower(), self._config.solvers
lambda x: "mage" or "rubar" in x._type.lower(),
self._config.solvers
))
solvers_mage_names = list(map(lambda x: x._name, solvers_mage))

View File

@ -7,23 +7,13 @@
<x>0</x>
<y>0</y>
<width>194</width>
<height>70</height>
<height>126</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="4" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QSplitter" name="splitter">
<property name="orientation">
@ -64,6 +54,23 @@
</widget>
</widget>
</item>
<item row="5" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>

View File

@ -7,14 +7,24 @@
<x>0</x>
<y>0</y>
<width>414</width>
<height>70</height>
<height>132</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<item row="3" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -43,13 +53,10 @@
</widget>
</widget>
</item>
<item row="1" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>

View File

@ -22,7 +22,7 @@
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Upstream height (m)</string>
<string>Upstream elevation (m)</string>
</property>
</widget>
</item>
@ -70,7 +70,7 @@
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Downstream height (m)</string>
<string>Downstream elevation (m)</string>
</property>
</widget>
</item>

View File

@ -37,7 +37,7 @@ logger = logging.getLogger()
class Config(SQL):
def __init__(self):
self._version = '0.0.6'
self._version = '0.0.7'
self.filename = Config.filename()
self.set_default_value()
@ -101,6 +101,7 @@ class Config(SQL):
# Add default solver
posix = os.name == 'posix'
ext = "" if posix else ".exe"
path = os.path.join("@install_dir", "mage8", f"mage{ext}")
self.execute(f"""
INSERT INTO solver VALUES (
@ -111,7 +112,7 @@ class Config(SQL):
'', '', '',
'',
'@install_dir/mage/mage{ext} @args @input',
'{path} @args @input',
''
)
""")
@ -135,16 +136,19 @@ class Config(SQL):
if int(release) < 5:
posix = os.name == 'posix'
ext = "" if posix else ".exe"
path = os.path.join("@install_dir", "mage8", f"mage{ext}")
self.execute(
"UPDATE solver SET cmd_solver=" +
f"'@install_dir/mage8/mage{ext} @args @input' "
f"'{path} @args @input' "
"WHERE name='default-mage'"
)
if int(release) < 6:
posix = os.name == 'posix'
ext = "" if posix else ".exe"
path = os.path.join("@install_dir",
"adists", f"adists{ext}")
self.execute(f"""
INSERT INTO solver VALUES (
@ -155,16 +159,41 @@ class Config(SQL):
'', '', '',
'',
'@install_dir/adists/adists{ext} @args @input',
'{path} @args @input',
''
)
""")
self.execute(
"UPDATE solver SET cmd_solver=" +
f"'@install_dir/adists/adists{ext} @args @input' "
f"'{path} @args @input' "
"WHERE name='default-AdisTS'"
)
if int(release) < 7:
posix = os.name == 'posix'
ext = "" if posix else ".exe"
path = os.path.join("@install_dir",
"rubar", f"rubarbe{ext}")
self.execute(f"""
INSERT INTO solver VALUES (
'rubar3',
'default-Rubar3',
'Default Pamhyr2 Rubar 3 version',
'', '', '',
'',
'{path} @args @input',
''
)
""")
self.execute(
"UPDATE solver SET cmd_solver=" +
f"'{path} @args @input' "
"WHERE name='default-Rubar3'"
)
self.execute(
f"UPDATE info SET value='{self._version}' " +
"WHERE key='version'"
@ -327,14 +356,24 @@ class Config(SQL):
ctor = solver_type_list["mage8"]
new = ctor("default-mage")
new._description = "Default Pamhyr2 mage 8 version"
new._cmd_solver = f""""@install_dir/mage8/mage{ext}" @args @input"""
path = os.path.join("@install_dir", "mage8", "mage")
new._cmd_solver = f""""{path}{ext}" @args @input"""
self._solvers.append(new)
# AdisTS
ctor = solver_type_list["adistswc"]
new = ctor("default-AdisTS")
new._description = "Default Pamhyr2 AdisTS version"
new._cmd_solver = f""""@install_dir/adists/adists{ext}" @args @input"""
path = os.path.join("@install_dir", "adists", "adists")
new._cmd_solver = f""""{path}{ext}" @args @input"""
self._solvers.append(new)
# Rubar3
ctor = solver_type_list["rubar3"]
new = ctor("default-Rubar3")
new._description = "Default Pamhyr2 Rubar 3 version"
path = os.path.join("@install_dir", "rubar", f"rubarbe{ext}")
new._cmd_solver = f""""{path}" @args @input"""
self._solvers.append(new)
# Mage fake 7

View File

@ -735,12 +735,12 @@ Cette fonctionnalité nécessite un bief muni d&apos;une géométrie.</translati
<translation>Dernière modification :</translation>
</message>
<message>
<location filename="../View/ui/CustomExportAdisDialog.ui" line="37"/>
<location filename="../View/ui/CustomExportAdisDialog.ui" line="27"/>
<source>X axis:</source>
<translation>Axe X :</translation>
</message>
<message>
<location filename="../View/ui/CustomExportAdisDialog.ui" line="48"/>
<location filename="../View/ui/CustomExportAdisDialog.ui" line="38"/>
<source>Y axis:</source>
<translation>Axe Y :</translation>
</message>
@ -750,32 +750,32 @@ Cette fonctionnalité nécessite un bief muni d&apos;une géométrie.</translati
<translation>Débit</translation>
</message>
<message>
<location filename="../View/ui/MeshingOptions.ui" line="168"/>
<location filename="../View/ui/MeshingOptions.ui" line="128"/>
<source>First cross-section</source>
<translation>Première section en travers</translation>
</message>
<message>
<location filename="../View/ui/MeshingOptions.ui" line="189"/>
<location filename="../View/ui/MeshingOptions.ui" line="149"/>
<source>Last cross-section</source>
<translation>Dernière section en travers</translation>
</message>
<message>
<location filename="../View/ui/MeshingOptions.ui" line="133"/>
<source>First guideline</source>
<translation>Première ligne directrice</translation>
<translation type="obsolete">Première ligne directrice</translation>
</message>
<message>
<location filename="../View/ui/MeshingOptions.ui" line="114"/>
<source>Guideline used for distance computation</source>
<translation>Lignes directrices pour le calcul des distances</translation>
<translation type="obsolete">Lignes directrices pour le calcul des distances</translation>
</message>
<message>
<location filename="../View/ui/MeshingOptions.ui" line="79"/>
<location filename="../View/ui/MeshingOptions.ui" line="69"/>
<source>Spline</source>
<translation>Spline</translation>
</message>
<message>
<location filename="../View/ui/MeshingOptions.ui" line="89"/>
<location filename="../View/ui/MeshingOptions.ui" line="79"/>
<source>Linear</source>
<translation>Linéaire</translation>
</message>
@ -805,7 +805,7 @@ Cette fonctionnalité nécessite un bief muni d&apos;une géométrie.</translati
<translation>Ligne</translation>
</message>
<message>
<location filename="../View/ui/MeshingOptions.ui" line="157"/>
<location filename="../View/ui/MeshingOptions.ui" line="117"/>
<source>Limits</source>
<translation>Limites</translation>
</message>
@ -815,12 +815,12 @@ Cette fonctionnalité nécessite un bief muni d&apos;une géométrie.</translati
<translation>Options</translation>
</message>
<message>
<location filename="../View/ui/MeshingOptions.ui" line="36"/>
<location filename="../View/ui/MeshingOptions.ui" line="26"/>
<source>Space step (m)</source>
<translation>Pas d&apos;espace (m)</translation>
</message>
<message>
<location filename="../View/ui/MeshingOptions.ui" line="70"/>
<location filename="../View/ui/MeshingOptions.ui" line="60"/>
<source>Type of interpolation:</source>
<translation>Type d&apos;interpolation :</translation>
</message>
@ -855,7 +855,7 @@ Cette fonctionnalité nécessite un bief muni d&apos;une géométrie.</translati
<translation>Valeur à l&apos;origine</translation>
</message>
<message>
<location filename="../View/ui/MeshingOptions.ui" line="30"/>
<location filename="../View/ui/MeshingOptions.ui" line="20"/>
<source>Parameters</source>
<translation>Paramètres</translation>
</message>
@ -867,7 +867,7 @@ Cette fonctionnalité nécessite un bief muni d&apos;une géométrie.</translati
<message>
<location filename="../View/ui/MeshingOptions.ui" line="123"/>
<source>Second guideline</source>
<translation>Seconde ligne directrice</translation>
<translation type="obsolete">Seconde ligne directrice</translation>
</message>
<message>
<location filename="../View/ui/GeometryReachShift.ui" line="35"/>
@ -907,12 +907,12 @@ Cette fonctionnalité nécessite un bief muni d&apos;une géométrie.</translati
<message>
<location filename="../View/ui/InitialConditions_Dialog_Generator_Height.ui" line="25"/>
<source>Upstream height (m)</source>
<translation>Cote à l&apos;amont (m)</translation>
<translation type="obsolete">Cote à l&apos;amont (m)</translation>
</message>
<message>
<location filename="../View/ui/InitialConditions_Dialog_Generator_Height.ui" line="73"/>
<source>Downstream height (m)</source>
<translation>Cote à l&apos;aval (m)</translation>
<translation type="obsolete">Cote à l&apos;aval (m)</translation>
</message>
<message>
<location filename="../View/ui/InitialConditions_Dialog_Generator_Height.ui" line="107"/>
@ -955,7 +955,7 @@ Cette fonctionnalité nécessite un bief muni d&apos;une géométrie.</translati
<translation>Débit (m³/s)</translation>
</message>
<message>
<location filename="../View/ui/CustomExportAdisDialog.ui" line="59"/>
<location filename="../View/ui/CustomExportAdisDialog.ui" line="49"/>
<source>Pollutant:</source>
<translation>Polluant:</translation>
</message>
@ -1004,6 +1004,21 @@ Cette fonctionnalité nécessite un bief muni d&apos;une géométrie.</translati
<source>Image coordinates</source>
<translation type="obsolete">Coordonnées de l&apos;image</translation>
</message>
<message>
<location filename="../View/ui/CustomExportAdisDialog.ui" line="70"/>
<source>TextLabel</source>
<translation>TextLabel</translation>
</message>
<message>
<location filename="../View/ui/InitialConditions_Dialog_Generator_Height.ui" line="25"/>
<source>Upstream elevation (m)</source>
<translation>Cote amont</translation>
</message>
<message>
<location filename="../View/ui/InitialConditions_Dialog_Generator_Height.ui" line="73"/>
<source>Downstream elevation (m)</source>
<translation>Cote aval</translation>
</message>
</context>
<context>
<name>Documentation</name>
@ -1308,12 +1323,12 @@ Cette fonctionnalité nécessite un bief muni d&apos;une géométrie.</translati
<context>
<name>Frictions</name>
<message>
<location filename="../View/Frictions/translate.py" line="45"/>
<location filename="../View/Frictions/translate.py" line="49"/>
<source>Start (m)</source>
<translation>PK de départ (m)</translation>
</message>
<message>
<location filename="../View/Frictions/translate.py" line="46"/>
<location filename="../View/Frictions/translate.py" line="50"/>
<source>End (m)</source>
<translation>PK de fin (m)</translation>
</message>
@ -1333,10 +1348,20 @@ Cette fonctionnalité nécessite un bief muni d&apos;une géométrie.</translati
<translation>Strickler ($m^{1/3}/s$)</translation>
</message>
<message>
<location filename="../View/Frictions/translate.py" line="47"/>
<location filename="../View/Frictions/translate.py" line="51"/>
<source>Coefficient</source>
<translation>Coefficient</translation>
</message>
<message>
<location filename="../View/Frictions/translate.py" line="41"/>
<source>Mage initial frictions file (*.RUG *.rug)</source>
<translation>Fichier de frottements Mage (*.RUG *.rug)</translation>
</message>
<message>
<location filename="../View/Frictions/translate.py" line="43"/>
<source>All files (*)</source>
<translation>Tous les fichiers (*)</translation>
</message>
</context>
<context>
<name>GeoTIFF</name>
@ -1581,12 +1606,12 @@ Cette fonctionnalité nécessite un bief muni d&apos;une géométrie.</translati
<translation>Évaporation</translation>
</message>
<message>
<location filename="../View/LateralContribution/translate.py" line="60"/>
<location filename="../View/LateralContribution/translate.py" line="65"/>
<source>Start (m)</source>
<translation>PK de départ (m)</translation>
</message>
<message>
<location filename="../View/LateralContribution/translate.py" line="61"/>
<location filename="../View/LateralContribution/translate.py" line="66"/>
<source>End (m)</source>
<translation>PK de fin (m)</translation>
</message>
@ -1605,6 +1630,21 @@ Cette fonctionnalité nécessite un bief muni d&apos;une géométrie.</translati
<source>End rk (m)</source>
<translation>Pk fin</translation>
</message>
<message>
<location filename="../View/LateralContribution/translate.py" line="55"/>
<source>Shapefile (*.LAT *.lat)</source>
<translation type="obsolete">Shapefile (*.LAT *.lat)</translation>
</message>
<message>
<location filename="../View/LateralContribution/translate.py" line="58"/>
<source>All files (*)</source>
<translation>Tous les fichiers (*)</translation>
</message>
<message>
<location filename="../View/LateralContribution/translate.py" line="55"/>
<source>Mage lateral contributions file (*.LAT *.lat)</source>
<translation>Fichiers d&apos;apports latéraux Mage (*.LAT *.lat)</translation>
</message>
</context>
<context>
<name>LateralContributionAdisTS</name>
@ -2117,7 +2157,7 @@ Cette fonctionnalité nécessite un bief muni d&apos;une géométrie.</translati
<translation>Suspension</translation>
</message>
<message>
<location filename="../View/ui/LateralContributions.ui" line="117"/>
<location filename="../View/ui/LateralContributions.ui" line="118"/>
<source>Add a new boundary condition or lateral source</source>
<translation>Ajouter une condition aux limites ou un apport latéral</translation>
</message>
@ -2127,7 +2167,7 @@ Cette fonctionnalité nécessite un bief muni d&apos;une géométrie.</translati
<translation>Supprimer les lignes selectionnées</translation>
</message>
<message>
<location filename="../View/ui/LateralContributions.ui" line="147"/>
<location filename="../View/ui/LateralContributions.ui" line="148"/>
<source>Edit boundary condition or lateral source</source>
<translation>Éditer une condition aux limites ou un apport latéral</translation>
</message>
@ -2212,7 +2252,7 @@ Cette fonctionnalité nécessite un bief muni d&apos;une géométrie.</translati
<translation>supprimer</translation>
</message>
<message>
<location filename="../View/ui/Frictions.ui" line="104"/>
<location filename="../View/ui/Frictions.ui" line="105"/>
<source>Edit Strickler coefficients</source>
<translation>Éditer les coefficients de Strickler</translation>
</message>
@ -2689,17 +2729,17 @@ Cette fonctionnalité nécessite un bief muni d&apos;une géométrie.</translati
<message>
<location filename="../View/ui/InitialConditions.ui" line="30"/>
<source>Generate uniform depth</source>
<translation>Générer une profondeur uniforme</translation>
<translation>Profondeur uniforme</translation>
</message>
<message>
<location filename="../View/ui/InitialConditions.ui" line="37"/>
<source>Generate uniform discharge</source>
<translation>Générer un débit uniforme</translation>
<translation>Débit uniforme</translation>
</message>
<message>
<location filename="../View/ui/InitialConditions.ui" line="44"/>
<source>Generate uniform elevation</source>
<translation>Générer une cote uniforme</translation>
<translation>Cote uniforme</translation>
</message>
<message>
<location filename="../View/ui/Results.ui" line="149"/>
@ -3176,7 +3216,7 @@ Cette fonctionnalité nécessite un bief muni d&apos;une géométrie.</translati
<translation>Lecture des résultats</translation>
</message>
<message>
<location filename="../View/Results/translate.py" line="154"/>
<location filename="../View/Results/translate.py" line="161"/>
<source>Water elevation</source>
<translation>Cote de l&apos;eau</translation>
</message>
@ -3186,12 +3226,12 @@ Cette fonctionnalité nécessite un bief muni d&apos;une géométrie.</translati
<translation>Cote maximum de l&apos;eau</translation>
</message>
<message>
<location filename="../View/Results/translate.py" line="64"/>
<location filename="../View/Results/translate.py" line="71"/>
<source>Reach name</source>
<translation>Nom du bief</translation>
</message>
<message>
<location filename="../View/Results/translate.py" line="160"/>
<location filename="../View/Results/translate.py" line="167"/>
<source>Profile</source>
<translation>Profil</translation>
</message>
@ -3246,12 +3286,12 @@ Cette fonctionnalité nécessite un bief muni d&apos;une géométrie.</translati
<translation>Masse min</translation>
</message>
<message>
<location filename="../View/Results/translate.py" line="68"/>
<location filename="../View/Results/translate.py" line="75"/>
<source>Variables names</source>
<translation>Noms des variables</translation>
</message>
<message>
<location filename="../View/Results/translate.py" line="81"/>
<location filename="../View/Results/translate.py" line="88"/>
<source>Pollutant name</source>
<translation>Nom des polluants</translation>
</message>
@ -3261,7 +3301,7 @@ Cette fonctionnalité nécessite un bief muni d&apos;une géométrie.</translati
<translation type="obsolete">enveloppe</translation>
</message>
<message>
<location filename="../View/Results/translate.py" line="72"/>
<location filename="../View/Results/translate.py" line="79"/>
<source>Profile name</source>
<translation>Nom du profil</translation>
</message>
@ -3290,6 +3330,26 @@ Cette fonctionnalité nécessite un bief muni d&apos;une géométrie.</translati
<source>All files (*)</source>
<translation>Tous les fichiers (*)</translation>
</message>
<message>
<location filename="../View/Results/translate.py" line="62"/>
<source>An error occured when writing to file</source>
<translation>Une erreur s&apos;est produite lors de l&apos;écriture dans le fichier</translation>
</message>
<message>
<location filename="../View/Results/translate.py" line="65"/>
<source>If the file is open in another application, close it and try again</source>
<translation type="obsolete">Si le fichier est ouvert dans une autre application, fermez-la et recommencez</translation>
</message>
<message>
<location filename="../View/Results/translate.py" line="65"/>
<source>If the file is open in another application, close it and try again</source>
<translation type="obsolete">Si le fichier est ouvert dans une autre application, fermez-la et recommencez</translation>
</message>
<message>
<location filename="../View/Results/translate.py" line="65"/>
<source>If the file is in use, close it and try again</source>
<translation>Si le fichier est en cours d&apos;utilisation, fermez-le et recommencez</translation>
</message>
</context>
<context>
<name>SedimentLayers</name>