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.
Files changed (141) hide show
  1. vortex/__init__.py +75 -47
  2. vortex/algo/__init__.py +3 -2
  3. vortex/algo/components.py +944 -618
  4. vortex/algo/mpitools.py +802 -497
  5. vortex/algo/mpitools_templates/__init__.py +1 -0
  6. vortex/algo/serversynctools.py +34 -33
  7. vortex/config.py +19 -22
  8. vortex/data/__init__.py +9 -3
  9. vortex/data/abstractstores.py +593 -655
  10. vortex/data/containers.py +217 -162
  11. vortex/data/contents.py +65 -39
  12. vortex/data/executables.py +93 -102
  13. vortex/data/flow.py +40 -34
  14. vortex/data/geometries.py +228 -132
  15. vortex/data/handlers.py +436 -227
  16. vortex/data/outflow.py +15 -15
  17. vortex/data/providers.py +185 -163
  18. vortex/data/resources.py +48 -42
  19. vortex/data/stores.py +540 -417
  20. vortex/data/sync_templates/__init__.py +0 -0
  21. vortex/gloves.py +114 -87
  22. vortex/layout/__init__.py +1 -8
  23. vortex/layout/contexts.py +150 -84
  24. vortex/layout/dataflow.py +353 -202
  25. vortex/layout/monitor.py +264 -128
  26. vortex/nwp/__init__.py +5 -2
  27. vortex/nwp/algo/__init__.py +14 -5
  28. vortex/nwp/algo/assim.py +205 -151
  29. vortex/nwp/algo/clim.py +683 -517
  30. vortex/nwp/algo/coupling.py +447 -225
  31. vortex/nwp/algo/eda.py +437 -229
  32. vortex/nwp/algo/eps.py +403 -231
  33. vortex/nwp/algo/forecasts.py +416 -275
  34. vortex/nwp/algo/fpserver.py +683 -307
  35. vortex/nwp/algo/ifsnaming.py +205 -145
  36. vortex/nwp/algo/ifsroot.py +215 -122
  37. vortex/nwp/algo/monitoring.py +137 -76
  38. vortex/nwp/algo/mpitools.py +330 -190
  39. vortex/nwp/algo/odbtools.py +637 -353
  40. vortex/nwp/algo/oopsroot.py +454 -273
  41. vortex/nwp/algo/oopstests.py +90 -56
  42. vortex/nwp/algo/request.py +287 -206
  43. vortex/nwp/algo/stdpost.py +878 -522
  44. vortex/nwp/data/__init__.py +22 -4
  45. vortex/nwp/data/assim.py +125 -137
  46. vortex/nwp/data/boundaries.py +121 -68
  47. vortex/nwp/data/climfiles.py +193 -211
  48. vortex/nwp/data/configfiles.py +73 -69
  49. vortex/nwp/data/consts.py +426 -401
  50. vortex/nwp/data/ctpini.py +59 -43
  51. vortex/nwp/data/diagnostics.py +94 -66
  52. vortex/nwp/data/eda.py +50 -51
  53. vortex/nwp/data/eps.py +195 -146
  54. vortex/nwp/data/executables.py +440 -434
  55. vortex/nwp/data/fields.py +63 -48
  56. vortex/nwp/data/gridfiles.py +183 -111
  57. vortex/nwp/data/logs.py +250 -217
  58. vortex/nwp/data/modelstates.py +180 -151
  59. vortex/nwp/data/monitoring.py +72 -99
  60. vortex/nwp/data/namelists.py +254 -202
  61. vortex/nwp/data/obs.py +400 -308
  62. vortex/nwp/data/oopsexec.py +22 -20
  63. vortex/nwp/data/providers.py +90 -65
  64. vortex/nwp/data/query.py +71 -82
  65. vortex/nwp/data/stores.py +49 -36
  66. vortex/nwp/data/surfex.py +136 -137
  67. vortex/nwp/syntax/__init__.py +1 -1
  68. vortex/nwp/syntax/stdattrs.py +173 -111
  69. vortex/nwp/tools/__init__.py +2 -2
  70. vortex/nwp/tools/addons.py +22 -17
  71. vortex/nwp/tools/agt.py +24 -12
  72. vortex/nwp/tools/bdap.py +16 -5
  73. vortex/nwp/tools/bdcp.py +4 -1
  74. vortex/nwp/tools/bdm.py +3 -0
  75. vortex/nwp/tools/bdmp.py +14 -9
  76. vortex/nwp/tools/conftools.py +728 -378
  77. vortex/nwp/tools/drhook.py +12 -8
  78. vortex/nwp/tools/grib.py +65 -39
  79. vortex/nwp/tools/gribdiff.py +22 -17
  80. vortex/nwp/tools/ifstools.py +82 -42
  81. vortex/nwp/tools/igastuff.py +167 -143
  82. vortex/nwp/tools/mars.py +14 -2
  83. vortex/nwp/tools/odb.py +234 -125
  84. vortex/nwp/tools/partitioning.py +61 -37
  85. vortex/nwp/tools/satrad.py +27 -12
  86. vortex/nwp/util/async.py +83 -55
  87. vortex/nwp/util/beacon.py +10 -10
  88. vortex/nwp/util/diffpygram.py +174 -86
  89. vortex/nwp/util/ens.py +144 -63
  90. vortex/nwp/util/hooks.py +30 -19
  91. vortex/nwp/util/taskdeco.py +28 -24
  92. vortex/nwp/util/usepygram.py +278 -172
  93. vortex/nwp/util/usetnt.py +31 -17
  94. vortex/sessions.py +72 -39
  95. vortex/syntax/__init__.py +1 -1
  96. vortex/syntax/stdattrs.py +410 -171
  97. vortex/syntax/stddeco.py +31 -22
  98. vortex/toolbox.py +327 -192
  99. vortex/tools/__init__.py +11 -2
  100. vortex/tools/actions.py +110 -121
  101. vortex/tools/addons.py +111 -92
  102. vortex/tools/arm.py +42 -22
  103. vortex/tools/compression.py +72 -69
  104. vortex/tools/date.py +11 -4
  105. vortex/tools/delayedactions.py +242 -132
  106. vortex/tools/env.py +75 -47
  107. vortex/tools/folder.py +342 -171
  108. vortex/tools/grib.py +341 -162
  109. vortex/tools/lfi.py +423 -216
  110. vortex/tools/listings.py +109 -40
  111. vortex/tools/names.py +218 -156
  112. vortex/tools/net.py +655 -299
  113. vortex/tools/parallelism.py +93 -61
  114. vortex/tools/prestaging.py +55 -31
  115. vortex/tools/schedulers.py +172 -105
  116. vortex/tools/services.py +403 -334
  117. vortex/tools/storage.py +293 -358
  118. vortex/tools/surfex.py +24 -24
  119. vortex/tools/systems.py +1234 -643
  120. vortex/tools/targets.py +156 -100
  121. vortex/util/__init__.py +1 -1
  122. vortex/util/config.py +378 -327
  123. vortex/util/empty.py +2 -2
  124. vortex/util/helpers.py +56 -24
  125. vortex/util/introspection.py +18 -12
  126. vortex/util/iosponge.py +8 -4
  127. vortex/util/roles.py +4 -6
  128. vortex/util/storefunctions.py +39 -13
  129. vortex/util/structs.py +3 -3
  130. vortex/util/worker.py +29 -17
  131. vortex_nwp-2.1.0.dist-info/METADATA +67 -0
  132. vortex_nwp-2.1.0.dist-info/RECORD +144 -0
  133. {vortex_nwp-2.0.0b1.dist-info → vortex_nwp-2.1.0.dist-info}/WHEEL +1 -1
  134. vortex/layout/appconf.py +0 -109
  135. vortex/layout/jobs.py +0 -1276
  136. vortex/layout/nodes.py +0 -1424
  137. vortex/layout/subjobs.py +0 -464
  138. vortex_nwp-2.0.0b1.dist-info/METADATA +0 -50
  139. vortex_nwp-2.0.0b1.dist-info/RECORD +0 -146
  140. {vortex_nwp-2.0.0b1.dist-info → vortex_nwp-2.1.0.dist-info/licenses}/LICENSE +0 -0
  141. {vortex_nwp-2.0.0b1.dist-info → vortex_nwp-2.1.0.dist-info}/top_level.txt +0 -0
