vortex-nwp 2.0.0b1__py3-none-any.whl → 2.0.0b2__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.
Files changed (139) hide show
  1. vortex/__init__.py +59 -45
  2. vortex/algo/__init__.py +3 -2
  3. vortex/algo/components.py +940 -614
  4. vortex/algo/mpitools.py +802 -497
  5. vortex/algo/serversynctools.py +34 -33
  6. vortex/config.py +19 -22
  7. vortex/data/__init__.py +9 -3
  8. vortex/data/abstractstores.py +593 -655
  9. vortex/data/containers.py +217 -162
  10. vortex/data/contents.py +65 -39
  11. vortex/data/executables.py +93 -102
  12. vortex/data/flow.py +40 -34
  13. vortex/data/geometries.py +228 -132
  14. vortex/data/handlers.py +428 -225
  15. vortex/data/outflow.py +15 -15
  16. vortex/data/providers.py +185 -163
  17. vortex/data/resources.py +48 -42
  18. vortex/data/stores.py +544 -413
  19. vortex/gloves.py +114 -87
  20. vortex/layout/__init__.py +1 -8
  21. vortex/layout/contexts.py +150 -84
  22. vortex/layout/dataflow.py +353 -202
  23. vortex/layout/monitor.py +264 -128
  24. vortex/nwp/__init__.py +5 -2
  25. vortex/nwp/algo/__init__.py +14 -5
  26. vortex/nwp/algo/assim.py +205 -151
  27. vortex/nwp/algo/clim.py +683 -517
  28. vortex/nwp/algo/coupling.py +447 -225
  29. vortex/nwp/algo/eda.py +437 -229
  30. vortex/nwp/algo/eps.py +403 -231
  31. vortex/nwp/algo/forecasts.py +420 -271
  32. vortex/nwp/algo/fpserver.py +683 -307
  33. vortex/nwp/algo/ifsnaming.py +205 -145
  34. vortex/nwp/algo/ifsroot.py +210 -122
  35. vortex/nwp/algo/monitoring.py +132 -76
  36. vortex/nwp/algo/mpitools.py +321 -191
  37. vortex/nwp/algo/odbtools.py +617 -353
  38. vortex/nwp/algo/oopsroot.py +449 -273
  39. vortex/nwp/algo/oopstests.py +90 -56
  40. vortex/nwp/algo/request.py +287 -206
  41. vortex/nwp/algo/stdpost.py +878 -522
  42. vortex/nwp/data/__init__.py +22 -4
  43. vortex/nwp/data/assim.py +125 -137
  44. vortex/nwp/data/boundaries.py +121 -68
  45. vortex/nwp/data/climfiles.py +193 -211
  46. vortex/nwp/data/configfiles.py +73 -69
  47. vortex/nwp/data/consts.py +426 -401
  48. vortex/nwp/data/ctpini.py +59 -43
  49. vortex/nwp/data/diagnostics.py +94 -66
  50. vortex/nwp/data/eda.py +50 -51
  51. vortex/nwp/data/eps.py +195 -146
  52. vortex/nwp/data/executables.py +440 -434
  53. vortex/nwp/data/fields.py +63 -48
  54. vortex/nwp/data/gridfiles.py +183 -111
  55. vortex/nwp/data/logs.py +250 -217
  56. vortex/nwp/data/modelstates.py +180 -151
  57. vortex/nwp/data/monitoring.py +72 -99
  58. vortex/nwp/data/namelists.py +254 -202
  59. vortex/nwp/data/obs.py +400 -308
  60. vortex/nwp/data/oopsexec.py +22 -20
  61. vortex/nwp/data/providers.py +90 -65
  62. vortex/nwp/data/query.py +71 -82
  63. vortex/nwp/data/stores.py +49 -36
  64. vortex/nwp/data/surfex.py +136 -137
  65. vortex/nwp/syntax/__init__.py +1 -1
  66. vortex/nwp/syntax/stdattrs.py +173 -111
  67. vortex/nwp/tools/__init__.py +2 -2
  68. vortex/nwp/tools/addons.py +22 -17
  69. vortex/nwp/tools/agt.py +24 -12
  70. vortex/nwp/tools/bdap.py +16 -5
  71. vortex/nwp/tools/bdcp.py +4 -1
  72. vortex/nwp/tools/bdm.py +3 -0
  73. vortex/nwp/tools/bdmp.py +14 -9
  74. vortex/nwp/tools/conftools.py +728 -378
  75. vortex/nwp/tools/drhook.py +12 -8
  76. vortex/nwp/tools/grib.py +65 -39
  77. vortex/nwp/tools/gribdiff.py +22 -17
  78. vortex/nwp/tools/ifstools.py +82 -42
  79. vortex/nwp/tools/igastuff.py +167 -143
  80. vortex/nwp/tools/mars.py +14 -2
  81. vortex/nwp/tools/odb.py +234 -125
  82. vortex/nwp/tools/partitioning.py +61 -37
  83. vortex/nwp/tools/satrad.py +27 -12
  84. vortex/nwp/util/async.py +83 -55
  85. vortex/nwp/util/beacon.py +10 -10
  86. vortex/nwp/util/diffpygram.py +174 -86
  87. vortex/nwp/util/ens.py +144 -63
  88. vortex/nwp/util/hooks.py +30 -19
  89. vortex/nwp/util/taskdeco.py +28 -24
  90. vortex/nwp/util/usepygram.py +278 -172
  91. vortex/nwp/util/usetnt.py +31 -17
  92. vortex/sessions.py +72 -39
  93. vortex/syntax/__init__.py +1 -1
  94. vortex/syntax/stdattrs.py +410 -171
  95. vortex/syntax/stddeco.py +31 -22
  96. vortex/toolbox.py +327 -192
  97. vortex/tools/__init__.py +11 -2
  98. vortex/tools/actions.py +125 -59
  99. vortex/tools/addons.py +111 -92
  100. vortex/tools/arm.py +42 -22
  101. vortex/tools/compression.py +72 -69
  102. vortex/tools/date.py +11 -4
  103. vortex/tools/delayedactions.py +242 -132
  104. vortex/tools/env.py +75 -47
  105. vortex/tools/folder.py +342 -171
  106. vortex/tools/grib.py +311 -149
  107. vortex/tools/lfi.py +423 -216
  108. vortex/tools/listings.py +109 -40
  109. vortex/tools/names.py +218 -156
  110. vortex/tools/net.py +632 -298
  111. vortex/tools/parallelism.py +93 -61
  112. vortex/tools/prestaging.py +55 -31
  113. vortex/tools/schedulers.py +172 -105
  114. vortex/tools/services.py +402 -333
  115. vortex/tools/storage.py +293 -358
  116. vortex/tools/surfex.py +24 -24
  117. vortex/tools/systems.py +1211 -631
  118. vortex/tools/targets.py +156 -100
  119. vortex/util/__init__.py +1 -1
  120. vortex/util/config.py +377 -327
  121. vortex/util/empty.py +2 -2
  122. vortex/util/helpers.py +56 -24
  123. vortex/util/introspection.py +18 -12
  124. vortex/util/iosponge.py +8 -4
  125. vortex/util/roles.py +4 -6
  126. vortex/util/storefunctions.py +39 -13
  127. vortex/util/structs.py +3 -3
  128. vortex/util/worker.py +29 -17
  129. vortex_nwp-2.0.0b2.dist-info/METADATA +66 -0
  130. vortex_nwp-2.0.0b2.dist-info/RECORD +142 -0
  131. {vortex_nwp-2.0.0b1.dist-info → vortex_nwp-2.0.0b2.dist-info}/WHEEL +1 -1
  132. vortex/layout/appconf.py +0 -109
  133. vortex/layout/jobs.py +0 -1276
  134. vortex/layout/nodes.py +0 -1424
  135. vortex/layout/subjobs.py +0 -464
  136. vortex_nwp-2.0.0b1.dist-info/METADATA +0 -50
  137. vortex_nwp-2.0.0b1.dist-info/RECORD +0 -146
  138. {vortex_nwp-2.0.0b1.dist-info → vortex_nwp-2.0.0b2.dist-info}/LICENSE +0 -0
  139. {vortex_nwp-2.0.0b1.dist-info → vortex_nwp-2.0.0b2.dist-info}/top_level.txt +0 -0
