vortex-nwp 2.0.0b1__py3-none-any.whl → 2.1.0__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.
- vortex/__init__.py +75 -47
- vortex/algo/__init__.py +3 -2
- vortex/algo/components.py +944 -618
- vortex/algo/mpitools.py +802 -497
- vortex/algo/mpitools_templates/__init__.py +1 -0
- vortex/algo/serversynctools.py +34 -33
- vortex/config.py +19 -22
- vortex/data/__init__.py +9 -3
- vortex/data/abstractstores.py +593 -655
- vortex/data/containers.py +217 -162
- vortex/data/contents.py +65 -39
- vortex/data/executables.py +93 -102
- vortex/data/flow.py +40 -34
- vortex/data/geometries.py +228 -132
- vortex/data/handlers.py +436 -227
- vortex/data/outflow.py +15 -15
- vortex/data/providers.py +185 -163
- vortex/data/resources.py +48 -42
- vortex/data/stores.py +540 -417
- vortex/data/sync_templates/__init__.py +0 -0
- vortex/gloves.py +114 -87
- vortex/layout/__init__.py +1 -8
- vortex/layout/contexts.py +150 -84
- vortex/layout/dataflow.py +353 -202
- vortex/layout/monitor.py +264 -128
- vortex/nwp/__init__.py +5 -2
- vortex/nwp/algo/__init__.py +14 -5
- vortex/nwp/algo/assim.py +205 -151
- vortex/nwp/algo/clim.py +683 -517
- vortex/nwp/algo/coupling.py +447 -225
- vortex/nwp/algo/eda.py +437 -229
- vortex/nwp/algo/eps.py +403 -231
- vortex/nwp/algo/forecasts.py +416 -275
- vortex/nwp/algo/fpserver.py +683 -307
- vortex/nwp/algo/ifsnaming.py +205 -145
- vortex/nwp/algo/ifsroot.py +215 -122
- vortex/nwp/algo/monitoring.py +137 -76
- vortex/nwp/algo/mpitools.py +330 -190
- vortex/nwp/algo/odbtools.py +637 -353
- vortex/nwp/algo/oopsroot.py +454 -273
- vortex/nwp/algo/oopstests.py +90 -56
- vortex/nwp/algo/request.py +287 -206
- vortex/nwp/algo/stdpost.py +878 -522
- vortex/nwp/data/__init__.py +22 -4
- vortex/nwp/data/assim.py +125 -137
- vortex/nwp/data/boundaries.py +121 -68
- vortex/nwp/data/climfiles.py +193 -211
- vortex/nwp/data/configfiles.py +73 -69
- vortex/nwp/data/consts.py +426 -401
- vortex/nwp/data/ctpini.py +59 -43
- vortex/nwp/data/diagnostics.py +94 -66
- vortex/nwp/data/eda.py +50 -51
- vortex/nwp/data/eps.py +195 -146
- vortex/nwp/data/executables.py +440 -434
- vortex/nwp/data/fields.py +63 -48
- vortex/nwp/data/gridfiles.py +183 -111
- vortex/nwp/data/logs.py +250 -217
- vortex/nwp/data/modelstates.py +180 -151
- vortex/nwp/data/monitoring.py +72 -99
- vortex/nwp/data/namelists.py +254 -202
- vortex/nwp/data/obs.py +400 -308
- vortex/nwp/data/oopsexec.py +22 -20
- vortex/nwp/data/providers.py +90 -65
- vortex/nwp/data/query.py +71 -82
- vortex/nwp/data/stores.py +49 -36
- vortex/nwp/data/surfex.py +136 -137
- vortex/nwp/syntax/__init__.py +1 -1
- vortex/nwp/syntax/stdattrs.py +173 -111
- vortex/nwp/tools/__init__.py +2 -2
- vortex/nwp/tools/addons.py +22 -17
- vortex/nwp/tools/agt.py +24 -12
- vortex/nwp/tools/bdap.py +16 -5
- vortex/nwp/tools/bdcp.py +4 -1
- vortex/nwp/tools/bdm.py +3 -0
- vortex/nwp/tools/bdmp.py +14 -9
- vortex/nwp/tools/conftools.py +728 -378
- vortex/nwp/tools/drhook.py +12 -8
- vortex/nwp/tools/grib.py +65 -39
- vortex/nwp/tools/gribdiff.py +22 -17
- vortex/nwp/tools/ifstools.py +82 -42
- vortex/nwp/tools/igastuff.py +167 -143
- vortex/nwp/tools/mars.py +14 -2
- vortex/nwp/tools/odb.py +234 -125
- vortex/nwp/tools/partitioning.py +61 -37
- vortex/nwp/tools/satrad.py +27 -12
- vortex/nwp/util/async.py +83 -55
- vortex/nwp/util/beacon.py +10 -10
- vortex/nwp/util/diffpygram.py +174 -86
- vortex/nwp/util/ens.py +144 -63
- vortex/nwp/util/hooks.py +30 -19
- vortex/nwp/util/taskdeco.py +28 -24
- vortex/nwp/util/usepygram.py +278 -172
- vortex/nwp/util/usetnt.py +31 -17
- vortex/sessions.py +72 -39
- vortex/syntax/__init__.py +1 -1
- vortex/syntax/stdattrs.py +410 -171
- vortex/syntax/stddeco.py +31 -22
- vortex/toolbox.py +327 -192
- vortex/tools/__init__.py +11 -2
- vortex/tools/actions.py +110 -121
- vortex/tools/addons.py +111 -92
- vortex/tools/arm.py +42 -22
- vortex/tools/compression.py +72 -69
- vortex/tools/date.py +11 -4
- vortex/tools/delayedactions.py +242 -132
- vortex/tools/env.py +75 -47
- vortex/tools/folder.py +342 -171
- vortex/tools/grib.py +341 -162
- vortex/tools/lfi.py +423 -216
- vortex/tools/listings.py +109 -40
- vortex/tools/names.py +218 -156
- vortex/tools/net.py +655 -299
- vortex/tools/parallelism.py +93 -61
- vortex/tools/prestaging.py +55 -31
- vortex/tools/schedulers.py +172 -105
- vortex/tools/services.py +403 -334
- vortex/tools/storage.py +293 -358
- vortex/tools/surfex.py +24 -24
- vortex/tools/systems.py +1234 -643
- vortex/tools/targets.py +156 -100
- vortex/util/__init__.py +1 -1
- vortex/util/config.py +378 -327
- vortex/util/empty.py +2 -2
- vortex/util/helpers.py +56 -24
- vortex/util/introspection.py +18 -12
- vortex/util/iosponge.py +8 -4
- vortex/util/roles.py +4 -6
- vortex/util/storefunctions.py +39 -13
- vortex/util/structs.py +3 -3
- vortex/util/worker.py +29 -17
- vortex_nwp-2.1.0.dist-info/METADATA +67 -0
- vortex_nwp-2.1.0.dist-info/RECORD +144 -0
- {vortex_nwp-2.0.0b1.dist-info → vortex_nwp-2.1.0.dist-info}/WHEEL +1 -1
- vortex/layout/appconf.py +0 -109
- vortex/layout/jobs.py +0 -1276
- vortex/layout/nodes.py +0 -1424
- vortex/layout/subjobs.py +0 -464
- vortex_nwp-2.0.0b1.dist-info/METADATA +0 -50
- vortex_nwp-2.0.0b1.dist-info/RECORD +0 -146
- {vortex_nwp-2.0.0b1.dist-info → vortex_nwp-2.1.0.dist-info/licenses}/LICENSE +0 -0
- {vortex_nwp-2.0.0b1.dist-info → vortex_nwp-2.1.0.dist-info}/top_level.txt +0 -0
vortex/nwp/data/namelists.py
CHANGED
|
@@ -22,49 +22,71 @@ __all__ = []
|
|
|
22
22
|
|
|
23
23
|
logger = loggers.getLogger(__name__)
|
|
24
24
|
|
|
25
|
-
KNOWN_NAMELIST_MACROS = {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
KNOWN_NAMELIST_MACROS = {
|
|
26
|
+
"NPROC",
|
|
27
|
+
"NBPROC",
|
|
28
|
+
"NBPROC_IO",
|
|
29
|
+
"NCPROC",
|
|
30
|
+
"NDPROC",
|
|
31
|
+
"NBPROCIN",
|
|
32
|
+
"NBPROCOUT",
|
|
33
|
+
"IDAT",
|
|
34
|
+
"CEXP",
|
|
35
|
+
"TIMESTEP",
|
|
36
|
+
"FCSTOP",
|
|
37
|
+
"NMODVAL",
|
|
38
|
+
"NBE",
|
|
39
|
+
"SEED",
|
|
40
|
+
"MEMBER",
|
|
41
|
+
"NUMOD",
|
|
42
|
+
"OUTPUTID",
|
|
43
|
+
"NRESX",
|
|
44
|
+
"PERTURB",
|
|
45
|
+
"JOUR",
|
|
46
|
+
"RES",
|
|
47
|
+
"LLADAJ",
|
|
48
|
+
"LLADMON",
|
|
49
|
+
"LLFLAG",
|
|
50
|
+
"LLARO",
|
|
51
|
+
"LLVRP",
|
|
52
|
+
"LLCAN",
|
|
53
|
+
}
|
|
31
54
|
|
|
32
55
|
|
|
33
56
|
class NamelistPack(ModelResource):
|
|
34
57
|
"""
|
|
35
58
|
Class for all kinds of namelists
|
|
36
59
|
"""
|
|
60
|
+
|
|
37
61
|
_footprint = [
|
|
38
62
|
gvar,
|
|
39
63
|
dict(
|
|
40
|
-
info
|
|
41
|
-
attr
|
|
42
|
-
kind
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
values = ['NAMELIST_' + x.upper() for x in binaries],
|
|
47
|
-
default = 'namelist_[binary]'
|
|
64
|
+
info="A whole Namelist pack",
|
|
65
|
+
attr=dict(
|
|
66
|
+
kind=dict(values=["namelistpack"]),
|
|
67
|
+
gvar=dict(
|
|
68
|
+
values=["NAMELIST_" + x.upper() for x in binaries],
|
|
69
|
+
default="namelist_[binary]",
|
|
48
70
|
),
|
|
49
|
-
model
|
|
50
|
-
optional
|
|
71
|
+
model=dict(
|
|
72
|
+
optional=True,
|
|
51
73
|
),
|
|
52
|
-
binary
|
|
53
|
-
optional
|
|
54
|
-
values
|
|
55
|
-
default
|
|
74
|
+
binary=dict(
|
|
75
|
+
optional=True,
|
|
76
|
+
values=binaries,
|
|
77
|
+
default="[model]",
|
|
56
78
|
),
|
|
57
|
-
)
|
|
58
|
-
)
|
|
79
|
+
),
|
|
80
|
+
),
|
|
59
81
|
]
|
|
60
82
|
|
|
61
83
|
@property
|
|
62
84
|
def realkind(self):
|
|
63
|
-
return
|
|
85
|
+
return "namelistpack"
|
|
64
86
|
|
|
65
87
|
def gget_urlquery(self):
|
|
66
88
|
"""GGET specific query : ``dir_extract``."""
|
|
67
|
-
return
|
|
89
|
+
return "dir_extract=1"
|
|
68
90
|
|
|
69
91
|
|
|
70
92
|
class NamelistContentError(ValueError):
|
|
@@ -81,10 +103,10 @@ class NamelistContent(AlmostDictContent):
|
|
|
81
103
|
* remove : elements to remove from the contents
|
|
82
104
|
* parser : a namelist parser object (a default one will be built otherwise)
|
|
83
105
|
"""
|
|
84
|
-
kw.setdefault(
|
|
85
|
-
kw.setdefault(
|
|
86
|
-
kw.setdefault(
|
|
87
|
-
kw.setdefault(
|
|
106
|
+
kw.setdefault("macros", {k: None for k in KNOWN_NAMELIST_MACROS})
|
|
107
|
+
kw.setdefault("remove", set())
|
|
108
|
+
kw.setdefault("parser", None)
|
|
109
|
+
kw.setdefault("data", NamelistSet())
|
|
88
110
|
super().__init__(**kw)
|
|
89
111
|
self._declaredmacros = set(self._macros.keys())
|
|
90
112
|
|
|
@@ -125,13 +147,14 @@ class NamelistContent(AlmostDictContent):
|
|
|
125
147
|
def merge(self, delta, rmkeys=None, rmblocks=None, clblocks=None):
|
|
126
148
|
"""Merge of the current namelist content with the set of namelist blocks provided."""
|
|
127
149
|
if isinstance(delta, NamelistContent):
|
|
128
|
-
if rmblocks is None and hasattr(delta,
|
|
150
|
+
if rmblocks is None and hasattr(delta, "rmblocks"):
|
|
129
151
|
rmblocks = delta.rmblocks()
|
|
130
152
|
actualdelta = delta.data
|
|
131
153
|
else:
|
|
132
154
|
actualdelta = delta
|
|
133
|
-
self._data.merge(
|
|
134
|
-
|
|
155
|
+
self._data.merge(
|
|
156
|
+
actualdelta, rmkeys=rmkeys, rmblocks=rmblocks, clblocks=clblocks
|
|
157
|
+
)
|
|
135
158
|
|
|
136
159
|
def slurp(self, container):
|
|
137
160
|
"""Get data from the ``container`` namelist."""
|
|
@@ -142,7 +165,9 @@ class NamelistContent(AlmostDictContent):
|
|
|
142
165
|
try:
|
|
143
166
|
namset = self._parser.parse(container.read())
|
|
144
167
|
except (ValueError, OSError) as e:
|
|
145
|
-
raise NamelistContentError(
|
|
168
|
+
raise NamelistContentError(
|
|
169
|
+
"Could not parse container contents: {!s}".format(e)
|
|
170
|
+
)
|
|
146
171
|
self._data = namset
|
|
147
172
|
for macro, value in self._macros.items():
|
|
148
173
|
self._data.setmacro(macro, value)
|
|
@@ -167,59 +192,58 @@ class Namelist(ModelResource):
|
|
|
167
192
|
"""
|
|
168
193
|
Class for all kinds of namelists
|
|
169
194
|
"""
|
|
195
|
+
|
|
170
196
|
_footprint = [
|
|
171
197
|
gvar,
|
|
172
198
|
dict(
|
|
173
|
-
info
|
|
174
|
-
attr
|
|
175
|
-
kind
|
|
176
|
-
|
|
199
|
+
info="Namelist from binary pack",
|
|
200
|
+
attr=dict(
|
|
201
|
+
kind=dict(values=["namelist"]),
|
|
202
|
+
clscontents=dict(default=NamelistContent),
|
|
203
|
+
gvar=dict(
|
|
204
|
+
values=["NAMELIST_" + x.upper() for x in binaries],
|
|
205
|
+
default="namelist_[binary]",
|
|
177
206
|
),
|
|
178
|
-
|
|
179
|
-
|
|
207
|
+
source=dict(
|
|
208
|
+
info="The namelist name within the namelist pack.",
|
|
209
|
+
optional=True,
|
|
210
|
+
default="namel_[binary]",
|
|
211
|
+
doc_zorder=50,
|
|
180
212
|
),
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
default = 'namelist_[binary]'
|
|
213
|
+
model=dict(
|
|
214
|
+
optional=True,
|
|
184
215
|
),
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
default
|
|
189
|
-
doc_zorder = 50
|
|
216
|
+
binary=dict(
|
|
217
|
+
optional=True,
|
|
218
|
+
values=binaries,
|
|
219
|
+
default="[model]",
|
|
190
220
|
),
|
|
191
|
-
|
|
192
|
-
|
|
221
|
+
date=dict(
|
|
222
|
+
type=Date,
|
|
223
|
+
optional=True,
|
|
193
224
|
),
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
values = binaries,
|
|
197
|
-
default = '[model]',
|
|
198
|
-
),
|
|
199
|
-
date = dict(
|
|
200
|
-
type = Date,
|
|
201
|
-
optional = True,
|
|
202
|
-
)
|
|
203
|
-
)
|
|
204
|
-
)
|
|
225
|
+
),
|
|
226
|
+
),
|
|
205
227
|
]
|
|
206
228
|
|
|
207
229
|
@property
|
|
208
230
|
def realkind(self):
|
|
209
|
-
return
|
|
231
|
+
return "namelist"
|
|
210
232
|
|
|
211
233
|
def _find_source(self):
|
|
212
|
-
sources = self.source.split(
|
|
234
|
+
sources = self.source.split("|")
|
|
213
235
|
if len(sources) == 1:
|
|
214
|
-
source = sources[0].split(
|
|
236
|
+
source = sources[0].split(":")[0]
|
|
215
237
|
else:
|
|
216
238
|
# Check that the date argument was provided.:
|
|
217
239
|
if self.date is None:
|
|
218
|
-
raise AttributeError(
|
|
219
|
-
|
|
240
|
+
raise AttributeError(
|
|
241
|
+
"The date argument should be provided when dealing "
|
|
242
|
+
+ "with time based namelist sources."
|
|
243
|
+
)
|
|
220
244
|
datedSource = {}
|
|
221
245
|
for s in sources:
|
|
222
|
-
dateNsource = s.split(
|
|
246
|
+
dateNsource = s.split(":")
|
|
223
247
|
if dateNsource[0]:
|
|
224
248
|
if len(dateNsource) == 2:
|
|
225
249
|
date = Date(dateNsource[1], year=self.date.year)
|
|
@@ -228,22 +252,25 @@ class Namelist(ModelResource):
|
|
|
228
252
|
if date not in datedSource.keys():
|
|
229
253
|
datedSource[date] = dateNsource[0]
|
|
230
254
|
else:
|
|
231
|
-
logger.warning(
|
|
232
|
-
|
|
233
|
-
|
|
255
|
+
logger.warning(
|
|
256
|
+
"%s already begins the %s, %s is ignored.",
|
|
257
|
+
datedSource[date],
|
|
258
|
+
date.strftime("%d of %b."),
|
|
259
|
+
dateNsource[0],
|
|
260
|
+
)
|
|
234
261
|
datedSource = sorted(datedSource.items(), reverse=True)
|
|
235
262
|
source = datedSource[0][1]
|
|
236
263
|
for dateNsource in datedSource:
|
|
237
264
|
if self.date >= dateNsource[0]:
|
|
238
265
|
source = dateNsource[1]
|
|
239
266
|
break
|
|
240
|
-
logger.info(
|
|
267
|
+
logger.info("The consistent source is %s", source)
|
|
241
268
|
|
|
242
269
|
return source
|
|
243
270
|
|
|
244
271
|
def gget_urlquery(self):
|
|
245
272
|
"""GGET specific query : ``extract``."""
|
|
246
|
-
return
|
|
273
|
+
return "extract=" + self._find_source()
|
|
247
274
|
|
|
248
275
|
|
|
249
276
|
class NamelistDelta(Namelist):
|
|
@@ -252,42 +279,45 @@ class NamelistDelta(Namelist):
|
|
|
252
279
|
"""
|
|
253
280
|
|
|
254
281
|
_footprint = dict(
|
|
255
|
-
attr
|
|
256
|
-
kind
|
|
257
|
-
values
|
|
282
|
+
attr=dict(
|
|
283
|
+
kind=dict(
|
|
284
|
+
values=[
|
|
285
|
+
"namdelta",
|
|
286
|
+
"deltanam",
|
|
287
|
+
]
|
|
258
288
|
),
|
|
259
|
-
source
|
|
260
|
-
default
|
|
289
|
+
source=dict(
|
|
290
|
+
default="deltanam.[binary]",
|
|
261
291
|
),
|
|
262
292
|
)
|
|
263
293
|
)
|
|
264
294
|
|
|
265
295
|
@property
|
|
266
296
|
def realkind(self):
|
|
267
|
-
return
|
|
297
|
+
return "namdelta"
|
|
268
298
|
|
|
269
299
|
|
|
270
300
|
class NamelistUtil(Namelist):
|
|
271
301
|
"""
|
|
272
302
|
Class for namelists utilities
|
|
273
303
|
"""
|
|
304
|
+
|
|
274
305
|
_footprint = dict(
|
|
275
|
-
info
|
|
276
|
-
attr
|
|
277
|
-
kind
|
|
278
|
-
values
|
|
279
|
-
remap
|
|
306
|
+
info="Namelist from utilities pack",
|
|
307
|
+
attr=dict(
|
|
308
|
+
kind=dict(
|
|
309
|
+
values=["namelist_util", "namutil"],
|
|
310
|
+
remap=dict(autoremap="first"),
|
|
280
311
|
),
|
|
281
|
-
gvar
|
|
282
|
-
values
|
|
283
|
-
default = 'namelist_utilities'
|
|
312
|
+
gvar=dict(
|
|
313
|
+
values=["NAMELIST_UTILITIES"], default="namelist_utilities"
|
|
284
314
|
),
|
|
285
|
-
binary
|
|
286
|
-
values
|
|
287
|
-
default
|
|
288
|
-
optional
|
|
315
|
+
binary=dict(
|
|
316
|
+
values=["batodb", "utilities", "odbtools"],
|
|
317
|
+
default="utilities",
|
|
318
|
+
optional=True,
|
|
289
319
|
),
|
|
290
|
-
)
|
|
320
|
+
),
|
|
291
321
|
)
|
|
292
322
|
|
|
293
323
|
|
|
@@ -295,22 +325,19 @@ class NamelistTerm(Namelist):
|
|
|
295
325
|
"""
|
|
296
326
|
Class for all the terms dependent namelists
|
|
297
327
|
"""
|
|
328
|
+
|
|
298
329
|
_footprint = [
|
|
299
330
|
term,
|
|
300
331
|
dict(
|
|
301
|
-
info
|
|
302
|
-
attr
|
|
303
|
-
|
|
304
|
-
values = ['namterm']
|
|
305
|
-
)
|
|
306
|
-
)
|
|
307
|
-
)
|
|
332
|
+
info="Terms dependent namelist",
|
|
333
|
+
attr=dict(kind=dict(values=["namterm"])),
|
|
334
|
+
),
|
|
308
335
|
]
|
|
309
336
|
|
|
310
337
|
def incoming_xxt_fixup(self, attr, key=None, prefix=None):
|
|
311
338
|
"""Fix as best as possible the ``xxt.def`` file."""
|
|
312
339
|
|
|
313
|
-
regex = re.compile(r
|
|
340
|
+
regex = re.compile(r",(.*)$")
|
|
314
341
|
myenv = env.current()
|
|
315
342
|
suffix = regex.search(myenv.VORTEX_XXT_DEF)
|
|
316
343
|
if suffix:
|
|
@@ -319,35 +346,37 @@ class NamelistTerm(Namelist):
|
|
|
319
346
|
fp = None
|
|
320
347
|
|
|
321
348
|
try:
|
|
322
|
-
with open(
|
|
349
|
+
with open("xxt.def") as f:
|
|
323
350
|
lines = f.readlines()
|
|
324
351
|
except OSError:
|
|
325
|
-
logger.error(
|
|
352
|
+
logger.error("Could not open file xxt.def")
|
|
326
353
|
raise
|
|
327
354
|
|
|
328
355
|
select = lines[self.term.hour].split()[2]
|
|
329
356
|
|
|
330
|
-
if not re.match(r
|
|
357
|
+
if not re.match(r"undef", select):
|
|
331
358
|
if fp:
|
|
332
|
-
rgx = re.compile(key + r
|
|
359
|
+
rgx = re.compile(key + r"(.*)$")
|
|
333
360
|
sfx = rgx.search(select)
|
|
334
361
|
if sfx:
|
|
335
362
|
s = sfx.group(1)
|
|
336
363
|
else:
|
|
337
|
-
s =
|
|
338
|
-
return
|
|
364
|
+
s = ""
|
|
365
|
+
return "".join((key, "_", fp, s))
|
|
339
366
|
else:
|
|
340
367
|
return select
|
|
341
368
|
else:
|
|
342
|
-
logger.error(
|
|
369
|
+
logger.error(
|
|
370
|
+
"Fullpos namelist id not defined for term %s", self.term
|
|
371
|
+
)
|
|
343
372
|
|
|
344
373
|
def incoming_namelist_fixup(self, attr, key=None):
|
|
345
374
|
"""Fix as best as possible the namelist term extensions."""
|
|
346
375
|
|
|
347
376
|
val = getattr(self, attr)
|
|
348
|
-
r1 = re.compile(r
|
|
349
|
-
r2 = re.compile(r
|
|
350
|
-
r3 = re.compile(r
|
|
377
|
+
r1 = re.compile(r"^(.*\/)?(" + key + r".*_fp|cpl)$")
|
|
378
|
+
r2 = re.compile(r"^(.*\/)?(" + key + r".*_fp)(\..*)$")
|
|
379
|
+
r3 = re.compile(r"^(.*\/)?(" + key + r".*_p)$")
|
|
351
380
|
|
|
352
381
|
fixed = 0
|
|
353
382
|
|
|
@@ -357,26 +386,26 @@ class NamelistTerm(Namelist):
|
|
|
357
386
|
fixed = 1
|
|
358
387
|
(dirpath, base) = (s.group(1), s.group(2))
|
|
359
388
|
if dirpath is None:
|
|
360
|
-
dirpath =
|
|
361
|
-
ext =
|
|
389
|
+
dirpath = ""
|
|
390
|
+
ext = ""
|
|
362
391
|
if r == r3:
|
|
363
392
|
if self.term.hour == 0:
|
|
364
|
-
p =
|
|
393
|
+
p = "0"
|
|
365
394
|
elif self.term.hour % 6 == 0:
|
|
366
|
-
p =
|
|
395
|
+
p = "6"
|
|
367
396
|
elif self.term.hour % 3 == 0:
|
|
368
|
-
p =
|
|
397
|
+
p = "3"
|
|
369
398
|
else:
|
|
370
|
-
p =
|
|
399
|
+
p = "1"
|
|
371
400
|
else:
|
|
372
401
|
if self.term.hour == 0:
|
|
373
|
-
p =
|
|
402
|
+
p = "0"
|
|
374
403
|
else:
|
|
375
|
-
p =
|
|
404
|
+
p = ""
|
|
376
405
|
if r == r2:
|
|
377
406
|
ext = s.group(3)
|
|
378
407
|
if ext is None:
|
|
379
|
-
ext =
|
|
408
|
+
ext = ""
|
|
380
409
|
|
|
381
410
|
if fixed:
|
|
382
411
|
return dirpath + base + p + ext
|
|
@@ -388,89 +417,99 @@ class NamelistSelect(NamelistTerm):
|
|
|
388
417
|
"""
|
|
389
418
|
Class for the select namelists
|
|
390
419
|
"""
|
|
420
|
+
|
|
391
421
|
_footprint = [
|
|
392
422
|
dict(
|
|
393
|
-
info
|
|
394
|
-
attr
|
|
395
|
-
kind
|
|
396
|
-
values
|
|
423
|
+
info="Select namelist for fullpos ",
|
|
424
|
+
attr=dict(
|
|
425
|
+
kind=dict(
|
|
426
|
+
values=[
|
|
427
|
+
"namselect",
|
|
428
|
+
]
|
|
397
429
|
)
|
|
398
|
-
)
|
|
430
|
+
),
|
|
399
431
|
)
|
|
400
432
|
]
|
|
401
433
|
|
|
402
434
|
@property
|
|
403
435
|
def realkind(self):
|
|
404
|
-
return
|
|
436
|
+
return "namselect"
|
|
405
437
|
|
|
406
438
|
def gget_urlquery(self):
|
|
407
439
|
"""GGET specific query : ``extract``."""
|
|
408
440
|
myenv = env.current()
|
|
409
|
-
if myenv.true(
|
|
410
|
-
return
|
|
441
|
+
if myenv.true("VORTEX_XXT_DEF"):
|
|
442
|
+
return "extract=" + self.incoming_xxt_fixup("source", "select")
|
|
411
443
|
else:
|
|
412
|
-
return
|
|
444
|
+
return "extract={:s}".format(self.source)
|
|
413
445
|
|
|
414
446
|
|
|
415
447
|
class NamelistFullPos(NamelistTerm):
|
|
416
448
|
"""
|
|
417
449
|
Class for the fullpos term dependent namelists
|
|
418
450
|
"""
|
|
451
|
+
|
|
419
452
|
_footprint = [
|
|
420
453
|
dict(
|
|
421
|
-
info
|
|
422
|
-
attr
|
|
423
|
-
kind
|
|
424
|
-
values
|
|
454
|
+
info="Namelist for offline fullpos ",
|
|
455
|
+
attr=dict(
|
|
456
|
+
kind=dict(
|
|
457
|
+
values=[
|
|
458
|
+
"namelistfp",
|
|
459
|
+
]
|
|
425
460
|
)
|
|
426
|
-
)
|
|
461
|
+
),
|
|
427
462
|
)
|
|
428
463
|
]
|
|
429
464
|
|
|
430
465
|
@property
|
|
431
466
|
def realkind(self):
|
|
432
|
-
return
|
|
467
|
+
return "namelistfp"
|
|
433
468
|
|
|
434
469
|
def gget_urlquery(self):
|
|
435
470
|
"""GGET specific query : ``extract``."""
|
|
436
|
-
return
|
|
471
|
+
return "extract=" + self.incoming_namelist_fixup("source", "namel")
|
|
437
472
|
|
|
438
473
|
|
|
439
474
|
class NamelistFpServerObject(Namelist):
|
|
440
475
|
"""Class for a fullpos server object's namelists."""
|
|
441
476
|
|
|
442
477
|
_footprint = dict(
|
|
443
|
-
info
|
|
444
|
-
attr
|
|
445
|
-
kind
|
|
446
|
-
values
|
|
478
|
+
info="Namelist for a fullpos server object",
|
|
479
|
+
attr=dict(
|
|
480
|
+
kind=dict(
|
|
481
|
+
values=[
|
|
482
|
+
"namelist_fpobject",
|
|
483
|
+
]
|
|
447
484
|
),
|
|
448
|
-
fp_conf
|
|
449
|
-
info
|
|
450
|
-
type
|
|
451
|
-
optional
|
|
485
|
+
fp_conf=dict(
|
|
486
|
+
info="The FPCONF setting associated with this object.",
|
|
487
|
+
type=int,
|
|
488
|
+
optional=True,
|
|
452
489
|
),
|
|
453
|
-
fp_cmodel
|
|
454
|
-
info
|
|
455
|
-
optional
|
|
490
|
+
fp_cmodel=dict(
|
|
491
|
+
info="The CMODEL setting associated with this object.",
|
|
492
|
+
optional=True,
|
|
456
493
|
),
|
|
457
|
-
fp_lextern
|
|
458
|
-
info
|
|
459
|
-
type
|
|
460
|
-
optional
|
|
494
|
+
fp_lextern=dict(
|
|
495
|
+
info="The LEXTERN setting associated with this object.",
|
|
496
|
+
type=bool,
|
|
497
|
+
optional=True,
|
|
461
498
|
),
|
|
462
|
-
fp_terms
|
|
463
|
-
info
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
499
|
+
fp_terms=dict(
|
|
500
|
+
info=(
|
|
501
|
+
"Apply this object only on a subset of the input "
|
|
502
|
+
"data (based on term)"
|
|
503
|
+
),
|
|
504
|
+
type=FPList,
|
|
505
|
+
optional=True,
|
|
506
|
+
),
|
|
507
|
+
),
|
|
469
508
|
)
|
|
470
509
|
|
|
471
510
|
@property
|
|
472
511
|
def realkind(self):
|
|
473
|
-
return
|
|
512
|
+
return "namelist_fpobject"
|
|
474
513
|
|
|
475
514
|
|
|
476
515
|
class XXTContent(IndexedTable):
|
|
@@ -494,7 +533,7 @@ class XXTContent(IndexedTable):
|
|
|
494
533
|
|
|
495
534
|
These naming convention refer to the footprints resolve mechanism.
|
|
496
535
|
"""
|
|
497
|
-
t = g.get(
|
|
536
|
+
t = g.get("term", x.get("term", None))
|
|
498
537
|
if t is None:
|
|
499
538
|
return None
|
|
500
539
|
else:
|
|
@@ -505,7 +544,9 @@ class XXTContent(IndexedTable):
|
|
|
505
544
|
return None
|
|
506
545
|
tkey = self.get(t.fmthm, self.get(str(t.hour), None))
|
|
507
546
|
if tkey is None:
|
|
508
|
-
logger.warning(
|
|
547
|
+
logger.warning(
|
|
548
|
+
"No entry found in the XXT file for term = %s.", t.fmthm
|
|
549
|
+
)
|
|
509
550
|
else:
|
|
510
551
|
try:
|
|
511
552
|
value = tkey[n]
|
|
@@ -532,17 +573,24 @@ class XXTContent(IndexedTable):
|
|
|
532
573
|
maxterm = -1
|
|
533
574
|
maxterm = Time(maxterm)
|
|
534
575
|
|
|
535
|
-
if (self._cachedomains is None) or (
|
|
536
|
-
|
|
576
|
+
if (self._cachedomains is None) or (
|
|
577
|
+
self._cachedomains_term != maxterm
|
|
578
|
+
):
|
|
537
579
|
select_seen = dict()
|
|
538
580
|
for a_term in [x for x in allterms if x <= maxterm]:
|
|
539
|
-
tvalue = self.get(
|
|
581
|
+
tvalue = self.get(
|
|
582
|
+
a_term.fmthm, self.get(str(a_term.hour), None)
|
|
583
|
+
)
|
|
540
584
|
sh = sessions.system()
|
|
541
585
|
if tvalue[0] is not None:
|
|
542
|
-
local_guesses = [tvalue[0],
|
|
586
|
+
local_guesses = [tvalue[0], "fpselect_" + a_term.fmthm]
|
|
543
587
|
if where:
|
|
544
|
-
local_guesses = [
|
|
545
|
-
|
|
588
|
+
local_guesses = [
|
|
589
|
+
sh.path.join(where, g) for g in local_guesses
|
|
590
|
+
]
|
|
591
|
+
local_guesses = [
|
|
592
|
+
g for g in local_guesses if sh.path.exists(g)
|
|
593
|
+
]
|
|
546
594
|
if local_guesses:
|
|
547
595
|
# Do not waste time on duplicated selects...
|
|
548
596
|
if tvalue[1] not in select_seen:
|
|
@@ -551,8 +599,14 @@ class XXTContent(IndexedTable):
|
|
|
551
599
|
xx = fortp.parse(fd.read())
|
|
552
600
|
domains = set()
|
|
553
601
|
for nb in xx.values():
|
|
554
|
-
for domlist in [
|
|
555
|
-
|
|
602
|
+
for domlist in [
|
|
603
|
+
y
|
|
604
|
+
for x, y in nb.items()
|
|
605
|
+
if x.startswith("CLD")
|
|
606
|
+
]:
|
|
607
|
+
domains = domains | set(
|
|
608
|
+
domlist.pop().split(":")
|
|
609
|
+
)
|
|
556
610
|
select_seen[tvalue[1]] = domains
|
|
557
611
|
else:
|
|
558
612
|
domains = select_seen[tvalue[1]]
|
|
@@ -571,74 +625,72 @@ class XXTContent(IndexedTable):
|
|
|
571
625
|
|
|
572
626
|
class NamelistSelectDef(StaticResource):
|
|
573
627
|
"""Utility, so-called xxt file."""
|
|
628
|
+
|
|
574
629
|
_footprint = [
|
|
575
630
|
cutoff,
|
|
576
631
|
gvar,
|
|
577
632
|
dict(
|
|
578
|
-
info
|
|
579
|
-
attr
|
|
580
|
-
gvar
|
|
581
|
-
values
|
|
582
|
-
default
|
|
633
|
+
info="xxt.def file from namelist pack",
|
|
634
|
+
attr=dict(
|
|
635
|
+
gvar=dict(
|
|
636
|
+
values=["NAMELIST_" + x.upper() for x in binaries],
|
|
637
|
+
default="namelist_[binary]",
|
|
583
638
|
),
|
|
584
|
-
source
|
|
585
|
-
optional
|
|
639
|
+
source=dict(
|
|
640
|
+
optional=True,
|
|
586
641
|
),
|
|
587
|
-
binary
|
|
588
|
-
optional
|
|
589
|
-
values
|
|
590
|
-
default
|
|
642
|
+
binary=dict(
|
|
643
|
+
optional=True,
|
|
644
|
+
values=binaries,
|
|
645
|
+
default="[model]",
|
|
591
646
|
),
|
|
592
|
-
kind
|
|
593
|
-
|
|
594
|
-
),
|
|
595
|
-
clscontents = dict(
|
|
596
|
-
default = XXTContent
|
|
597
|
-
)
|
|
647
|
+
kind=dict(values=["xxtdef", "namselectdef"]),
|
|
648
|
+
clscontents=dict(default=XXTContent),
|
|
598
649
|
),
|
|
599
|
-
bind
|
|
600
|
-
)
|
|
650
|
+
bind=["gvar", "source"],
|
|
651
|
+
),
|
|
601
652
|
]
|
|
602
653
|
|
|
603
|
-
_source_map = dict(
|
|
654
|
+
_source_map = dict(
|
|
655
|
+
assim="xxt.def.assim",
|
|
656
|
+
)
|
|
604
657
|
|
|
605
658
|
@property
|
|
606
659
|
def realkind(self):
|
|
607
|
-
return
|
|
660
|
+
return "namselectdef"
|
|
608
661
|
|
|
609
662
|
def gget_urlquery(self):
|
|
610
663
|
"""GGET specific query : ``extract``."""
|
|
611
664
|
if self.source is None:
|
|
612
|
-
thesource = self._source_map.get(self.cutoff,
|
|
665
|
+
thesource = self._source_map.get(self.cutoff, "xxt.def")
|
|
613
666
|
else:
|
|
614
667
|
thesource = self.source
|
|
615
|
-
return
|
|
668
|
+
return "extract=" + thesource
|
|
616
669
|
|
|
617
670
|
|
|
618
|
-
@namebuilding_insert(
|
|
671
|
+
@namebuilding_insert("src", lambda s: s.target)
|
|
619
672
|
class GeoBlocks(ModelGeoResource):
|
|
620
673
|
"""Extract of a namelist containing Geometry blocks."""
|
|
621
674
|
|
|
622
675
|
_footprint = dict(
|
|
623
|
-
attr
|
|
624
|
-
kind
|
|
625
|
-
info
|
|
626
|
-
values = ['geoblocks']
|
|
676
|
+
attr=dict(
|
|
677
|
+
kind=dict(
|
|
678
|
+
info="Geometry blocks of namelist.", values=["geoblocks"]
|
|
627
679
|
),
|
|
628
|
-
clscontents
|
|
629
|
-
default
|
|
680
|
+
clscontents=dict(
|
|
681
|
+
default=NamelistContent,
|
|
630
682
|
),
|
|
631
|
-
target
|
|
632
|
-
info
|
|
683
|
+
target=dict(
|
|
684
|
+
info="Scope that should use these blocks.",
|
|
633
685
|
),
|
|
634
|
-
nativefmt
|
|
635
|
-
optional
|
|
636
|
-
values
|
|
637
|
-
default
|
|
686
|
+
nativefmt=dict(
|
|
687
|
+
optional=True,
|
|
688
|
+
values=["nam"],
|
|
689
|
+
default="nam",
|
|
638
690
|
),
|
|
639
691
|
)
|
|
640
692
|
)
|
|
641
693
|
|
|
642
694
|
@property
|
|
643
695
|
def realkind(self):
|
|
644
|
-
return
|
|
696
|
+
return "geoblocks"
|