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.
- vortex/__init__.py +59 -45
- vortex/algo/__init__.py +3 -2
- vortex/algo/components.py +940 -614
- vortex/algo/mpitools.py +802 -497
- 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 +428 -225
- vortex/data/outflow.py +15 -15
- vortex/data/providers.py +185 -163
- vortex/data/resources.py +48 -42
- vortex/data/stores.py +544 -413
- 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 +420 -271
- vortex/nwp/algo/fpserver.py +683 -307
- vortex/nwp/algo/ifsnaming.py +205 -145
- vortex/nwp/algo/ifsroot.py +210 -122
- vortex/nwp/algo/monitoring.py +132 -76
- vortex/nwp/algo/mpitools.py +321 -191
- vortex/nwp/algo/odbtools.py +617 -353
- vortex/nwp/algo/oopsroot.py +449 -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 +125 -59
- 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 +311 -149
- vortex/tools/lfi.py +423 -216
- vortex/tools/listings.py +109 -40
- vortex/tools/names.py +218 -156
- vortex/tools/net.py +632 -298
- vortex/tools/parallelism.py +93 -61
- vortex/tools/prestaging.py +55 -31
- vortex/tools/schedulers.py +172 -105
- vortex/tools/services.py +402 -333
- vortex/tools/storage.py +293 -358
- vortex/tools/surfex.py +24 -24
- vortex/tools/systems.py +1211 -631
- vortex/tools/targets.py +156 -100
- vortex/util/__init__.py +1 -1
- vortex/util/config.py +377 -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.0.0b2.dist-info/METADATA +66 -0
- vortex_nwp-2.0.0b2.dist-info/RECORD +142 -0
- {vortex_nwp-2.0.0b1.dist-info → vortex_nwp-2.0.0b2.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.0.0b2.dist-info}/LICENSE +0 -0
- {vortex_nwp-2.0.0b1.dist-info → vortex_nwp-2.0.0b2.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 = (
|
|
28
|
+
_collector = ("vortexnamebuilder",)
|
|
28
29
|
_footprint = dict(
|
|
29
|
-
info
|
|
30
|
-
attr
|
|
31
|
-
name
|
|
32
|
-
info
|
|
30
|
+
info="Abstract Vortex NameBuilder",
|
|
31
|
+
attr=dict(
|
|
32
|
+
name=dict(
|
|
33
|
+
info="The NameBuilder's name.",
|
|
33
34
|
),
|
|
34
35
|
),
|
|
35
|
-
fastkeys
|
|
36
|
+
fastkeys={"name"},
|
|
36
37
|
)
|
|
37
38
|
|
|
38
39
|
def __init__(self, *args, **kw):
|
|
39
|
-
logger.debug(
|
|
40
|
+
logger.debug("Init VortexNameBuilder %s", self.__class__)
|
|
40
41
|
super().__init__(*args, **kw)
|
|
41
42
|
self._default = dict(
|
|
42
|
-
radical=
|
|
43
|
+
radical="vortexdata",
|
|
43
44
|
)
|
|
44
45
|
# List of known defaults
|
|
45
|
-
for k in [
|
|
46
|
-
|
|
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(
|
|
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(
|
|
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=
|
|
78
|
-
vbcollect.fasttrack = (
|
|
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(
|
|
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=
|
|
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(
|
|
148
|
-
|
|
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,
|
|
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
|
|
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 [
|
|
180
|
+
for k in ["vapp", "vconf", "experiment"]:
|
|
165
181
|
if k not in d:
|
|
166
|
-
raise VortexNameBuilderError(
|
|
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
|
|
173
|
-
pathbits.append(
|
|
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(
|
|
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
|
|
180
|
-
pathbits.append(
|
|
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(
|
|
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
|
|
187
|
-
pathbits.append(self._pack_std_item_member(d[
|
|
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
|
|
192
|
-
pathbits.append(self._pack_std_item_scenario(d[
|
|
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
|
|
197
|
-
if d[
|
|
198
|
-
pathbits.append(
|
|
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(
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
257
|
+
return "t{1:s}{2:s}{0!s}".format(*value)
|
|
236
258
|
else:
|
|
237
|
-
return
|
|
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
|
|
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,
|
|
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,
|
|
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=
|
|
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=
|
|
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
|
|
289
|
+
return "mb{:03d}".format(value)
|
|
268
290
|
|
|
269
291
|
def _pack_std_item_scenario(self, value):
|
|
270
|
-
return
|
|
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(
|
|
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 [
|
|
291
|
-
|
|
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
|
|
300
|
-
flowdate = flowitem[
|
|
301
|
-
if
|
|
302
|
-
flowcut = flowitem[
|
|
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(
|
|
331
|
+
raise VortexNameBuilderError("A date is mandatory here...")
|
|
306
332
|
else:
|
|
307
|
-
return
|
|
308
|
-
return self._pack_std_item_date(
|
|
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
|
|
318
|
-
flowbegin = flowitem[
|
|
319
|
-
if
|
|
320
|
-
flowend = flowitem[
|
|
321
|
-
if
|
|
322
|
-
flowcut = flowitem[
|
|
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(
|
|
353
|
+
raise VortexNameBuilderError(
|
|
354
|
+
"A begindate/enddate pair is mandatory here..."
|
|
355
|
+
)
|
|
326
356
|
else:
|
|
327
|
-
return
|
|
328
|
-
return
|
|
329
|
-
|
|
330
|
-
|
|
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[
|
|
337
|
-
name0 += self._join_basename_bit(d,
|
|
338
|
-
name0 += self._join_basename_bit(d,
|
|
339
|
-
name0 += self._join_basename_bit(d,
|
|
340
|
-
name0 += self._join_basename_bit(d,
|
|
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[
|
|
351
|
-
name += self._join_basename_bit(
|
|
352
|
-
|
|
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[
|
|
355
|
-
name += self._join_basename_bit(
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
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,
|
|
366
|
-
name1 += self._join_basename_bit(d,
|
|
367
|
-
name1 += self._join_basename_bit(d,
|
|
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=
|
|
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 (
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
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(
|
|
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
|
|
406
|
-
attr
|
|
407
|
-
name
|
|
408
|
-
values
|
|
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[
|
|
419
|
-
pstuff = self._pack_std_items_periodstuff(d[
|
|
470
|
+
name = ""
|
|
471
|
+
if d["flow"] is not None:
|
|
472
|
+
pstuff = self._pack_std_items_periodstuff(d["flow"])
|
|
420
473
|
if pstuff:
|
|
421
|
-
name +=
|
|
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(
|
|
484
|
+
obsfmt = d.get("nativefmt", d.get("fmt", None))
|
|
432
485
|
if obsfmt is None:
|
|
433
486
|
raise VortexNameBuilderError()
|
|
434
|
-
name =
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
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 =
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
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
|
|
479
|
-
attr
|
|
480
|
-
name
|
|
481
|
-
values
|
|
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[
|
|
491
|
-
dstuff = self._pack_std_items_datestuff(d[
|
|
548
|
+
name = ""
|
|
549
|
+
if d["flow"] is not None:
|
|
550
|
+
dstuff = self._pack_std_items_datestuff(d["flow"])
|
|
492
551
|
if dstuff:
|
|
493
|
-
name +=
|
|
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
|
|
516
|
-
attr
|
|
517
|
-
name
|
|
518
|
-
values
|
|
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[
|
|
528
|
-
dstuff = self._pack_std_items_datestuff(d[
|
|
587
|
+
name = ""
|
|
588
|
+
if d["flow"] is not None:
|
|
589
|
+
dstuff = self._pack_std_items_datestuff(d["flow"])
|
|
529
590
|
if dstuff:
|
|
530
|
-
name +=
|
|
531
|
-
pstuff = self._pack_std_items_periodstuff(d[
|
|
591
|
+
name += "." + dstuff
|
|
592
|
+
pstuff = self._pack_std_items_periodstuff(d["flow"])
|
|
532
593
|
if pstuff:
|
|
533
|
-
name +=
|
|
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
|
|
555
|
-
attr
|
|
556
|
-
name
|
|
557
|
-
values
|
|
558
|
-
|
|
559
|
-
|
|
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 =
|
|
567
|
-
if
|
|
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[
|
|
631
|
+
for item in [item for item in d["flow"] if isinstance(item, dict)]:
|
|
570
632
|
flowkeys.update(item.keys())
|
|
571
|
-
if
|
|
572
|
-
actual_builder_name =
|
|
573
|
-
elif
|
|
574
|
-
actual_builder_name =
|
|
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)
|