mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
Compare commits
25
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f0994dd801 | ||
|
|
d002eebd49 | ||
|
|
e3ffac9ce0 | ||
|
|
e8a4d5eeed | ||
|
|
fc090dadce | ||
|
|
25e4786484 | ||
|
|
81e85ab488 | ||
|
|
201b1099bd | ||
|
|
b6054dd633 | ||
|
|
912843be25 | ||
|
|
bf49a7fc87 | ||
|
|
d77be00bcc | ||
|
|
ff0fa8ae8e | ||
|
|
92f4793181 | ||
|
|
5eaac204d5 | ||
|
|
5357eb9735 | ||
|
|
0946212c4b | ||
|
|
d6ab44d18e | ||
|
|
1db1a543c7 | ||
|
|
3e92a0c40d | ||
|
|
f3c461cbd9 | ||
|
|
012408d19e | ||
|
|
f7e563e71a | ||
|
|
81c6d39c1a | ||
|
|
d682443e1d |
No files matched your search
+5
-5
@@ -180,7 +180,7 @@ unittest:
|
||||
- job: set-version
|
||||
artifacts: true
|
||||
script:
|
||||
- python3 -m venv venv
|
||||
- python3.12 -m venv venv
|
||||
- . venv/bin/activate
|
||||
- pip3 install -U pip
|
||||
- pip3 install -r ./full-requirements.txt
|
||||
@@ -198,7 +198,7 @@ test-pep8:
|
||||
- job: unittest
|
||||
script:
|
||||
# Setup virtual env
|
||||
- python3 -m venv venv
|
||||
- python3.12 -m venv venv
|
||||
- . venv/bin/activate
|
||||
- pip3 install -U pip
|
||||
- pip3 install -r ./requirements.txt
|
||||
@@ -276,7 +276,7 @@ build-developers-doc:
|
||||
- ./build.sh
|
||||
# Create html documentation
|
||||
- cd ../../src
|
||||
- python3 -m venv doc-venv
|
||||
- python3.12 -m venv doc-venv
|
||||
- . doc-venv/bin/activate
|
||||
- pip3 install -U pip
|
||||
- pip3 install -r ../full-requirements.txt
|
||||
@@ -326,13 +326,13 @@ build-linux:
|
||||
- mkdir -p linux
|
||||
- cd linux
|
||||
# Setup virtual env
|
||||
- python3 -m venv linux-venv
|
||||
- python3.12 -m venv linux-venv
|
||||
- . linux-venv/bin/activate
|
||||
- pip3 install -U pip
|
||||
- pip3 install -r ../requirements.txt
|
||||
- pip3 install -U -r ../requirements.txt
|
||||
# Run Pyinstaller
|
||||
- pyinstaller -y $HIDDEN_IMPORTS --paths linux-venv/lib/python3.8/site-packages ../src/pamhyr.py
|
||||
- pyinstaller -y $HIDDEN_IMPORTS --paths linux-venv/lib/python3.12/site-packages ../src/pamhyr.py
|
||||
# Create directory
|
||||
- mkdir -p pamhyr
|
||||
- mkdir -p pamhyr/_internal
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
PyQt5==5.15.4
|
||||
PyQt5==5.15.11
|
||||
PyQt5-Qt5==5.15.2
|
||||
PyQt5-sip==12.12.2
|
||||
PyQt5-sip==12.18.0
|
||||
PyQtWebEngine==5.15.6
|
||||
QScintilla>=2.14.1
|
||||
pyqtgraph>=0.12.1
|
||||
matplotlib>=3.7.1
|
||||
matplotlib==3.8.3
|
||||
numpy>=1.24.2
|
||||
colorama>=0.4.3
|
||||
pyinstaller>=5.11.0
|
||||
|
||||
@@ -48,7 +48,7 @@ copy /y ..\mage8-windows\libbief.dll pamhyr\mage8\
|
||||
|
||||
rem rubar
|
||||
mkdir pamhyr\rubar
|
||||
copy /y ..\adists-windows\rubarbe.exe pamhyr\rubar\
|
||||
copy /y ..\rubar-windows\rubarbe.exe pamhyr\rubar\
|
||||
|
||||
rem adists
|
||||
mkdir pamhyr\adists
|
||||
|
||||
+3
-3
@@ -1,10 +1,10 @@
|
||||
PyQt5==5.15.4
|
||||
PyQt5==5.15.11
|
||||
PyQt5-Qt5==5.15.2
|
||||
PyQt5-sip==12.12.2
|
||||
PyQt5-sip==12.18.0
|
||||
#PyQtWebEngine==5.15.6
|
||||
QScintilla>=2.14.1
|
||||
pyqtgraph>=0.12.1
|
||||
matplotlib>=3.7.1
|
||||
matplotlib==3.8.3
|
||||
numpy>=1.24.2
|
||||
colorama>=0.4.3
|
||||
pyinstaller>=5.11.0
|
||||
|
||||
+8
-19
@@ -139,19 +139,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
|
||||
@@ -183,11 +175,6 @@ class InternalMeshing(AMeshingTool):
|
||||
p = sect2.point(start2).copy()
|
||||
sect2.insert_point(start2, p)
|
||||
len2 += 1
|
||||
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)
|
||||
len2 = len1
|
||||
@@ -254,8 +241,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 tag1 != "np":
|
||||
sect2.point(start2+len2).name = tag2
|
||||
sect2.modified()
|
||||
|
||||
def update_rk(self, reach, begin_rk, end_rk,
|
||||
|
||||
@@ -80,6 +80,9 @@ class Profile(object):
|
||||
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)
|
||||
|
||||
@@ -88,6 +91,12 @@ class Profile(object):
|
||||
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),
|
||||
|
||||
@@ -197,8 +197,10 @@ class Reach(SQLSubModel):
|
||||
self.undelete([profile])
|
||||
profile.num = index
|
||||
else:
|
||||
profile.num = index
|
||||
self._profiles.insert(index, profile)
|
||||
gi = self.get_global_profil_index(index)
|
||||
profile.num = gi
|
||||
print(f"gi = {gi}")
|
||||
self._profiles.insert(gi, profile)
|
||||
|
||||
self.modified()
|
||||
|
||||
@@ -211,11 +213,12 @@ class Reach(SQLSubModel):
|
||||
Returns:
|
||||
Nothing.
|
||||
"""
|
||||
gi = [self.get_global_profil_index(i) for i in indexes]
|
||||
list(
|
||||
map(
|
||||
lambda p: p[1].set_as_deleted(),
|
||||
filter(
|
||||
lambda e: e[0] in indexes,
|
||||
lambda e: e[0] in gi,
|
||||
enumerate(self._profiles)
|
||||
)
|
||||
)
|
||||
@@ -231,11 +234,12 @@ class Reach(SQLSubModel):
|
||||
Returns:
|
||||
Nothing.
|
||||
"""
|
||||
gi = [self.get_global_profil_index(i) for i in indexes]
|
||||
self._profiles = list(
|
||||
map(
|
||||
lambda p: p[1],
|
||||
filter(
|
||||
lambda e: e[0] not in indexes,
|
||||
lambda e: e[0] not in gi,
|
||||
enumerate(self._profiles)
|
||||
)
|
||||
)
|
||||
@@ -931,3 +935,24 @@ class Reach(SQLSubModel):
|
||||
nr2._profiles = list(map(lambda p: p.cloned_for(nr2), nr2_profiles))
|
||||
|
||||
return nr1, nr2
|
||||
|
||||
def get_local_profil_index(self, index):
|
||||
local_index = -1
|
||||
for i, p in enumerate(self._profiles):
|
||||
if not p.is_deleted():
|
||||
local_index += 1
|
||||
if i == index:
|
||||
break
|
||||
|
||||
return local_index
|
||||
|
||||
def get_global_profil_index(self, index):
|
||||
local_index = -1
|
||||
for i, p in enumerate(self._profiles):
|
||||
if not p.is_deleted():
|
||||
local_index += 1
|
||||
if local_index == index:
|
||||
global_index = i
|
||||
break
|
||||
|
||||
return global_index
|
||||
@@ -537,7 +537,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)
|
||||
@@ -605,7 +608,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
|
||||
@@ -656,7 +662,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,
|
||||
|
||||
@@ -307,6 +307,22 @@ class Pollutants(SQLSubModel):
|
||||
def data(self):
|
||||
return self._data
|
||||
|
||||
@data.setter
|
||||
def data(self, data):
|
||||
self._data = [PollutantCharacteristics(type=int(data[0]),
|
||||
diametre=float(data[1]),
|
||||
rho=float(data[2]),
|
||||
porosity=float(data[3]),
|
||||
cdc_riv=float(data[4]),
|
||||
cdc_cas=float(data[5]),
|
||||
apd=float(data[6]),
|
||||
ac=float(data[7]),
|
||||
bc=float(data[8]),
|
||||
pollutant=self,
|
||||
status=self._status
|
||||
)
|
||||
]
|
||||
|
||||
@classmethod
|
||||
def _db_create(cls, execute, ext=""):
|
||||
execute(f"""
|
||||
@@ -397,7 +413,7 @@ class Pollutants(SQLSubModel):
|
||||
|
||||
data["pollutant"] = new_pollutant
|
||||
new_pollutant._data = PollutantCharacteristics._db_load(
|
||||
execute, data.copy()
|
||||
execute, data=data
|
||||
)
|
||||
|
||||
loaded.add(pid)
|
||||
@@ -421,7 +437,7 @@ class Pollutants(SQLSubModel):
|
||||
f"AND scenario = {self._status.scenario_id}"
|
||||
)
|
||||
execute(
|
||||
f"DELETE FROM pollutants_characteristics " +
|
||||
"DELETE FROM pollutants_characteristics " +
|
||||
f"WHERE pollutant = {self.id} " +
|
||||
f"AND scenario = {self._status.scenario_id}"
|
||||
)
|
||||
|
||||
@@ -31,7 +31,7 @@ class Scenario(SQLSubModel):
|
||||
id: int = -1,
|
||||
name: str = "",
|
||||
description: str = "",
|
||||
x: int = 0.0, y: int = 0.0,
|
||||
x: int = 1000.0, y: int = 1000.0,
|
||||
revision: int = 0,
|
||||
parent=None):
|
||||
super(Scenario, self).__init__()
|
||||
|
||||
@@ -260,7 +260,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.pamhyr_id:>3}".replace(" ", "0")
|
||||
|
||||
def get_node_name(self, node):
|
||||
"""Generate a 3 char name for node
|
||||
@@ -271,7 +271,7 @@ class AdisTS(CommandLineSolver):
|
||||
Returns:
|
||||
A 3 char name string
|
||||
"""
|
||||
n = node.id
|
||||
n = node.pamhyr_id
|
||||
|
||||
# print("node name id: ", n)
|
||||
|
||||
@@ -401,9 +401,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")
|
||||
|
||||
@@ -169,9 +169,8 @@ class Rubar3(CommandLineSolver):
|
||||
|
||||
it = iter(params)
|
||||
|
||||
line = 0
|
||||
while line < 27:
|
||||
param = next(it)
|
||||
param = next(it, None)
|
||||
while param is not None:
|
||||
name = param.name
|
||||
value = param.value
|
||||
|
||||
@@ -204,7 +203,7 @@ class Rubar3(CommandLineSolver):
|
||||
# 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:
|
||||
|
||||
@@ -55,9 +55,9 @@ class D90TableDefaultModel(PamhyrTableModel):
|
||||
row = index.row()
|
||||
column = index.column()
|
||||
|
||||
if self._headers[column] is "name":
|
||||
if self._headers[column] == "name":
|
||||
return self._data[row].name
|
||||
elif self._headers[column] is "d90":
|
||||
elif self._headers[column] == "d90":
|
||||
n = self._data[row].d90
|
||||
if n is None:
|
||||
return self._trad['not_associated']
|
||||
|
||||
@@ -130,8 +130,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)
|
||||
|
||||
+27
-3
@@ -26,7 +26,6 @@ from queue import Queue
|
||||
from functools import reduce
|
||||
from time import process_time_ns
|
||||
|
||||
from numpy.core.multiarray import where
|
||||
from platformdirs import user_cache_dir
|
||||
|
||||
from Solver.AdisTS import AdisTS
|
||||
@@ -1206,6 +1205,31 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||
Returns:
|
||||
Nothing
|
||||
"""
|
||||
if self._study is None:
|
||||
return
|
||||
if self._study.filename is None or self._study.filename == "":
|
||||
self.message_box(
|
||||
window_title=self._trad["Warning"],
|
||||
text=self._trad["mb_unsaved_study_title"],
|
||||
informative_text=self._trad["mb_unsaved_studyh_msg"]
|
||||
)
|
||||
|
||||
options = QFileDialog.Options()
|
||||
options |= QFileDialog.DontUseNativeDialog
|
||||
|
||||
file_name, _ = QFileDialog.getSaveFileName(
|
||||
self, "Save File",
|
||||
"", "Pamhyr(*.pamhyr)",
|
||||
options=options,
|
||||
)
|
||||
if file_name is None or file_name == "":
|
||||
return
|
||||
|
||||
if file_name.rsplit(".", 1)[-1] == "pamhyr":
|
||||
self._study.filename = file_name
|
||||
else:
|
||||
self._study.filename = file_name + ".pamhyr"
|
||||
|
||||
if self._study is not None:
|
||||
if self.sub_window_exists(
|
||||
ScenariosWindow,
|
||||
@@ -1785,10 +1809,10 @@ 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:
|
||||
if ".BIN" in file_name[0]:
|
||||
solver = Mage8("Mage8")
|
||||
else:
|
||||
solver = Rubar3("Rubar3")
|
||||
|
||||
@@ -80,7 +80,7 @@ class AddCommand(QUndoCommand):
|
||||
self._new = self._pollutants_lst.new(
|
||||
self._pollutants_lst, self._index
|
||||
)
|
||||
self._new._data = [[0, 0., 0., 0., 0., 0., 0., 0., 0.]]
|
||||
self._new.data = [0, 0., 0., 0., 0., 0., 0., 0., 0.]
|
||||
self._new_ic_adists = self._data.new(self._index, self._new.id)
|
||||
else:
|
||||
self._pollutants_lst.insert(self._index, self._new)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
)
|
||||
)
|
||||
@@ -402,7 +402,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 +410,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 +471,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 +479,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 +510,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 +524,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 +537,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 +566,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 +574,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
|
||||
)
|
||||
)
|
||||
@@ -603,10 +603,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()
|
||||
@@ -617,19 +617,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
|
||||
)
|
||||
)
|
||||
@@ -673,7 +673,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
|
||||
)
|
||||
)
|
||||
@@ -681,14 +681,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
|
||||
)
|
||||
)
|
||||
@@ -706,7 +706,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
|
||||
)
|
||||
)
|
||||
@@ -714,14 +714,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
|
||||
)
|
||||
)
|
||||
@@ -739,12 +739,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
|
||||
)
|
||||
@@ -753,12 +753,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
|
||||
)
|
||||
@@ -766,12 +766,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
|
||||
)
|
||||
@@ -790,7 +790,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
|
||||
)
|
||||
)
|
||||
@@ -798,14 +798,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
|
||||
)
|
||||
)
|
||||
@@ -862,8 +862,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
|
||||
@@ -878,10 +878,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")
|
||||
@@ -897,7 +897,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(
|
||||
@@ -914,8 +915,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,
|
||||
@@ -1102,16 +1103,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")
|
||||
@@ -1126,7 +1127,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(
|
||||
@@ -1138,8 +1140,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,
|
||||
@@ -1346,11 +1348,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],
|
||||
@@ -1373,13 +1376,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()
|
||||
@@ -1391,20 +1394,28 @@ 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()
|
||||
|
||||
|
||||
@@ -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]
|
||||
@@ -149,8 +150,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"]
|
||||
@@ -170,7 +180,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(
|
||||
@@ -233,6 +243,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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -68,6 +68,7 @@ class PlotXY(PamhyrPlot):
|
||||
|
||||
self._plot_img = {}
|
||||
|
||||
self._parent = parent
|
||||
self._timestamps = parent._timestamps
|
||||
self._current_timestamp = max(self._timestamps)
|
||||
self._current_reach_id = reach_id
|
||||
@@ -386,6 +387,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)
|
||||
|
||||
+62
-23
@@ -457,49 +457,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
|
||||
|
||||
@@ -534,6 +554,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()
|
||||
@@ -1195,6 +1223,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()
|
||||
|
||||
@@ -266,6 +266,15 @@ class MainTranslate(UnitTranslate):
|
||||
"incompatible study version"
|
||||
)
|
||||
|
||||
self._dict["mb_unsaved_study_title"] = _translate(
|
||||
"MainWindow", "Open scenarios window"
|
||||
)
|
||||
self._dict["mb_unsaved_studyh_msg"] = _translate(
|
||||
"MainWindow",
|
||||
"You must save your study to open "
|
||||
"the scenario windows"
|
||||
)
|
||||
|
||||
self._dict["x"] = _translate("MainWindow", "X (m)")
|
||||
self._dict["y"] = _translate("MainWindow", "Y (m)")
|
||||
self._dict["Yes"] = _translate("MainWindow", "Yes")
|
||||
|
||||
+31
-1
@@ -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()
|
||||
|
||||
@@ -165,6 +165,29 @@ class Config(SQL):
|
||||
"WHERE name='default-AdisTS'"
|
||||
)
|
||||
|
||||
if int(release) < 7:
|
||||
posix = os.name == 'posix'
|
||||
ext = "" if posix else ".exe"
|
||||
|
||||
self.execute(f"""
|
||||
INSERT INTO solver VALUES (
|
||||
'rubar3',
|
||||
'default-Rubar3',
|
||||
'Default Pamhyr2 Rubar 3 version',
|
||||
|
||||
'', '', '',
|
||||
|
||||
'',
|
||||
'@install_dir/rubar/rubar3{ext} @args @input',
|
||||
''
|
||||
)
|
||||
""")
|
||||
self.execute(
|
||||
"UPDATE solver SET cmd_solver=" +
|
||||
f"'@install_dir/rubar/rubar3{ext} @args @input' "
|
||||
"WHERE name='default-Rubar3'"
|
||||
)
|
||||
|
||||
self.execute(
|
||||
f"UPDATE info SET value='{self._version}' " +
|
||||
"WHERE key='version'"
|
||||
@@ -337,6 +360,13 @@ class Config(SQL):
|
||||
new._cmd_solver = f""""@install_dir/adists/adists{ext}" @args @input"""
|
||||
self._solvers.append(new)
|
||||
|
||||
# Rubar3
|
||||
ctor = solver_type_list["rubar3"]
|
||||
new = ctor("default-Rubar3")
|
||||
new._description = "Default Pamhyr2 RubarBE version"
|
||||
new._cmd_solver = f""""@install_dir/rubar/rubarbe{ext}" @args @input"""
|
||||
self._solvers.append(new)
|
||||
|
||||
# Mage fake 7
|
||||
# ctor = solver_type_list["mage_fake7"]
|
||||
# new = ctor("default-mage-fake-7")
|
||||
|
||||
+511
-218
File diff suppressed because it is too large.
Load diff
Binary file not shown.
Reference in new issue
Block a user