@@ -22,49 +22,71 @@ __all__ = []
22
22
 
23
23
  logger = loggers.getLogger(__name__)
24
24
 
25
- KNOWN_NAMELIST_MACROS = {'NPROC', 'NBPROC', 'NBPROC_IO', 'NCPROC', 'NDPROC',
26
- 'NBPROCIN', 'NBPROCOUT', 'IDAT', 'CEXP',
27
- 'TIMESTEP', 'FCSTOP', 'NMODVAL', 'NBE', 'SEED',
28
- 'MEMBER', 'NUMOD', 'OUTPUTID', 'NRESX', 'PERTURB',
29
- 'JOUR', 'RES', 'LLADAJ', 'LLADMON', 'LLFLAG',
30
- 'LLARO', 'LLVRP', 'LLCAN'}
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 = 'A whole Namelist pack',
41
- attr = dict(
42
- kind = dict(
43
- values = ['namelistpack']
44
- ),
45
- gvar = dict(
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 = dict(
50
- optional = True,
71
+ model=dict(
72
+ optional=True,
51
73
  ),
52
- binary = dict(
53
- optional = True,
54
- values = binaries,
55
- default = '[model]',
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 'namelistpack'
85
+ return "namelistpack"
64
86
 
65
87
  def gget_urlquery(self):
66
88
  """GGET specific query : ``dir_extract``."""
67
- return 'dir_extract=1'
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('macros', {k: None for k in KNOWN_NAMELIST_MACROS})
85
- kw.setdefault('remove', set())
86
- kw.setdefault('parser', None)
87
- kw.setdefault('data', NamelistSet())
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, 'rmblocks'):
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(actualdelta,
134
- rmkeys=rmkeys, rmblocks=rmblocks, clblocks=clblocks)
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('Could not parse container contents: {!s}'.format(e))
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 = 'Namelist from binary pack',
174
- attr = dict(
175
- kind = dict(
176
- values = ['namelist']
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
- clscontents = dict(
179
- default = NamelistContent
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
- gvar = dict(
182
- values = ['NAMELIST_' + x.upper() for x in binaries],
183
- default = 'namelist_[binary]'
213
+ model=dict(
214
+ optional=True,
184
215
  ),
185
- source = dict(
186
- info = 'The namelist name within the namelist pack.',
187
- optional = True,
188
- default = 'namel_[binary]',
189
- doc_zorder = 50
216
+ binary=dict(
217
+ optional=True,
218
+ values=binaries,
219
+ default="[model]",
190
220
  ),
191
- model = dict(
192
- optional = True,
221
+ date=dict(
222
+ type=Date,
223
+ optional=True,
193
224
  ),
194
- binary = dict(
195
- optional = True,
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 'namelist'
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(':')[0]
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('The date argument should be provided when dealing ' +
219
- 'with time based namelist sources.')
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('%s already begins the %s, %s is ignored.',
232
- datedSource[date],
233
- date.strftime('%d of %b.'), dateNsource[0])
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('The consistent source is %s', source)
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 'extract=' + self._find_source()
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 = dict(
256
- kind = dict(
257
- values = ['namdelta', 'deltanam', ]
282
+ attr=dict(
283
+ kind=dict(
284
+ values=[
285
+ "namdelta",
286
+ "deltanam",
287
+ ]
258
288
  ),
259
- source = dict(
260
- default = 'deltanam.[binary]',
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 'namdelta'
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 = 'Namelist from utilities pack',
276
- attr = dict(
277
- kind = dict(
278
- values = ['namelist_util', 'namutil'],
279
- remap = dict(autoremap = 'first'),
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 = dict(
282
- values = ['NAMELIST_UTILITIES'],
283
- default = 'namelist_utilities'
312
+ gvar=dict(
313
+ values=["NAMELIST_UTILITIES"], default="namelist_utilities"
284
314
  ),
285
- binary = dict(
286
- values = ['batodb', 'utilities', 'odbtools'],
287
- default = 'utilities',
288
- optional = True,
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 = 'Terms dependent namelist',
302
- attr = dict(
303
- kind = dict(
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('xxt.def') as f:
349
+ with open("xxt.def") as f:
323
350
  lines = f.readlines()
324
351
  except OSError:
325
- logger.error('Could not open file xxt.def')
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'undef', select):
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 ''.join((key, '_', fp, s))
364
+ s = ""
365
+ return "".join((key, "_", fp, s))
339
366
  else:
340
367
  return select
341
368
  else:
342
- logger.error('Fullpos namelist id not defined for term %s', self.term)
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'^(.*\/)?(' + key + r'.*_fp|cpl)$')
349
- r2 = re.compile(r'^(.*\/)?(' + key + r'.*_fp)(\..*)$')
350
- r3 = re.compile(r'^(.*\/)?(' + key + r'.*_p)$')
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 = '0'
393
+ p = "0"
365
394
  elif self.term.hour % 6 == 0:
366
- p = '6'
395
+ p = "6"
367
396
  elif self.term.hour % 3 == 0:
368
- p = '3'
397
+ p = "3"
369
398
  else:
370
- p = '1'
399
+ p = "1"
371
400
  else:
372
401
  if self.term.hour == 0:
373
- p = '0'
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 = 'Select namelist for fullpos ',
394
- attr = dict(
395
- kind = dict(
396
- values = ['namselect', ]
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 'namselect'
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('VORTEX_XXT_DEF'):
410
- return 'extract=' + self.incoming_xxt_fixup('source', 'select')
441
+ if myenv.true("VORTEX_XXT_DEF"):
442
+ return "extract=" + self.incoming_xxt_fixup("source", "select")
411
443
  else:
412
- return 'extract={:s}'.format(self.source)
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 = 'Namelist for offline fullpos ',
422
- attr = dict(
423
- kind = dict(
424
- values = ['namelistfp', ]
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 'namelistfp'
467
+ return "namelistfp"
433
468
 
434
469
  def gget_urlquery(self):
435
470
  """GGET specific query : ``extract``."""
436
- return 'extract=' + self.incoming_namelist_fixup('source', 'namel')
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 = 'Namelist for a fullpos server object',
444
- attr = dict(
445
- kind = dict(
446
- values = ['namelist_fpobject', ]
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 = dict(
449
- info = 'The FPCONF setting associated with this object.',
450
- type = int,
451
- optional = True,
485
+ fp_conf=dict(
486
+ info="The FPCONF setting associated with this object.",
487
+ type=int,
488
+ optional=True,
452
489
  ),
453
- fp_cmodel = dict(
454
- info = 'The CMODEL setting associated with this object.',
455
- optional = True,
490
+ fp_cmodel=dict(
491
+ info="The CMODEL setting associated with this object.",
492
+ optional=True,
456
493
  ),
457
- fp_lextern = dict(
458
- info = 'The LEXTERN setting associated with this object.',
459
- type = bool,
460
- optional = True,
494
+ fp_lextern=dict(
495
+ info="The LEXTERN setting associated with this object.",
496
+ type=bool,
497
+ optional=True,
461
498
  ),
462
- fp_terms = dict(
463
- info = ('Apply this object only on a subset of the input '
464
- 'data (based on term)'),
465
- type = FPList,
466
- optional = True,
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 'namelist_fpobject'
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('term', x.get('term', None))
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('No entry found in the XXT file for term = %s.', t.fmthm)
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 (self._cachedomains_term != maxterm):
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(a_term.fmthm, self.get(str(a_term.hour), None))
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], 'fpselect_' + a_term.fmthm]
586
+ local_guesses = [tvalue[0], "fpselect_" + a_term.fmthm]
543
587
  if where:
544
- local_guesses = [sh.path.join(where, g) for g in local_guesses]
545
- local_guesses = [g for g in local_guesses if sh.path.exists(g)]
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 [y for x, y in nb.items() if x.startswith('CLD')]:
555
- domains = domains | set(domlist.pop().split(':'))
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 = 'xxt.def file from namelist pack',
579
- attr = dict(
580
- gvar = dict(
581
- values = ['NAMELIST_' + x.upper() for x in binaries],
582
- default = 'namelist_[binary]'
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 = dict(
585
- optional = True,
639
+ source=dict(
640
+ optional=True,
586
641
  ),
587
- binary = dict(
588
- optional = True,
589
- values = binaries,
590
- default = '[model]',
642
+ binary=dict(
643
+ optional=True,
644
+ values=binaries,
645
+ default="[model]",
591
646
  ),
592
- kind = dict(
593
- values = ['xxtdef', 'namselectdef']
594
- ),
595
- clscontents = dict(
596
- default = XXTContent
597
- )
647
+ kind=dict(values=["xxtdef", "namselectdef"]),
648
+ clscontents=dict(default=XXTContent),
598
649
  ),
599
- bind = ['gvar', 'source']
600
- )
650
+ bind=["gvar", "source"],
651
+ ),
601
652
  ]
602
653
 
603
- _source_map = dict(assim='xxt.def.assim', )
654
+ _source_map = dict(
655
+ assim="xxt.def.assim",
656
+ )
604
657
 
605
658
  @property
606
659
  def realkind(self):
607
- return 'namselectdef'
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, 'xxt.def')
665
+ thesource = self._source_map.get(self.cutoff, "xxt.def")
613
666
  else:
614
667
  thesource = self.source
615
- return 'extract=' + thesource
668
+ return "extract=" + thesource
616
669
 
617
670
 
618
- @namebuilding_insert('src', lambda s: s.target)
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 = dict(
624
- kind = dict(
625
- info = "Geometry blocks of namelist.",
626
- values = ['geoblocks']
676
+ attr=dict(
677
+ kind=dict(
678
+ info="Geometry blocks of namelist.", values=["geoblocks"]
627
679
  ),
628
- clscontents = dict(
629
- default = NamelistContent,
680
+ clscontents=dict(
681
+ default=NamelistContent,
630
682
  ),
631
- target = dict(
632
- info = "Scope that should use these blocks.",
683
+ target=dict(
684
+ info="Scope that should use these blocks.",
633
685
  ),
634
- nativefmt = dict(
635
- optional = True,
636
- values = ['nam'],
637
- default = 'nam',
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 'geoblocks'
696
+ return "geoblocks"