vortex/tools/names.py CHANGED
@@ -17,6 +17,7 @@ logger = loggers.getLogger(__name__)
17
17
 
18
18
  class VortexNameBuilderError(ValueError):
19
19
  """Raised whenever the name building process fails."""
20
+
20
21
  pass
21
22
 
22
23
 
@@ -24,26 +25,39 @@ class AbstractVortexNameBuilder(footprints.FootprintBase):
24
25
  """Abstract class for any name building class."""
25
26
 
26
27
  _abstract = True
27
- _collector = ('vortexnamebuilder',)
28
+ _collector = ("vortexnamebuilder",)
28
29
  _footprint = dict(
29
- info = 'Abstract Vortex NameBuilder',
30
- attr = dict(
31
- name = dict(
32
- info = "The NameBuilder's name.",
30
+ info="Abstract Vortex NameBuilder",
31
+ attr=dict(
32
+ name=dict(
33
+ info="The NameBuilder's name.",
33
34
  ),
34
35
  ),
35
- fastkeys = {'name'}
36
+ fastkeys={"name"},
36
37
  )
37
38
 
38
39
  def __init__(self, *args, **kw):
39
- logger.debug('Init VortexNameBuilder %s', self.__class__)
40
+ logger.debug("Init VortexNameBuilder %s", self.__class__)
40
41
  super().__init__(*args, **kw)
41
42
  self._default = dict(
42
- radical='vortexdata',
43
+ radical="vortexdata",
43
44
  )
44
45
  # List of known defaults
45
- for k in ['flow', 'src', 'term', 'period', 'cen_period', 'geo', 'suffix',
46
- 'stage', 'fmt', 'part', 'compute', 'number', 'filtername']:
46
+ for k in [
47
+ "flow",
48
+ "src",
49
+ "term",
50
+ "period",
51
+ "cen_period",
52
+ "geo",
53
+ "suffix",
54
+ "stage",
55
+ "fmt",
56
+ "part",
57
+ "compute",
58
+ "number",
59
+ "filtername",
60
+ ]:
47
61
  self._default[k] = None
48
62
  self.setdefault(**kw)
49
63
 
@@ -66,16 +80,16 @@ class AbstractVortexNameBuilder(footprints.FootprintBase):
66
80
 
67
81
  def pack_basename(self, d):
68
82
  """Returns a basename given the **d** info dictionary."""
69
- raise NotImplementedError('This is an abstract method !')
83
+ raise NotImplementedError("This is an abstract method !")
70
84
 
71
85
  def pack_pathname(self, d):
72
86
  """Returns a pathname given the **d** info dictionary."""
73
- raise NotImplementedError('This is an abstract method !')
87
+ raise NotImplementedError("This is an abstract method !")
74
88
 
75
89
 
76
90
  # Activate the footprint's fasttrack on the resources collector
77
- vbcollect = footprints.collectors.get(tag='vortexnamebuilder')
78
- vbcollect.fasttrack = ('name', )
91
+ vbcollect = footprints.collectors.get(tag="vortexnamebuilder")
92
+ vbcollect.fasttrack = ("name",)
79
93
  del vbcollect
80
94
 
81
95
 
@@ -113,7 +127,7 @@ class AbstractVortexNameBuilderProxy(AbstractVortexNameBuilder):
113
127
 
114
128
  def _pick_actual_builder(self, d):
115
129
  """Given the input dictionary, returns the appropriate builder object."""
116
- raise NotImplementedError('This is an abstract method !')
130
+ raise NotImplementedError("This is an abstract method !")
117
131
 
118
132
  def pack_basename(self, d):
119
133
  """Returns a basename given the **d** info dictionary."""
@@ -135,7 +149,7 @@ class AbstractActualVortexNameBuilder(AbstractVortexNameBuilder):
135
149
 
136
150
  _abstract = True
137
151
 
138
- def _pack_generic(self, d, what, default='std'):
152
+ def _pack_generic(self, d, what, default="std"):
139
153
  """
140
154
  Build the resource vortex basename/pathname or whatever according to
141
155
  ``style`` value.
@@ -144,60 +158,68 @@ class AbstractActualVortexNameBuilder(AbstractVortexNameBuilder):
144
158
  components.update(self._default)
145
159
  components.update(d)
146
160
 
147
- packstyle = getattr(self, '_pack_{!s}_{!s}'.format(what,
148
- components.get('style', default)))
161
+ packstyle = getattr(
162
+ self,
163
+ "_pack_{!s}_{!s}".format(what, components.get("style", default)),
164
+ )
149
165
  return packstyle(components)
150
166
 
151
167
  def pack_basename(self, d):
152
168
  """Build the resource vortex basename according to ``style`` value."""
153
- return self._pack_generic(d, 'basename')
169
+ return self._pack_generic(d, "basename")
154
170
 
155
171
  def pack_pathname(self, d):
156
172
  """Build the resource vortex pathname according to ``style`` value."""
157
- return '/'.join(self._pack_generic(d, 'pathname'))
173
+ return "/".join(self._pack_generic(d, "pathname"))
158
174
 
159
175
  # A Vortex pathname may include the following bits
160
176
 
161
177
  def _pack_pathname_init(self, d):
162
178
  """Mandatory things to be packed into the pathname."""
163
179
  pathbits = []
164
- for k in ['vapp', 'vconf', 'experiment']:
180
+ for k in ["vapp", "vconf", "experiment"]:
165
181
  if k not in d:
166
- raise VortexNameBuilderError('The {!r} info key is mandatory'.format(k))
182
+ raise VortexNameBuilderError(
183
+ "The {!r} info key is mandatory".format(k)
184
+ )
167
185
  pathbits.append(str(d[k]))
168
186
  return pathbits
169
187
 
170
188
  def _pack_pathname_append_flowdate(self, pathbits, d):
171
189
  """Pack the date/cutoff that characterise the resource's flow."""
172
- if 'flow' in d and d['flow'] is not None:
173
- pathbits.append(self._pack_std_items_datestuff(d['flow'], fatal=True))
190
+ if "flow" in d and d["flow"] is not None:
191
+ pathbits.append(
192
+ self._pack_std_items_datestuff(d["flow"], fatal=True)
193
+ )
174
194
  else:
175
- raise VortexNameBuilderError('The flow info key is mandatory')
195
+ raise VortexNameBuilderError("The flow info key is mandatory")
176
196
 
177
197
  def _pack_pathname_append_flowperiod(self, pathbits, d):
178
198
  """Pack the period/cutoff that characterise the resource's flow."""
179
- if 'flow' in d and d['flow'] is not None:
180
- pathbits.append(self._pack_std_items_periodstuff(d['flow'], fatal=True))
199
+ if "flow" in d and d["flow"] is not None:
200
+ pathbits.append(
201
+ self._pack_std_items_periodstuff(d["flow"], fatal=True)
202
+ )
181
203
  else:
182
- raise VortexNameBuilderError('The flow info key is mandatory')
204
+ raise VortexNameBuilderError("The flow info key is mandatory")
183
205
 
184
206
  def _pack_pathname_append_member(self, pathbits, d):
185
207
  """Pack the provider's member number (optional)."""
186
- if 'member' in d and d['member'] is not None:
187
- pathbits.append(self._pack_std_item_member(d['member']))
208
+ if "member" in d and d["member"] is not None:
209
+ pathbits.append(self._pack_std_item_member(d["member"]))
188
210
 
189
211
  def _pack_pathname_append_scenario(self, pathbits, d):
190
212
  """Pack the provider's scenario identifier (optional)."""
191
- if 'scenario' in d and d['scenario'] is not None:
192
- pathbits.append(self._pack_std_item_scenario(d['scenario']))
213
+ if "scenario" in d and d["scenario"] is not None:
214
+ pathbits.append(self._pack_std_item_scenario(d["scenario"]))
193
215
 
194
216
  def _pack_pathname_append_block(self, pathbits, d):
195
217
  """Pack the provider's block name."""
196
- if 'block' in d:
197
- if d['block']:
198
- pathbits.append('_'.join(self._pack_std_items(d['block'])))
218
+ if "block" in d:
219
+ if d["block"]:
220
+ pathbits.append("_".join(self._pack_std_items(d["block"])))
199
221
  else:
200
- raise VortexNameBuilderError('The block info key is mandatory')
222
+ raise VortexNameBuilderError("The block info key is mandatory")
201
223
 
202
224
  # A bunch of utility methods that prepares values
203
225
 
@@ -207,67 +229,67 @@ class AbstractActualVortexNameBuilder(AbstractVortexNameBuilder):
207
229
 
208
230
  def _pack_std_item_seta(self, value):
209
231
  """Packing of a MPI-task number in first direction."""
210
- return 'a{:04d}'.format(int(value))
232
+ return "a{:04d}".format(int(value))
211
233
 
212
234
  def _pack_std_item_setb(self, value):
213
235
  """Packing of a MPI-task number in second direction."""
214
- return 'b{:04d}'.format(int(value))
236
+ return "b{:04d}".format(int(value))
215
237
 
216
238
  def _pack_std_item_mpi(self, value):
217
239
  """Packing of a MPI-task number."""
218
- return 'n{:04d}'.format(int(value))
240
+ return "n{:04d}".format(int(value))
219
241
 
220
242
  def _pack_std_item_openmp(self, value):
221
243
  """Packing of an OpenMP id number."""
222
- return 'omp{:02d}'.format(int(value))
244
+ return "omp{:02d}".format(int(value))
223
245
 
224
246
  def _pack_std_item_month(self, value):
225
247
  """Packing of a month-number value."""
226
- return 'm{!s}'.format(value)
248
+ return "m{!s}".format(value)
227
249
 
228
250
  def _pack_std_item_stretching(self, value):
229
251
  """Packing of the stretching factor in spectral geometry."""
230
- return 'c{!s}'.format(int(value * 10))
252
+ return "c{!s}".format(int(value * 10))
231
253
 
232
254
  def _pack_std_item_truncation(self, value):
233
255
  """Packing of the geometry's truncation value."""
234
256
  if isinstance(value, tuple):
235
- return 't{1:s}{2:s}{0!s}'.format(* value)
257
+ return "t{1:s}{2:s}{0!s}".format(*value)
236
258
  else:
237
- return 'tl{!s}'.format(value)
259
+ return "tl{!s}".format(value)
238
260
 
239
261
  def _pack_std_item_filtering(self, value):
240
262
  """Packing of the geometry's filtering value."""
241
- return 'f{!s}'.format(value)
263
+ return "f{!s}".format(value)
242
264
 
243
265
  def _pack_std_item_time(self, value):
244
266
  """Packing of a Time object."""
245
- return value.fmthm if hasattr(value, 'fmthm') else str(value)
267
+ return value.fmthm if hasattr(value, "fmthm") else str(value)
246
268
 
247
269
  _pack_std_item_begintime = _pack_std_item_time
248
270
  _pack_std_item_endtime = _pack_std_item_time
249
271
 
250
272
  def _pack_std_item_date(self, value):
251
273
  """Packing of a Time object."""
252
- return value.stdvortex if hasattr(value, 'stdvortex') else str(value)
274
+ return value.stdvortex if hasattr(value, "stdvortex") else str(value)
253
275
 
254
276
  _pack_std_item_begindate = _pack_std_item_date
255
277
  _pack_std_item_enddate = _pack_std_item_date
256
278
 
257
279
  def _pack_std_item_cutoff(self, value):
258
280
  """Abbreviate the cutoff name."""
259
- cutoff_map = dict(production='prod')
281
+ cutoff_map = dict(production="prod")
260
282
  return cutoff_map.get(value, value)
261
283
 
262
- def _pack_std_item_shortcutoff(self, value, default='X'):
284
+ def _pack_std_item_shortcutoff(self, value, default="X"):
263
285
  """Abbreviate the cutoff name."""
264
286
  return value[0].upper() if value is not None else default
265
287
 
266
288
  def _pack_std_item_member(self, value):
267
- return 'mb{:03d}'.format(value)
289
+ return "mb{:03d}".format(value)
268
290
 
269
291
  def _pack_std_item_scenario(self, value):
270
- return 's{:s}'.format(value)
292
+ return "s{:s}".format(value)
271
293
 
272
294
  def _pack_std_items(self, items):
273
295
  """
@@ -280,15 +302,19 @@ class AbstractActualVortexNameBuilder(AbstractVortexNameBuilder):
280
302
  for i in items:
281
303
  if isinstance(i, dict):
282
304
  for k, v in i.items():
283
- packmtd = getattr(self, '_pack_std_item_' + k, self._pack_void_item)
305
+ packmtd = getattr(
306
+ self, "_pack_std_item_" + k, self._pack_void_item
307
+ )
284
308
  packed.append(packmtd(v))
285
309
  else:
286
310
  packed.append(self._pack_void_item(i))
287
311
  return packed
288
312
 
289
313
  def _pack_std_items_negativetimes(self, items):
290
- return [(t[1:] + 'ago' if t[0] == '-' else t)
291
- for t in self._pack_std_items(items)]
314
+ return [
315
+ (t[1:] + "ago" if t[0] == "-" else t)
316
+ for t in self._pack_std_items(items)
317
+ ]
292
318
 
293
319
  def _pack_std_items_datestuff(self, d, fatal=False):
294
320
  """Specialised version of _pack_std_items that deals with date/cutoff pairs."""
@@ -296,16 +322,18 @@ class AbstractActualVortexNameBuilder(AbstractVortexNameBuilder):
296
322
  flowcut = None
297
323
  if isinstance(d, (tuple, list)):
298
324
  for flowitem in [x for x in d if isinstance(x, dict)]:
299
- if 'date' in flowitem:
300
- flowdate = flowitem['date']
301
- if 'shortcutoff' in flowitem:
302
- flowcut = flowitem['shortcutoff']
325
+ if "date" in flowitem:
326
+ flowdate = flowitem["date"]
327
+ if "shortcutoff" in flowitem:
328
+ flowcut = flowitem["shortcutoff"]
303
329
  if flowdate is None:
304
330
  if fatal:
305
- raise VortexNameBuilderError('A date is mandatory here...')
331
+ raise VortexNameBuilderError("A date is mandatory here...")
306
332
  else:
307
- return ''
308
- return self._pack_std_item_date(flowdate) + self._pack_std_item_shortcutoff(flowcut)
333
+ return ""
334
+ return self._pack_std_item_date(
335
+ flowdate
336
+ ) + self._pack_std_item_shortcutoff(flowcut)
309
337
 
310
338
  def _pack_std_items_periodstuff(self, d, fatal=False):
311
339
  """Specialised version of _pack_std_items that deals with begindate/enddate/cutoff pairs."""
@@ -314,67 +342,88 @@ class AbstractActualVortexNameBuilder(AbstractVortexNameBuilder):
314
342
  flowcut = None
315
343
  if isinstance(d, (tuple, list)):
316
344
  for flowitem in [x for x in d if isinstance(x, dict)]:
317
- if 'begindate' in flowitem:
318
- flowbegin = flowitem['begindate']
319
- if 'enddate' in flowitem:
320
- flowend = flowitem['enddate']
321
- if 'shortcutoff' in flowitem:
322
- flowcut = flowitem['shortcutoff']
345
+ if "begindate" in flowitem:
346
+ flowbegin = flowitem["begindate"]
347
+ if "enddate" in flowitem:
348
+ flowend = flowitem["enddate"]
349
+ if "shortcutoff" in flowitem:
350
+ flowcut = flowitem["shortcutoff"]
323
351
  if flowbegin is None or flowend is None:
324
352
  if fatal:
325
- raise VortexNameBuilderError('A begindate/enddate pair is mandatory here...')
353
+ raise VortexNameBuilderError(
354
+ "A begindate/enddate pair is mandatory here..."
355
+ )
326
356
  else:
327
- return ''
328
- return '-'.join([self._pack_std_item_date(flowbegin) +
329
- self._pack_std_item_shortcutoff(flowcut, default=''),
330
- self._pack_std_item_date(flowend)])
357
+ return ""
358
+ return "-".join(
359
+ [
360
+ self._pack_std_item_date(flowbegin)
361
+ + self._pack_std_item_shortcutoff(flowcut, default=""),
362
+ self._pack_std_item_date(flowend),
363
+ ]
364
+ )
331
365
 
332
366
  # A Vortex basename may include the following bits
333
367
 
334
368
  def _pack_std_basename_prefixstuff(self, d): # @UnusedVariable
335
369
  """Adds any info about date, cutoff ..."""
336
- name0 = d['radical']
337
- name0 += self._join_basename_bit(d, 'src', prefix='.', sep='-')
338
- name0 += self._join_basename_bit(d, 'filtername', prefix='.', sep='-')
339
- name0 += self._join_basename_bit(d, 'geo', prefix='.', sep='-')
340
- name0 += self._join_basename_bit(d, 'compute', prefix='.', sep='-')
370
+ name0 = d["radical"]
371
+ name0 += self._join_basename_bit(d, "src", prefix=".", sep="-")
372
+ name0 += self._join_basename_bit(d, "filtername", prefix=".", sep="-")
373
+ name0 += self._join_basename_bit(d, "geo", prefix=".", sep="-")
374
+ name0 += self._join_basename_bit(d, "compute", prefix=".", sep="-")
341
375
  return name0
342
376
 
343
377
  def _pack_std_basename_flowstuff(self, d): # @UnusedVariable
344
378
  """Adds any info about date, cutoff ..."""
345
- return ''
379
+ return ""
346
380
 
347
381
  def _pack_std_basename_timestuff(self, d): # @UnusedVariable
348
382
  """Adds any info about term, period, ..."""
349
- name = ''
350
- if d['term'] is not None:
351
- name += self._join_basename_bit(d, 'term', prefix='+', sep='.',
352
- packcb=self._pack_std_items_negativetimes)
383
+ name = ""
384
+ if d["term"] is not None:
385
+ name += self._join_basename_bit(
386
+ d,
387
+ "term",
388
+ prefix="+",
389
+ sep=".",
390
+ packcb=self._pack_std_items_negativetimes,
391
+ )
353
392
  else:
354
- if d['period'] is not None:
355
- name += self._join_basename_bit(d, 'period', prefix='+', sep='-',
356
- packcb=self._pack_std_items_negativetimes)
357
- elif d['cen_period'] is not None:
358
- name += self._join_basename_bit(d, 'cen_period', prefix='_', sep='_',
359
- packcb=self._pack_std_items_negativetimes)
393
+ if d["period"] is not None:
394
+ name += self._join_basename_bit(
395
+ d,
396
+ "period",
397
+ prefix="+",
398
+ sep="-",
399
+ packcb=self._pack_std_items_negativetimes,
400
+ )
401
+ elif d["cen_period"] is not None:
402
+ name += self._join_basename_bit(
403
+ d,
404
+ "cen_period",
405
+ prefix="_",
406
+ sep="_",
407
+ packcb=self._pack_std_items_negativetimes,
408
+ )
360
409
  return name
361
410
 
362
411
  def _pack_std_basename_suffixstuff(self, d): # @UnusedVariable
363
412
  """Adds any info about date, cutoff ..."""
364
- name1 = ''
365
- name1 += self._join_basename_bit(d, 'number', prefix='.', sep='-')
366
- name1 += self._join_basename_bit(d, 'fmt', prefix='.', sep='.')
367
- name1 += self._join_basename_bit(d, 'suffix', prefix='.', sep='.')
413
+ name1 = ""
414
+ name1 += self._join_basename_bit(d, "number", prefix=".", sep="-")
415
+ name1 += self._join_basename_bit(d, "fmt", prefix=".", sep=".")
416
+ name1 += self._join_basename_bit(d, "suffix", prefix=".", sep=".")
368
417
  return name1
369
418
 
370
- def _join_basename_bit(self, d, entry, prefix='.', sep='-', packcb=None):
419
+ def _join_basename_bit(self, d, entry, prefix=".", sep="-", packcb=None):
371
420
  if d[entry] is not None:
372
421
  if packcb is None:
373
422
  return prefix + sep.join(self._pack_std_items(d[entry]))
374
423
  else:
375
424
  return prefix + sep.join(packcb(d[entry]))
376
425
  else:
377
- return ''
426
+ return ""
378
427
 
379
428
  # Methods that generates basenames
380
429
 
@@ -383,10 +432,12 @@ class AbstractActualVortexNameBuilder(AbstractVortexNameBuilder):
383
432
  Main entry point to convert a description into a file name
384
433
  according to the so-called standard style.
385
434
  """
386
- return (self._pack_std_basename_prefixstuff(d).lower() +
387
- self._pack_std_basename_flowstuff(d) +
388
- self._pack_std_basename_timestuff(d) +
389
- self._pack_std_basename_suffixstuff(d).lower())
435
+ return (
436
+ self._pack_std_basename_prefixstuff(d).lower()
437
+ + self._pack_std_basename_flowstuff(d)
438
+ + self._pack_std_basename_timestuff(d)
439
+ + self._pack_std_basename_suffixstuff(d).lower()
440
+ )
390
441
 
391
442
  # Methods that generates pathnames
392
443
 
@@ -395,30 +446,32 @@ class AbstractActualVortexNameBuilder(AbstractVortexNameBuilder):
395
446
  Main entry point to convert a description into a path name
396
447
  according to the so-called standard style.
397
448
  """
398
- raise NotImplementedError('This is an abstract method !')
449
+ raise NotImplementedError("This is an abstract method !")
399
450
 
400
451
 
401
452
  class VortexDateNameBuilder(AbstractActualVortexNameBuilder):
402
453
  """A Standard Vortex NameBuilder (with date and cutoff)."""
403
454
 
404
455
  _footprint = dict(
405
- info = 'A Standard Vortex NameBuilder (with date and cutoff)',
406
- attr = dict(
407
- name = dict(
408
- values = ['date@std', ],
456
+ info="A Standard Vortex NameBuilder (with date and cutoff)",
457
+ attr=dict(
458
+ name=dict(
459
+ values=[
460
+ "date@std",
461
+ ],
409
462
  ),
410
- )
463
+ ),
411
464
  )
412
465
 
413
466
  # A Vortex basename may include the following bits
414
467
 
415
468
  def _pack_std_basename_flowstuff(self, d):
416
469
  """Adds any info about term and period, ..."""
417
- name = ''
418
- if d['flow'] is not None:
419
- pstuff = self._pack_std_items_periodstuff(d['flow'])
470
+ name = ""
471
+ if d["flow"] is not None:
472
+ pstuff = self._pack_std_items_periodstuff(d["flow"])
420
473
  if pstuff:
421
- name += '.' + pstuff
474
+ name += "." + pstuff
422
475
  return name
423
476
 
424
477
  # Methods that generates basenames
@@ -428,16 +481,18 @@ class VortexDateNameBuilder(AbstractActualVortexNameBuilder):
428
481
  Main entry point to convert a description into a file name
429
482
  according to the so-called observation style.
430
483
  """
431
- obsfmt = d.get('nativefmt', d.get('fmt', None))
484
+ obsfmt = d.get("nativefmt", d.get("fmt", None))
432
485
  if obsfmt is None:
433
486
  raise VortexNameBuilderError()
434
- name = '.'.join([
435
- obsfmt + '-' + d.get('layout', 'std'),
436
- 'void' if d['stage'] is None else d['stage'],
437
- 'all' if d['part'] is None else d['part'],
438
- ])
439
- if d['suffix'] is not None:
440
- name = name + '.' + d['suffix']
487
+ name = ".".join(
488
+ [
489
+ obsfmt + "-" + d.get("layout", "std"),
490
+ "void" if d["stage"] is None else d["stage"],
491
+ "all" if d["part"] is None else d["part"],
492
+ ]
493
+ )
494
+ if d["suffix"] is not None:
495
+ name = name + "." + d["suffix"]
441
496
 
442
497
  return name.lower()
443
498
 
@@ -446,11 +501,13 @@ class VortexDateNameBuilder(AbstractActualVortexNameBuilder):
446
501
  Main entry point to convert a description into a file name
447
502
  according to the so-called observation-map style.
448
503
  """
449
- name = '.'.join((
450
- d['radical'],
451
- '-'.join(self._pack_std_items(d['stage'])),
452
- 'txt' if d['fmt'] is None else d['fmt'],
453
- ))
504
+ name = ".".join(
505
+ (
506
+ d["radical"],
507
+ "-".join(self._pack_std_items(d["stage"])),
508
+ "txt" if d["fmt"] is None else d["fmt"],
509
+ )
510
+ )
454
511
  return name.lower()
455
512
 
456
513
  # Methods that generates pathnames
@@ -475,22 +532,24 @@ class VortexPeriodNameBuilder(AbstractActualVortexNameBuilder):
475
532
  """A Standard Vortex NameBuilder (with period and cutoff)."""
476
533
 
477
534
  _footprint = dict(
478
- info = 'A Standard Vortex NameBuilder (with period and cutoff)',
479
- attr = dict(
480
- name = dict(
481
- values = ['period@std', ],
535
+ info="A Standard Vortex NameBuilder (with period and cutoff)",
536
+ attr=dict(
537
+ name=dict(
538
+ values=[
539
+ "period@std",
540
+ ],
482
541
  ),
483
- )
542
+ ),
484
543
  )
485
544
 
486
545
  # A Vortex basename may include the following bits
487
546
 
488
547
  def _pack_std_basename_flowstuff(self, d):
489
- name = ''
490
- if d['flow'] is not None:
491
- dstuff = self._pack_std_items_datestuff(d['flow'])
548
+ name = ""
549
+ if d["flow"] is not None:
550
+ dstuff = self._pack_std_items_datestuff(d["flow"])
492
551
  if dstuff:
493
- name += '.' + dstuff
552
+ name += "." + dstuff
494
553
  return name
495
554
 
496
555
  # Methods that generates pathnames
@@ -512,25 +571,27 @@ class VortexFlatNameBuilder(AbstractActualVortexNameBuilder):
512
571
  """'A Standard Vortex NameBuilder (without date or period)."""
513
572
 
514
573
  _footprint = dict(
515
- info = 'A Standard Vortex NameBuilder (without date or period)',
516
- attr = dict(
517
- name = dict(
518
- values = ['flat@std', ],
574
+ info="A Standard Vortex NameBuilder (without date or period)",
575
+ attr=dict(
576
+ name=dict(
577
+ values=[
578
+ "flat@std",
579
+ ],
519
580
  ),
520
- )
581
+ ),
521
582
  )
522
583
 
523
584
  # A Vortex basename may include the following bits
524
585
 
525
586
  def _pack_std_basename_flowstuff(self, d):
526
- name = ''
527
- if d['flow'] is not None:
528
- dstuff = self._pack_std_items_datestuff(d['flow'])
587
+ name = ""
588
+ if d["flow"] is not None:
589
+ dstuff = self._pack_std_items_datestuff(d["flow"])
529
590
  if dstuff:
530
- name += '.' + dstuff
531
- pstuff = self._pack_std_items_periodstuff(d['flow'])
591
+ name += "." + dstuff
592
+ pstuff = self._pack_std_items_periodstuff(d["flow"])
532
593
  if pstuff:
533
- name += '.' + pstuff
594
+ name += "." + pstuff
534
595
  return name
535
596
 
536
597
  # Methods that generates pathnames
@@ -548,28 +609,29 @@ class VortexFlatNameBuilder(AbstractActualVortexNameBuilder):
548
609
 
549
610
 
550
611
  class VortexNameBuilder(AbstractVortexNameBuilderProxy):
551
-
552
612
  _explicit = False
553
613
  _footprint = dict(
554
- info = 'Standard Vortex NameBuilder Proxy',
555
- attr = dict(
556
- name = dict(
557
- values = ['std', ],
558
- optional = True,
559
- default = 'std',
614
+ info="Standard Vortex NameBuilder Proxy",
615
+ attr=dict(
616
+ name=dict(
617
+ values=[
618
+ "std",
619
+ ],
620
+ optional=True,
621
+ default="std",
560
622
  ),
561
- )
623
+ ),
562
624
  )
563
625
 
564
626
  def _pick_actual_builder(self, d):
565
627
  """Given the input dictionary, returns the appropriate builder object."""
566
- actual_builder_name = 'flat@std'
567
- if 'flow' in d and isinstance(d['flow'], (tuple, list)):
628
+ actual_builder_name = "flat@std"
629
+ if "flow" in d and isinstance(d["flow"], (tuple, list)):
568
630
  flowkeys = set()
569
- for item in [item for item in d['flow'] if isinstance(item, dict)]:
631
+ for item in [item for item in d["flow"] if isinstance(item, dict)]:
570
632
  flowkeys.update(item.keys())
571
- if 'date' in flowkeys:
572
- actual_builder_name = 'date@std'
573
- elif 'begindate' in flowkeys and 'enddate' in flowkeys:
574
- actual_builder_name = 'period@std'
633
+ if "date" in flowkeys:
634
+ actual_builder_name = "date@std"
635
+ elif "begindate" in flowkeys and "enddate" in flowkeys:
636
+ actual_builder_name = "period@std"
575
637
  return self._get_builder(actual_builder_name)