wolfhece 2.2.7__py3-none-any.whl → 2.2.9__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 +1 -1
- wolfhece/PyVertex.py +105 -19
- wolfhece/PyVertexvectors.py +73 -21
- wolfhece/apps/version.py +1 -1
- wolfhece/hydrology/Internal_variables.py +283 -0
- wolfhece/hydrology/Models_characteristics.py +223 -0
- wolfhece/hydrology/Optimisation.py +324 -14
- wolfhece/hydrology/SubBasin.py +112 -28
- wolfhece/hydrology/cst_exchanges.py +1 -0
- wolfhece/libs/WolfDll.dll +0 -0
- wolfhece/lifewatch.py +4 -0
- wolfhece/pydike.py +1 -1
- wolfhece/wolf_array.py +145 -15
- wolfhece/wolfresults_2D.py +7 -7
- {wolfhece-2.2.7.dist-info → wolfhece-2.2.9.dist-info}/METADATA +1 -1
- {wolfhece-2.2.7.dist-info → wolfhece-2.2.9.dist-info}/RECORD +19 -17
- {wolfhece-2.2.7.dist-info → wolfhece-2.2.9.dist-info}/WHEEL +0 -0
- {wolfhece-2.2.7.dist-info → wolfhece-2.2.9.dist-info}/entry_points.txt +0 -0
- {wolfhece-2.2.7.dist-info → wolfhece-2.2.9.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,283 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
from typing import Optional
|
3
|
+
from os.path import exists, join
|
4
|
+
import numpy as np
|
5
|
+
import logging
|
6
|
+
from datetime import datetime as date
|
7
|
+
from datetime import timezone
|
8
|
+
from dataclasses import dataclass
|
9
|
+
from . import read as rd
|
10
|
+
from ..PyParams import Wolf_Param
|
11
|
+
|
12
|
+
ALL_VAR = 0
|
13
|
+
IV_VAR = 1
|
14
|
+
FRAC_VAR = 2
|
15
|
+
FINAL_OUT_VAR = 3
|
16
|
+
OUT_VAR = 4
|
17
|
+
DEFAULT_VAR = 5
|
18
|
+
|
19
|
+
|
20
|
+
@dataclass(frozen=True)
|
21
|
+
class Internal_Variable:
|
22
|
+
"""
|
23
|
+
Class for managing internal variables in hydrological models.
|
24
|
+
"""
|
25
|
+
name:str
|
26
|
+
file:str
|
27
|
+
type_of_var:int
|
28
|
+
linked_param:int
|
29
|
+
|
30
|
+
|
31
|
+
def get_time_serie(self, directory, prefix_file:str="",
|
32
|
+
interval:Optional[tuple[date, date]]=None) -> tuple[np.ndarray, np.ndarray]:
|
33
|
+
"""
|
34
|
+
Get the time series of the internal variable.
|
35
|
+
|
36
|
+
:param interval: Optional interval for the time series.
|
37
|
+
:return: Time series of the internal variable.
|
38
|
+
"""
|
39
|
+
filename, full_path = self.get_filename(directory, prefix=prefix_file)
|
40
|
+
if filename is None:
|
41
|
+
return None, None
|
42
|
+
time, cur_iv = rd.read_hydro_file(directory, fileName=filename)
|
43
|
+
# select the interval if needed
|
44
|
+
if interval is not None:
|
45
|
+
# Check if the datetime in interva are in UTC timezone
|
46
|
+
if interval[0].tzinfo == timezone.utc or interval[1].tzinfo == timezone.utc:
|
47
|
+
interval = (interval[0].replace(tzinfo=timezone.utc),
|
48
|
+
interval[1].replace(tzinfo=timezone.utc))
|
49
|
+
t_start = interval[0].timestamp()
|
50
|
+
t_end = interval[1].timestamp()
|
51
|
+
time = time[(time >= t_start) & (time <= t_end)]
|
52
|
+
cur_iv = cur_iv[(time >= t_start) & (time <= t_end)]
|
53
|
+
else:
|
54
|
+
logging.error("Interval is not in UTC timezone!")
|
55
|
+
|
56
|
+
return time, cur_iv
|
57
|
+
|
58
|
+
|
59
|
+
def get_filename(self, directory:str, prefix:str="")->tuple[str, str]:
|
60
|
+
"""
|
61
|
+
Get the filename of the internal variable.
|
62
|
+
|
63
|
+
:param directory: Directory where the file is located.
|
64
|
+
:param prefix: Prefix for the filename.
|
65
|
+
:return: Tuple containing the name of the file only and the full path of the internal variable.
|
66
|
+
"""
|
67
|
+
filename = "".join([prefix,"_", self.file, ".dat"])
|
68
|
+
full_path = join(directory, filename)
|
69
|
+
# check if the file exists
|
70
|
+
if not exists(full_path):
|
71
|
+
logging.error(f"File {full_path} not found!")
|
72
|
+
return None, None
|
73
|
+
|
74
|
+
return filename, full_path
|
75
|
+
|
76
|
+
|
77
|
+
# @dataclass(frozen=True)
|
78
|
+
class Param_to_Activate:
|
79
|
+
"""
|
80
|
+
Class for managing parameters to activate in hydrological models.
|
81
|
+
"""
|
82
|
+
key: str
|
83
|
+
group: str
|
84
|
+
file: str
|
85
|
+
all_variables: list[Internal_Variable]
|
86
|
+
|
87
|
+
def __init__(self, key:str="", group:str="", file:str="", all_variables:list[Internal_Variable]=[]):
|
88
|
+
"""
|
89
|
+
Initialize the Params_to_Activate class with parameters for different models.
|
90
|
+
"""
|
91
|
+
self.key = key
|
92
|
+
self.group = group
|
93
|
+
self.file = file
|
94
|
+
self.all_variables = all_variables
|
95
|
+
|
96
|
+
def add_param_info(self, key:str, group:str, file:str):
|
97
|
+
"""
|
98
|
+
Add parameter information to the class.
|
99
|
+
"""
|
100
|
+
self.key = key
|
101
|
+
self.group = group
|
102
|
+
self.file = file
|
103
|
+
|
104
|
+
def check_param_file(self, directory:str):
|
105
|
+
"""
|
106
|
+
Define the working directory for the parameters.
|
107
|
+
"""
|
108
|
+
cur_file = join(directory, self.file)
|
109
|
+
# check if the file exists
|
110
|
+
if not exists(cur_file):
|
111
|
+
logging.error(f"File {cur_file} not found!")
|
112
|
+
|
113
|
+
def add_variable(self, variable:Internal_Variable|list[Internal_Variable]):
|
114
|
+
"""
|
115
|
+
Add one or a list of internal variable(s) to the list of variables.
|
116
|
+
"""
|
117
|
+
if isinstance(variable, list):
|
118
|
+
self.all_variables += variable
|
119
|
+
else:
|
120
|
+
self.all_variables.append(variable)
|
121
|
+
|
122
|
+
def get_variables_names(self) -> list[str]:
|
123
|
+
"""
|
124
|
+
Get the names of the internal variables.
|
125
|
+
"""
|
126
|
+
return [var.name for var in self.all_variables]
|
127
|
+
|
128
|
+
def get_variables_files(self) -> list[str]:
|
129
|
+
"""
|
130
|
+
Get the files of the internal variables.
|
131
|
+
"""
|
132
|
+
return [var.file for var in self.all_variables]
|
133
|
+
|
134
|
+
def activate(self, directory:str, prefix_file:str="", type_of_var:int=ALL_VAR):
|
135
|
+
"""
|
136
|
+
Activate the parameters for the internal variables.
|
137
|
+
"""
|
138
|
+
if self.key is None or self.group is None:
|
139
|
+
return
|
140
|
+
|
141
|
+
to_activate = False
|
142
|
+
if type_of_var == ALL_VAR:
|
143
|
+
to_activate = True
|
144
|
+
else:
|
145
|
+
for var in self.all_variables:
|
146
|
+
if var.type_of_var == type_of_var or type_of_var == ALL_VAR:
|
147
|
+
to_activate = True
|
148
|
+
break
|
149
|
+
|
150
|
+
if to_activate:
|
151
|
+
new_prefix = self._build_prefix(prefix_file)
|
152
|
+
filename = ".".join([new_prefix,"param"])
|
153
|
+
param_filename = join(directory, filename)
|
154
|
+
param_file = Wolf_Param(to_read=True, filename=param_filename,toShow=False, init_GUI=False)
|
155
|
+
param_file.change_param(self.group, self.key, 1)
|
156
|
+
param_file.SavetoFile(None)
|
157
|
+
param_file.Reload(None)
|
158
|
+
else:
|
159
|
+
self.deactivate(directory, prefix_file)
|
160
|
+
|
161
|
+
def deactivate(self, directory:str, prefix_file:str=""):
|
162
|
+
"""
|
163
|
+
Deactivate the parameters for the internal variables.
|
164
|
+
"""
|
165
|
+
new_prefix = self._build_prefix(prefix_file)
|
166
|
+
filename = ".".join([new_prefix,"param"])
|
167
|
+
param_filename = join(directory, filename)
|
168
|
+
param_file = Wolf_Param(to_read=True, filename=param_filename,toShow=False, init_GUI=False)
|
169
|
+
param_file.change_param(self.group, self.key, 0)
|
170
|
+
param_file.SavetoFile(None)
|
171
|
+
param_file.Reload(None)
|
172
|
+
|
173
|
+
def get_iv_timeseries(self, directory:str, prefix_file:str="", interval:Optional[tuple[date, date]]=None, type_of_var:int=ALL_VAR) -> dict[str, np.ndarray]:
|
174
|
+
"""
|
175
|
+
Get the time series of the internal variables.
|
176
|
+
|
177
|
+
:param directory: Directory where the file is located.
|
178
|
+
:param prefix_file: Prefix for the filename.
|
179
|
+
:param interval: Optional interval for the time series.
|
180
|
+
:return: List of tuples containing the time and internal variable data.
|
181
|
+
"""
|
182
|
+
|
183
|
+
new_prefix = self._build_prefix(prefix_file)
|
184
|
+
|
185
|
+
all_timeseries = {var.name:
|
186
|
+
var.get_time_serie(directory, new_prefix, interval)[1]
|
187
|
+
for var in self.all_variables
|
188
|
+
if var.type_of_var == type_of_var or type_of_var == ALL_VAR}
|
189
|
+
|
190
|
+
return all_timeseries
|
191
|
+
|
192
|
+
|
193
|
+
def get_linked_params(self) -> dict[str, int]:
|
194
|
+
"""
|
195
|
+
Get the linked parameters of the internal variables.
|
196
|
+
|
197
|
+
:return: Dictionary of linked parameters.
|
198
|
+
"""
|
199
|
+
return {var.name: var.linked_param for var in self.all_variables if var.linked_param is not None}
|
200
|
+
|
201
|
+
def _build_prefix(self, prefix_file:str) -> str:
|
202
|
+
"""
|
203
|
+
Build the prefix for the filename.
|
204
|
+
|
205
|
+
:param prefix_file: Prefix for the filename.
|
206
|
+
:return: Prefix for the filename.
|
207
|
+
"""
|
208
|
+
if self.file == "":
|
209
|
+
return prefix_file
|
210
|
+
else:
|
211
|
+
return "_".join([prefix_file, self.file])
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
class Group_to_Activate:
|
216
|
+
"""
|
217
|
+
Class for managing groups of parameters to activate in hydrological models.
|
218
|
+
"""
|
219
|
+
name: str
|
220
|
+
all_params: list[Param_to_Activate]
|
221
|
+
|
222
|
+
def __init__(self, name:str="", all_params:list[Param_to_Activate]=[]):
|
223
|
+
"""
|
224
|
+
Initialize the Group_to_Activate class with parameters for different models.
|
225
|
+
"""
|
226
|
+
self.name = name
|
227
|
+
self.all_params = all_params
|
228
|
+
|
229
|
+
def get_keys(self) -> list[str]:
|
230
|
+
"""
|
231
|
+
Get the keys of the parameters.
|
232
|
+
"""
|
233
|
+
return [param.key for param in self.all_params]
|
234
|
+
|
235
|
+
def get_files_per_keys(self) -> list[str]:
|
236
|
+
"""
|
237
|
+
Get the files of the parameters.
|
238
|
+
"""
|
239
|
+
return [param.get_variables_files() for param in self.all_params]
|
240
|
+
|
241
|
+
def activate_all(self, directory:str, prefix_file:str="", type_of_var:int=ALL_VAR):
|
242
|
+
"""
|
243
|
+
Activate all parameters in the group.
|
244
|
+
"""
|
245
|
+
for param in self.all_params:
|
246
|
+
param.activate(directory, prefix_file, type_of_var)
|
247
|
+
|
248
|
+
def deactivate_all(self, directory:str, prefix_file:str=""):
|
249
|
+
"""
|
250
|
+
Deactivate all parameters in the group.
|
251
|
+
"""
|
252
|
+
for param in self.all_params:
|
253
|
+
param.deactivate(directory, prefix_file)
|
254
|
+
|
255
|
+
def get_all_iv_timeseries(self, directory:str, prefix_file:str="",
|
256
|
+
interval:Optional[tuple[date, date]]=None,
|
257
|
+
type_of_var:int=ALL_VAR) -> dict[str, np.ndarray]:
|
258
|
+
"""
|
259
|
+
Get the time series of all internal variables in the group.
|
260
|
+
|
261
|
+
:param directory: Directory where the file is located.
|
262
|
+
:param prefix_file: Prefix for the filename.
|
263
|
+
:param interval: Optional interval for the time series.
|
264
|
+
:return: List of tuples containing the time and internal variable data.
|
265
|
+
"""
|
266
|
+
all_timeseries = {}
|
267
|
+
for param in self.all_params:
|
268
|
+
all_timeseries.update(param.get_iv_timeseries(directory, prefix_file,
|
269
|
+
interval, type_of_var))
|
270
|
+
|
271
|
+
return all_timeseries
|
272
|
+
|
273
|
+
def get_all_linked_params(self) -> dict[str, int]:
|
274
|
+
"""
|
275
|
+
Get the linked parameters of the internal variables.
|
276
|
+
|
277
|
+
:return: Dictionary of linked parameters.
|
278
|
+
"""
|
279
|
+
all_linked_params = {}
|
280
|
+
for param in self.all_params:
|
281
|
+
all_linked_params.update(param.get_linked_params())
|
282
|
+
|
283
|
+
return all_linked_params
|
@@ -0,0 +1,223 @@
|
|
1
|
+
from . import constant as cst
|
2
|
+
from . import cst_exchanges as cste
|
3
|
+
from . import Internal_variables as iv
|
4
|
+
|
5
|
+
VHM_VAR = iv.Group_to_Activate(
|
6
|
+
name="VHM",
|
7
|
+
all_params=[
|
8
|
+
iv.Param_to_Activate(
|
9
|
+
key="x", group="Internal variables to save", file="soil",
|
10
|
+
all_variables=[
|
11
|
+
iv.Internal_Variable(name=f"%xu", file="xu", type_of_var=iv.FRAC_VAR, linked_param=None),
|
12
|
+
iv.Internal_Variable(name=f"%xof", file="xof", type_of_var=iv.FRAC_VAR, linked_param=None),
|
13
|
+
iv.Internal_Variable(name=f"%xif", file="xif", type_of_var=iv.FRAC_VAR, linked_param=None),
|
14
|
+
iv.Internal_Variable(name=f"%xbf", file="xbf", type_of_var=iv.FRAC_VAR, linked_param=None),
|
15
|
+
]),
|
16
|
+
iv.Param_to_Activate(
|
17
|
+
key="U", group="Internal variables to save", file="soil",
|
18
|
+
all_variables=[
|
19
|
+
iv.Internal_Variable(name="U", file="U", type_of_var=iv.IV_VAR,
|
20
|
+
linked_param=cste.exchange_parameters_VHM_Umax)
|
21
|
+
]),
|
22
|
+
iv.Param_to_Activate(
|
23
|
+
key=None, group=None, file="",
|
24
|
+
all_variables=[
|
25
|
+
iv.Internal_Variable(name="q_of", file="of", type_of_var=iv.DEFAULT_VAR, linked_param=None),
|
26
|
+
iv.Internal_Variable(name="q_if", file="if", type_of_var=iv.DEFAULT_VAR, linked_param=None),
|
27
|
+
iv.Internal_Variable(name="q_bf", file="bf", type_of_var=iv.DEFAULT_VAR, linked_param=None),
|
28
|
+
])
|
29
|
+
])
|
30
|
+
|
31
|
+
|
32
|
+
UHDIST_LINBF_VAR = iv.Group_to_Activate(
|
33
|
+
name="2 layers",
|
34
|
+
all_params=[
|
35
|
+
iv.Param_to_Activate(
|
36
|
+
key="x", group="Internal variables to save", file="soil",
|
37
|
+
all_variables=[
|
38
|
+
iv.Internal_Variable(name=f"% xif", file="x", type_of_var=iv.FRAC_VAR, linked_param=None)
|
39
|
+
]),
|
40
|
+
iv.Param_to_Activate(
|
41
|
+
key="U", group="Internal variables to save", file="soil",
|
42
|
+
all_variables=[
|
43
|
+
iv.Internal_Variable(name=f"%U", file="U", type_of_var=iv.IV_VAR,
|
44
|
+
linked_param=cste.exchange_parameters_Dist_Soil_Umax)
|
45
|
+
]),
|
46
|
+
iv.Param_to_Activate(
|
47
|
+
key="Reservoir", group="Internal variables to save", file="soil",
|
48
|
+
all_variables=[
|
49
|
+
iv.Internal_Variable(name=f"% xp", file="xp", type_of_var=iv.FRAC_VAR, linked_param=None),
|
50
|
+
iv.Internal_Variable(name=f"S", file="S", type_of_var=iv.IV_VAR,
|
51
|
+
linked_param=cste.exchange_parameters_Dist_RS_Hs)
|
52
|
+
]),
|
53
|
+
iv.Param_to_Activate(
|
54
|
+
key=None, group=None, file="",
|
55
|
+
all_variables=[
|
56
|
+
iv.Internal_Variable(name="q_of", file="of", type_of_var=iv.DEFAULT_VAR, linked_param=None),
|
57
|
+
iv.Internal_Variable(name="q_if", file="if", type_of_var=iv.DEFAULT_VAR, linked_param=None)
|
58
|
+
])
|
59
|
+
]
|
60
|
+
)
|
61
|
+
|
62
|
+
|
63
|
+
HBV_VAR = iv.Group_to_Activate(
|
64
|
+
name="HBV",
|
65
|
+
all_params=[
|
66
|
+
iv.Param_to_Activate(
|
67
|
+
key="U", group="Internal variables to save", file="soil",
|
68
|
+
all_variables=[
|
69
|
+
iv.Internal_Variable(name="U", file="U", type_of_var=iv.IV_VAR,
|
70
|
+
linked_param=cste.exchange_parameters_HBV_FC),
|
71
|
+
]),
|
72
|
+
iv.Param_to_Activate(
|
73
|
+
key="Q out", group="Internal variables to save", file="soil",
|
74
|
+
all_variables=[
|
75
|
+
iv.Internal_Variable(name="q recharge", file="qrech", type_of_var=iv.OUT_VAR, linked_param=None),
|
76
|
+
iv.Internal_Variable(name="q capillary", file="qcap", type_of_var=iv.OUT_VAR, linked_param=None),
|
77
|
+
iv.Internal_Variable(name="Evapotranspiration", file="etr", type_of_var=iv.OUT_VAR, linked_param=None)
|
78
|
+
]),
|
79
|
+
iv.Param_to_Activate(
|
80
|
+
key="Su", group="Internal variables to save", file="UZ",
|
81
|
+
all_variables=[
|
82
|
+
iv.Internal_Variable(name="Su", file="Su", type_of_var=iv.IV_VAR,
|
83
|
+
linked_param=cste.exchange_parameters_HBV_SUmax)
|
84
|
+
]),
|
85
|
+
iv.Param_to_Activate(
|
86
|
+
key="Q out", group="Internal variables to save", file="UZ",
|
87
|
+
all_variables=[
|
88
|
+
iv.Internal_Variable(name="q_of", file="qr", type_of_var=iv.FINAL_OUT_VAR, linked_param=None),
|
89
|
+
iv.Internal_Variable(name="q_if", file="qif", type_of_var=iv.FINAL_OUT_VAR, linked_param=None),
|
90
|
+
iv.Internal_Variable(name="q percolation", file="qperc", type_of_var=iv.OUT_VAR, linked_param=None),
|
91
|
+
iv.Internal_Variable(name="q cap UZ", file="qcap", type_of_var=iv.OUT_VAR, linked_param=None)
|
92
|
+
]),
|
93
|
+
iv.Param_to_Activate(
|
94
|
+
key=None, group=None, file="",
|
95
|
+
all_variables=[
|
96
|
+
iv.Internal_Variable(name="q_bf", file="bf", type_of_var=iv.DEFAULT_VAR, linked_param=None)
|
97
|
+
])
|
98
|
+
]
|
99
|
+
)
|
100
|
+
|
101
|
+
SACSMA_VAR = iv.Group_to_Activate(
|
102
|
+
name="SAC-SMA",
|
103
|
+
all_params=[
|
104
|
+
iv.Param_to_Activate(
|
105
|
+
key="IV", group="Internal variables to save", file="UZ",
|
106
|
+
all_variables=[
|
107
|
+
iv.Internal_Variable(name="C_UZ_TW", file="Ctw", type_of_var=iv.IV_VAR,
|
108
|
+
linked_param=cste.exchange_parameters_SAC_M_UZ_TW),
|
109
|
+
iv.Internal_Variable(name="C_UZ_FW", file="Cfw", type_of_var=iv.IV_VAR,
|
110
|
+
linked_param=cste.exchange_parameters_SAC_M_UZ_FW),
|
111
|
+
iv.Internal_Variable(name="C_Adimp", file="Cadimp", type_of_var=iv.IV_VAR, linked_param=None)
|
112
|
+
]),
|
113
|
+
iv.Param_to_Activate(
|
114
|
+
key="Q out", group="Internal variables to save", file="UZ",
|
115
|
+
all_variables=[
|
116
|
+
iv.Internal_Variable(name="E1", file="e1", type_of_var=iv.OUT_VAR, linked_param=None),
|
117
|
+
iv.Internal_Variable(name="E2", file="e2", type_of_var=iv.OUT_VAR, linked_param=None),
|
118
|
+
iv.Internal_Variable(name="E5", file="e5", type_of_var=iv.OUT_VAR, linked_param=None),
|
119
|
+
iv.Internal_Variable(name="q_ft", file="qft", type_of_var=iv.OUT_VAR, linked_param=None),
|
120
|
+
iv.Internal_Variable(name="q_tf", file="qtf", type_of_var=iv.OUT_VAR, linked_param=None),
|
121
|
+
iv.Internal_Variable(name="q_if", file="qif", type_of_var=iv.OUT_VAR, linked_param=None),
|
122
|
+
iv.Internal_Variable(name="q_perc", file="qperc", type_of_var=iv.OUT_VAR, linked_param=None),
|
123
|
+
iv.Internal_Variable(name="q_sr", file="qsr", type_of_var=iv.OUT_VAR, linked_param=None),
|
124
|
+
iv.Internal_Variable(name="q_in Adimp", file="qinadimp", type_of_var=iv.OUT_VAR, linked_param=None),
|
125
|
+
iv.Internal_Variable(name="q_dr Adimp", file="qdr", type_of_var=iv.OUT_VAR, linked_param=None)
|
126
|
+
]),
|
127
|
+
iv.Param_to_Activate(
|
128
|
+
key="IV", group="Internal variables to save", file="LZ",
|
129
|
+
all_variables=[
|
130
|
+
iv.Internal_Variable(name="C_LZ_TW", file="Ctw", type_of_var=iv.IV_VAR,
|
131
|
+
linked_param=cste.exchange_parameters_SAC_M_LZ_TW),
|
132
|
+
iv.Internal_Variable(name="C_LZ_FP", file="Cfp", type_of_var=iv.IV_VAR,
|
133
|
+
linked_param=cste.exchange_parameters_SAC_M_LZ_FP),
|
134
|
+
iv.Internal_Variable(name="C_LZ_FS", file="Cfs", type_of_var=iv.IV_VAR,
|
135
|
+
linked_param=cste.exchange_parameters_SAC_M_LZ_FS)
|
136
|
+
]),
|
137
|
+
iv.Param_to_Activate(
|
138
|
+
key="Q out", group="Internal variables to save", file="LZ",
|
139
|
+
all_variables=[
|
140
|
+
iv.Internal_Variable(name="E3", file="e3", type_of_var=iv.OUT_VAR, linked_param=None),
|
141
|
+
iv.Internal_Variable(name="q_fp", file="qfp", type_of_var=iv.OUT_VAR, linked_param=None),
|
142
|
+
iv.Internal_Variable(name="q_fs", file="qfs", type_of_var=iv.OUT_VAR, linked_param=None),
|
143
|
+
iv.Internal_Variable(name="q_in tw", file="qintw", type_of_var=iv.OUT_VAR, linked_param=None),
|
144
|
+
iv.Internal_Variable(name="q_in fp", file="qinfp", type_of_var=iv.OUT_VAR, linked_param=None),
|
145
|
+
iv.Internal_Variable(name="q_in fs", file="qinfs", type_of_var=iv.OUT_VAR, linked_param=None),
|
146
|
+
iv.Internal_Variable(name="q_out tw", file="qouttw", type_of_var=iv.OUT_VAR, linked_param=None),
|
147
|
+
iv.Internal_Variable(name="q_out fp", file="qoutfp", type_of_var=iv.OUT_VAR, linked_param=None),
|
148
|
+
iv.Internal_Variable(name="q_out fs", file="qoutfs", type_of_var=iv.OUT_VAR, linked_param=None),
|
149
|
+
]),
|
150
|
+
iv.Param_to_Activate(
|
151
|
+
key=None, group=None, file="out",
|
152
|
+
all_variables=[
|
153
|
+
iv.Internal_Variable(name="E_tot", file="Etot", type_of_var=iv.DEFAULT_VAR, linked_param=None),
|
154
|
+
iv.Internal_Variable(name="Q_of", file="Qof", type_of_var=iv.DEFAULT_VAR, linked_param=None),
|
155
|
+
iv.Internal_Variable(name="Q_if", file="Qif", type_of_var=iv.DEFAULT_VAR, linked_param=None),
|
156
|
+
iv.Internal_Variable(name="Q_bf", file="Qbf", type_of_var=iv.DEFAULT_VAR, linked_param=None),
|
157
|
+
iv.Internal_Variable(name="Q_subbf", file="Qsubbf", type_of_var=iv.DEFAULT_VAR, linked_param=None),
|
158
|
+
iv.Internal_Variable(name="Q_surf", file="Qsurf", type_of_var=iv.DEFAULT_VAR, linked_param=None),
|
159
|
+
iv.Internal_Variable(name="Q_base", file="Qbase", type_of_var=iv.DEFAULT_VAR, linked_param=None)
|
160
|
+
])
|
161
|
+
]
|
162
|
+
)
|
163
|
+
|
164
|
+
NAM_VAR = iv.Group_to_Activate(
|
165
|
+
name="NAM",
|
166
|
+
all_params=[
|
167
|
+
iv.Param_to_Activate(
|
168
|
+
key="U", group="Internal variables to save", file="SS",
|
169
|
+
all_variables=[
|
170
|
+
iv.Internal_Variable(name="U", file="U", type_of_var=iv.IV_VAR,
|
171
|
+
linked_param=cste.exchange_parameters_NAM_UMAX),
|
172
|
+
]),
|
173
|
+
iv.Param_to_Activate(
|
174
|
+
key="Q out", group="Internal variables to save", file="SS",
|
175
|
+
all_variables=[
|
176
|
+
iv.Internal_Variable(name="qqof", file="qof", type_of_var=iv.OUT_VAR, linked_param=None),
|
177
|
+
iv.Internal_Variable(name="qqif", file="qif", type_of_var=iv.OUT_VAR, linked_param=None),
|
178
|
+
# iv.Internal_Variable(name="q_infil", file="qinfil", type_of_var=iv.OUT_VAR),
|
179
|
+
iv.Internal_Variable(name="Ea", file="ea", type_of_var=iv.OUT_VAR, linked_param=None),
|
180
|
+
]),
|
181
|
+
iv.Param_to_Activate(
|
182
|
+
key="IV", group="Internal variables to save", file="RZ",
|
183
|
+
all_variables=[
|
184
|
+
iv.Internal_Variable(name="L", file="L", type_of_var=iv.IV_VAR,
|
185
|
+
linked_param=cste.exchange_parameters_NAM_LMAX),
|
186
|
+
]),
|
187
|
+
iv.Param_to_Activate(
|
188
|
+
key="Q out", group="Internal variables to save", file="RZ",
|
189
|
+
all_variables=[
|
190
|
+
iv.Internal_Variable(name="E_rz", file="erz", type_of_var=iv.OUT_VAR, linked_param=None),
|
191
|
+
iv.Internal_Variable(name="q_g", file="qg", type_of_var=iv.OUT_VAR, linked_param=None),
|
192
|
+
]),
|
193
|
+
iv.Param_to_Activate(
|
194
|
+
key=None, group=None, file="",
|
195
|
+
all_variables=[
|
196
|
+
iv.Internal_Variable(name="q_of", file="OF", type_of_var=iv.DEFAULT_VAR, linked_param=None),
|
197
|
+
iv.Internal_Variable(name="q_if", file="IF", type_of_var=iv.DEFAULT_VAR, linked_param=None),
|
198
|
+
iv.Internal_Variable(name="q_bf", file="BF", type_of_var=iv.DEFAULT_VAR, linked_param=None)
|
199
|
+
])
|
200
|
+
]
|
201
|
+
)
|
202
|
+
|
203
|
+
|
204
|
+
MODELS_VAR:dict[int, iv.Group_to_Activate] = {
|
205
|
+
cst.tom_VHM: VHM_VAR,
|
206
|
+
cst.tom_2layers_linIF: UHDIST_LINBF_VAR,
|
207
|
+
cst.tom_HBV: HBV_VAR,
|
208
|
+
cst.tom_SAC_SMA: SACSMA_VAR,
|
209
|
+
cst.tom_NAM: NAM_VAR
|
210
|
+
}
|
211
|
+
|
212
|
+
if __name__ == "__main__":
|
213
|
+
print(f"VHM keys: {VHM_VAR.get_keys()}")
|
214
|
+
print(f"UHDIST_LINBF keys: {UHDIST_LINBF_VAR.get_keys()}")
|
215
|
+
print(f"HBV keys: {HBV_VAR.get_keys()}")
|
216
|
+
print(f"SACSMA keys: {SACSMA_VAR.get_keys()}")
|
217
|
+
print(f"NAM keys: {NAM_VAR.get_keys()}")
|
218
|
+
|
219
|
+
print(f"VHM files: {VHM_VAR.get_files_per_keys()}")
|
220
|
+
print(f"UHDIST_LINBF files: {UHDIST_LINBF_VAR.get_files_per_keys()}")
|
221
|
+
print(f"HBV files: {HBV_VAR.get_files_per_keys()}")
|
222
|
+
print(f"SACSMA files: {SACSMA_VAR.get_files_per_keys()}")
|
223
|
+
print(f"NAM files: {NAM_VAR.get_files_per_keys()}")
|