wolfhece 2.1.77__py3-none-any.whl → 2.1.79__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- wolfhece/PyDraw.py +8 -1
- wolfhece/acceptability/acceptability.py +563 -551
- wolfhece/acceptability/acceptability_gui.py +331 -328
- wolfhece/acceptability/func.py +1597 -1637
- wolfhece/apps/hydrometry.py +28 -0
- wolfhece/apps/version.py +1 -1
- wolfhece/cli.py +5 -0
- wolfhece/hydrometry/kiwis.py +131 -16
- wolfhece/hydrometry/kiwis_gui.py +38 -3
- {wolfhece-2.1.77.dist-info → wolfhece-2.1.79.dist-info}/METADATA +1 -1
- {wolfhece-2.1.77.dist-info → wolfhece-2.1.79.dist-info}/RECORD +14 -14
- {wolfhece-2.1.77.dist-info → wolfhece-2.1.79.dist-info}/WHEEL +1 -1
- {wolfhece-2.1.77.dist-info → wolfhece-2.1.79.dist-info}/entry_points.txt +2 -0
- wolfhece/hydrometry/kiwispie.py +0 -379
- {wolfhece-2.1.77.dist-info → wolfhece-2.1.79.dist-info}/top_level.txt +0 -0
@@ -1,328 +1,331 @@
|
|
1
|
-
"""
|
2
|
-
Author: University of Liege, HECE
|
3
|
-
Date: 2024
|
4
|
-
|
5
|
-
Copyright (c) 2024 University of Liege. All rights reserved.
|
6
|
-
|
7
|
-
This script and its content are protected by copyright law. Unauthorized
|
8
|
-
copying or distribution of this file, via any medium, is strictly prohibited.
|
9
|
-
"""
|
10
|
-
|
11
|
-
from .acceptability import Base_data_creation, Database_to_raster, Vulnerability, Acceptability
|
12
|
-
from .
|
13
|
-
|
14
|
-
|
15
|
-
import
|
16
|
-
import
|
17
|
-
|
18
|
-
from matplotlib.
|
19
|
-
from matplotlib.backends.backend_wxagg import
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
self.
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
self.
|
66
|
-
|
67
|
-
self.
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
self.
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
self.
|
79
|
-
self.
|
80
|
-
|
81
|
-
self.
|
82
|
-
self.
|
83
|
-
|
84
|
-
self.
|
85
|
-
self.
|
86
|
-
|
87
|
-
|
88
|
-
self.
|
89
|
-
|
90
|
-
|
91
|
-
self.
|
92
|
-
|
93
|
-
self.
|
94
|
-
self.
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
self.
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
self.
|
135
|
-
self.
|
136
|
-
|
137
|
-
self.
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
panel.
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
self.
|
153
|
-
self.
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
logging.error(
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
self.
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
self.
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
self.
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
if
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
1
|
+
"""
|
2
|
+
Author: University of Liege, HECE
|
3
|
+
Date: 2024
|
4
|
+
|
5
|
+
Copyright (c) 2024 University of Liege. All rights reserved.
|
6
|
+
|
7
|
+
This script and its content are protected by copyright law. Unauthorized
|
8
|
+
copying or distribution of this file, via any medium, is strictly prohibited.
|
9
|
+
"""
|
10
|
+
|
11
|
+
from .acceptability import Base_data_creation, Database_to_raster, Vulnerability, Acceptability
|
12
|
+
from .acceptability import steps_base_data_creation, steps_vulnerability, steps_acceptability
|
13
|
+
from .func import Accept_Manager
|
14
|
+
|
15
|
+
import wx
|
16
|
+
import logging
|
17
|
+
import matplotlib
|
18
|
+
from matplotlib.figure import Figure
|
19
|
+
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
|
20
|
+
from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg as NavigationToolbar2Wx
|
21
|
+
import os
|
22
|
+
from gettext import gettext as _
|
23
|
+
|
24
|
+
class AcceptabilityGui(wx.Frame):
|
25
|
+
""" The main frame for the vulnerability/acceptability computation """
|
26
|
+
|
27
|
+
def __init__(self, parent=None, width=1024, height=500):
|
28
|
+
|
29
|
+
super(wx.Frame, self).__init__(parent, title='Acceptability', size=(width, height))
|
30
|
+
|
31
|
+
self._manager = None
|
32
|
+
self._mapviewer = None
|
33
|
+
|
34
|
+
self.InitUI()
|
35
|
+
|
36
|
+
@property
|
37
|
+
def mapviewer(self):
|
38
|
+
return self._mapviewer
|
39
|
+
|
40
|
+
@mapviewer.setter
|
41
|
+
def mapviewer(self, value):
|
42
|
+
from ..PyDraw import WolfMapViewer
|
43
|
+
|
44
|
+
if not isinstance(value, WolfMapViewer):
|
45
|
+
raise TypeError("The mapviewer must be a WolfMapViewer")
|
46
|
+
|
47
|
+
self._mapviewer = value
|
48
|
+
|
49
|
+
def InitUI(self):
|
50
|
+
|
51
|
+
sizer_hor_main = wx.BoxSizer(wx.HORIZONTAL)
|
52
|
+
|
53
|
+
sizer_vert1 = wx.BoxSizer(wx.VERTICAL)
|
54
|
+
|
55
|
+
sizer_hor_threads = wx.BoxSizer(wx.HORIZONTAL)
|
56
|
+
sizer_hor1 = wx.BoxSizer(wx.HORIZONTAL)
|
57
|
+
sizer_hor1_1 = wx.BoxSizer(wx.HORIZONTAL)
|
58
|
+
sizer_hor2 = wx.BoxSizer(wx.HORIZONTAL)
|
59
|
+
sizer_hor3 = wx.BoxSizer(wx.HORIZONTAL)
|
60
|
+
sizer_hor4 = wx.BoxSizer(wx.HORIZONTAL)
|
61
|
+
|
62
|
+
panel = wx.Panel(self)
|
63
|
+
|
64
|
+
self._but_maindir = wx.Button(panel, label='Main Directory')
|
65
|
+
self._but_maindir.Bind(wx.EVT_BUTTON, self.OnMainDir)
|
66
|
+
|
67
|
+
self._listbox_studyarea = wx.ListBox(panel, choices=[], style=wx.LB_SINGLE)
|
68
|
+
self._listbox_studyarea.Bind(wx.EVT_LISTBOX, self.OnStudyArea)
|
69
|
+
self._listbox_studyarea.SetToolTip("Choose the study area")
|
70
|
+
|
71
|
+
self._listbox_scenario = wx.ListBox(panel, choices=[], style=wx.LB_SINGLE)
|
72
|
+
self._listbox_scenario.Bind(wx.EVT_LISTBOX, self.OnScenario)
|
73
|
+
self._listbox_scenario.SetToolTip("Choose the scenario")
|
74
|
+
|
75
|
+
|
76
|
+
self._text_process = wx.StaticText(panel, label='Number of threads:')
|
77
|
+
|
78
|
+
self._nb_process = wx.SpinCtrl(panel, value=str(os.cpu_count()), min=1, max=os.cpu_count())
|
79
|
+
self._nb_process.SetToolTip("Number of threads to use")
|
80
|
+
|
81
|
+
sizer_hor_threads.Add(self._text_process, 1, wx.ALL | wx.EXPAND, 0)
|
82
|
+
sizer_hor_threads.Add(self._nb_process, 1, wx.ALL | wx.EXPAND, 0)
|
83
|
+
|
84
|
+
sizer_hor1.Add(self._but_maindir, 2, wx.ALL | wx.EXPAND, 0)
|
85
|
+
sizer_hor1.Add(self._listbox_studyarea, 1, wx.ALL | wx.EXPAND, 0)
|
86
|
+
sizer_hor1.Add(self._listbox_scenario, 1, wx.ALL | wx.EXPAND, 0)
|
87
|
+
|
88
|
+
self._but_checkfiles = wx.Button(panel, label='Check Files')
|
89
|
+
self._but_checkfiles.Bind(wx.EVT_BUTTON, self.OnCheckFiles)
|
90
|
+
|
91
|
+
sizer_hor1_1.Add(self._but_checkfiles, 1, wx.ALL | wx.EXPAND, 0)
|
92
|
+
|
93
|
+
self._but_creation = wx.Button(panel, label='DataBase Creation')
|
94
|
+
self._but_creation.Bind(wx.EVT_BUTTON, self.OnCreation)
|
95
|
+
|
96
|
+
self._steps_db = wx.CheckListBox(panel, choices=steps_base_data_creation.get_list_names(), style=wx.LB_MULTIPLE | wx.CHK_CHECKED)
|
97
|
+
|
98
|
+
self._but_vulnerability = wx.Button(panel, label='Vulnerability')
|
99
|
+
self._but_vulnerability.Bind(wx.EVT_BUTTON, self.OnVulnerability)
|
100
|
+
|
101
|
+
self._steps_vulnerability = wx.CheckListBox(panel, choices=steps_vulnerability.get_list_names(), style=wx.LB_MULTIPLE | wx.CHK_CHECKED)
|
102
|
+
|
103
|
+
self._but_acceptability = wx.Button(panel, label='Acceptability')
|
104
|
+
self._but_acceptability.Bind(wx.EVT_BUTTON, self.OnAcceptability)
|
105
|
+
|
106
|
+
self._steps_acceptability = wx.CheckListBox(panel, choices=steps_acceptability.get_list_names(), style=wx.LB_MULTIPLE | wx.CHK_CHECKED)
|
107
|
+
|
108
|
+
sizer_hor2.Add(self._but_creation, 1, wx.ALL | wx.EXPAND, 0)
|
109
|
+
sizer_hor2.Add(self._steps_db, 1, wx.ALL | wx.EXPAND, 0)
|
110
|
+
|
111
|
+
sizer_hor3.Add(self._but_vulnerability, 1, wx.ALL | wx.EXPAND, 0)
|
112
|
+
sizer_hor3.Add(self._steps_vulnerability, 1, wx.ALL | wx.EXPAND, 0)
|
113
|
+
|
114
|
+
sizer_hor4.Add(self._but_acceptability, 1, wx.ALL | wx.EXPAND, 0)
|
115
|
+
sizer_hor4.Add(self._steps_acceptability, 1, wx.ALL | wx.EXPAND, 0)
|
116
|
+
|
117
|
+
sizer_vert1.Add(sizer_hor1, 2, wx.EXPAND, 0)
|
118
|
+
sizer_vert1.Add(sizer_hor1_1, 1, wx.EXPAND, 0)
|
119
|
+
sizer_vert1.Add(sizer_hor_threads, 0, wx.EXPAND, 0)
|
120
|
+
sizer_vert1.Add(sizer_hor2, 1, wx.EXPAND, 0)
|
121
|
+
sizer_vert1.Add(sizer_hor3, 1, wx.EXPAND, 0)
|
122
|
+
sizer_vert1.Add(sizer_hor4, 1, wx.EXPAND, 0)
|
123
|
+
|
124
|
+
# ------
|
125
|
+
|
126
|
+
sizer_vert2 = wx.BoxSizer(wx.VERTICAL)
|
127
|
+
|
128
|
+
self._listbox_returnperiods = wx.ListBox(panel, choices=[], style=wx.LB_SINGLE)
|
129
|
+
self._listbox_returnperiods.SetToolTip("All available return periods in the database")
|
130
|
+
|
131
|
+
self._listbox_sims = wx.ListBox(panel, choices=[], style=wx.LB_SINGLE)
|
132
|
+
self._listbox_sims.SetToolTip("All available simulations in the database")
|
133
|
+
|
134
|
+
self._listbox_sims.Bind(wx.EVT_LISTBOX, self.OnSims)
|
135
|
+
self._listbox_sims.Bind(wx.EVT_LISTBOX_DCLICK, self.OnSimsDBLClick)
|
136
|
+
|
137
|
+
sizer_vert2.Add(self._listbox_returnperiods, 1, wx.EXPAND, 0)
|
138
|
+
sizer_vert2.Add(self._listbox_sims, 1, wx.EXPAND, 0)
|
139
|
+
|
140
|
+
# ------
|
141
|
+
|
142
|
+
sizer_vert3 = wx.BoxSizer(wx.VERTICAL)
|
143
|
+
|
144
|
+
matplotlib.use('WXAgg')
|
145
|
+
|
146
|
+
self._figure = Figure(figsize=(5, 4), dpi=100)
|
147
|
+
self._axes = self._figure.add_subplot(111)
|
148
|
+
self._canvas = FigureCanvas(panel, -1, self._figure)
|
149
|
+
self._toolbar = NavigationToolbar2Wx(self._canvas)
|
150
|
+
self._toolbar.Realize()
|
151
|
+
|
152
|
+
sizer_vert3.Add(self._canvas, 1, wx.EXPAND, 0)
|
153
|
+
sizer_vert3.Add(self._toolbar, 0, wx.LEFT | wx.EXPAND, 0)
|
154
|
+
|
155
|
+
# ------
|
156
|
+
|
157
|
+
sizer_hor_main.Add(sizer_vert1, 1, wx.EXPAND, 0)
|
158
|
+
sizer_hor_main.Add(sizer_vert2, 1, wx.EXPAND, 0)
|
159
|
+
sizer_hor_main.Add(sizer_vert3, 1, wx.EXPAND, 0)
|
160
|
+
|
161
|
+
panel.SetSizer(sizer_hor_main)
|
162
|
+
panel.Layout()
|
163
|
+
|
164
|
+
self._but_acceptability.Enable(False)
|
165
|
+
self._but_vulnerability.Enable(False)
|
166
|
+
self._but_creation.Enable(False)
|
167
|
+
|
168
|
+
def OnSims(self, e:wx.ListEvent):
|
169
|
+
""" Load sim into the mapviewer """
|
170
|
+
pass
|
171
|
+
|
172
|
+
def OnSimsDBLClick(self, e:wx.ListEvent):
|
173
|
+
""" Load sim into the mapviewer """
|
174
|
+
if self.mapviewer is None:
|
175
|
+
return
|
176
|
+
|
177
|
+
from ..PyDraw import draw_type
|
178
|
+
|
179
|
+
idx_sim = e.GetSelection()
|
180
|
+
tmppath = self._manager.get_filepath_for_return_period(self._manager.get_return_periods()[idx_sim])
|
181
|
+
if tmppath.stem not in self.mapviewer.get_list_keys(drawing_type=draw_type.ARRAYS):
|
182
|
+
self.mapviewer.add_object('array', filename=str(tmppath), id=tmppath.stem)
|
183
|
+
self.mapviewer.Refresh()
|
184
|
+
|
185
|
+
def OnCheckFiles(self, e):
|
186
|
+
""" Check the files """
|
187
|
+
|
188
|
+
if self._manager is None:
|
189
|
+
logging.error("No main directory selected -- Nothing to check")
|
190
|
+
return
|
191
|
+
|
192
|
+
ret = self._manager.check_files()
|
193
|
+
|
194
|
+
if ret == "":
|
195
|
+
logging.info("All files are present")
|
196
|
+
with wx.MessageDialog(self, "All files are present in the INPUT directory", "Info", wx.OK | wx.ICON_INFORMATION) as dlg:
|
197
|
+
dlg.ShowModal()
|
198
|
+
else:
|
199
|
+
logging.error(f"Missing files: {ret}")
|
200
|
+
with wx.MessageDialog(self, f"Missing files: \n{ret}", "Error", wx.OK | wx.ICON_ERROR) as dlg:
|
201
|
+
dlg.ShowModal()
|
202
|
+
|
203
|
+
def OnMainDir(self, e):
|
204
|
+
|
205
|
+
with wx.DirDialog(self, "Choose the main directory containing the data:",
|
206
|
+
style=wx.DD_DEFAULT_STYLE
|
207
|
+
) as dlg:
|
208
|
+
|
209
|
+
if dlg.ShowModal() == wx.ID_OK:
|
210
|
+
self._manager = Accept_Manager(dlg.GetPath(), Study_area=None)
|
211
|
+
|
212
|
+
self._listbox_studyarea.Clear()
|
213
|
+
self._listbox_studyarea.InsertItems(self._manager.get_list_studyareas(), 0)
|
214
|
+
|
215
|
+
self._listbox_scenario.Clear()
|
216
|
+
|
217
|
+
ret = self._manager.check_files()
|
218
|
+
|
219
|
+
if ret == "":
|
220
|
+
logging.info("All files are present")
|
221
|
+
self._but_acceptability.Enable(True)
|
222
|
+
self._but_vulnerability.Enable(True)
|
223
|
+
self._but_creation.Enable(True)
|
224
|
+
else:
|
225
|
+
logging.error(f"Missing files: {ret}")
|
226
|
+
with wx.MessageDialog(self, f"Missing files: \n{ret}", "Error", wx.OK | wx.ICON_ERROR) as dlg:
|
227
|
+
dlg.ShowModal()
|
228
|
+
|
229
|
+
else:
|
230
|
+
return
|
231
|
+
|
232
|
+
def OnStudyArea(self, e):
|
233
|
+
""" Change the study area """
|
234
|
+
|
235
|
+
if self._manager is None:
|
236
|
+
return
|
237
|
+
|
238
|
+
study_area:str = self._manager.get_list_studyareas(with_suffix=True)[e.GetSelection()]
|
239
|
+
self._manager.change_studyarea(study_area)
|
240
|
+
|
241
|
+
self._listbox_scenario.Clear()
|
242
|
+
self._listbox_scenario.InsertItems(self._manager.get_list_scenarios(), 0)
|
243
|
+
|
244
|
+
if self.mapviewer is not None:
|
245
|
+
tmp_path = self._manager.IN_STUDY_AREA / study_area
|
246
|
+
|
247
|
+
from ..PyDraw import draw_type
|
248
|
+
if not tmp_path.stem in self.mapviewer.get_list_keys(drawing_type=draw_type.VECTORS):
|
249
|
+
self.mapviewer.add_object('vector', filename=str(tmp_path), id=tmp_path.stem)
|
250
|
+
self.mapviewer.Refresh()
|
251
|
+
|
252
|
+
def OnScenario(self, e):
|
253
|
+
""" Change the scenario """
|
254
|
+
|
255
|
+
if self._manager is None:
|
256
|
+
return
|
257
|
+
|
258
|
+
scenario = self._manager.get_list_scenarios()[e.GetSelection()]
|
259
|
+
self._manager.change_scenario(scenario)
|
260
|
+
|
261
|
+
self._listbox_returnperiods.Clear()
|
262
|
+
rt = self._manager.get_return_periods()
|
263
|
+
self._listbox_returnperiods.InsertItems([str(crt) for crt in rt],0)
|
264
|
+
|
265
|
+
self._listbox_sims.Clear()
|
266
|
+
sims = [str(self._manager.get_filepath_for_return_period(currt).name) for currt in rt]
|
267
|
+
self._listbox_sims.InsertItems(sims, 0)
|
268
|
+
|
269
|
+
ponds = self._manager.get_ponderations()
|
270
|
+
|
271
|
+
self._axes.clear()
|
272
|
+
ponds.plot(ax=self._axes, kind='bar')
|
273
|
+
self._canvas.draw()
|
274
|
+
|
275
|
+
def OnCreation(self, e):
|
276
|
+
""" Create the database """
|
277
|
+
|
278
|
+
if self._manager is None:
|
279
|
+
return
|
280
|
+
|
281
|
+
steps = list(self._steps_db.GetCheckedStrings())
|
282
|
+
steps = [int(cur.split('-')[1]) for cur in steps]
|
283
|
+
|
284
|
+
if len(steps) == 0:
|
285
|
+
logging.error("No steps selected")
|
286
|
+
return
|
287
|
+
|
288
|
+
nb = int(self._nb_process.GetValue())
|
289
|
+
|
290
|
+
if nb == 1:
|
291
|
+
logging.warning("Running in single thread")
|
292
|
+
logging.warning("This may take a long time")
|
293
|
+
|
294
|
+
Base_data_creation(self._manager.main_dir, number_procs=nb, steps=steps)
|
295
|
+
|
296
|
+
|
297
|
+
def OnVulnerability(self, e):
|
298
|
+
""" Run the vulnerability """
|
299
|
+
|
300
|
+
if self._manager is None:
|
301
|
+
return
|
302
|
+
|
303
|
+
steps = list(self._steps_vulnerability.GetCheckedStrings())
|
304
|
+
steps = [int(cur.split('-')[1]) for cur in steps]
|
305
|
+
|
306
|
+
if len(steps) == 0:
|
307
|
+
logging.error("No steps selected")
|
308
|
+
return
|
309
|
+
|
310
|
+
Vulnerability(self._manager.main_dir,
|
311
|
+
scenario=self._manager.scenario,
|
312
|
+
Study_area=self._manager.Study_area,
|
313
|
+
steps=steps)
|
314
|
+
|
315
|
+
def OnAcceptability(self, e):
|
316
|
+
""" Run the acceptability """
|
317
|
+
|
318
|
+
if self._manager is None:
|
319
|
+
return
|
320
|
+
|
321
|
+
steps = list(self._steps_acceptability.GetCheckedStrings())
|
322
|
+
steps = [int(cur.split('-')[1]) for cur in steps]
|
323
|
+
|
324
|
+
if len(steps) == 0:
|
325
|
+
logging.error("No steps selected")
|
326
|
+
return
|
327
|
+
|
328
|
+
Acceptability(self._manager.main_dir,
|
329
|
+
scenario=self._manager.scenario,
|
330
|
+
Study_area=self._manager.Study_area,
|
331
|
+
steps=steps)
|