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/compression.py
CHANGED
|
@@ -23,7 +23,7 @@ logger = loggers.getLogger(__name__)
|
|
|
23
23
|
class CompressionPipeline:
|
|
24
24
|
"""Main interface to data compression algorithms."""
|
|
25
25
|
|
|
26
|
-
def __init__(self, system, compression=
|
|
26
|
+
def __init__(self, system, compression=""):
|
|
27
27
|
"""
|
|
28
28
|
:param System system: The system object that will be used to carry out
|
|
29
29
|
the task.
|
|
@@ -40,10 +40,10 @@ class CompressionPipeline:
|
|
|
40
40
|
self._units = list()
|
|
41
41
|
self._sh = system
|
|
42
42
|
self.description_string = compression
|
|
43
|
-
for c in [c for c in compression.split(
|
|
44
|
-
c_raw = c.split(
|
|
43
|
+
for c in [c for c in compression.split("|") if c]:
|
|
44
|
+
c_raw = c.split("&")
|
|
45
45
|
ckind = c_raw.pop(0)
|
|
46
|
-
cargs = dict([arg.split(
|
|
46
|
+
cargs = dict([arg.split("=", 1) for arg in c_raw])
|
|
47
47
|
self.add_compression_unit(ckind, **cargs)
|
|
48
48
|
|
|
49
49
|
def add_compression_unit(self, unit, **kwargs):
|
|
@@ -56,8 +56,9 @@ class CompressionPipeline:
|
|
|
56
56
|
"""
|
|
57
57
|
c_unit = footprints.proxy.compression_unit(kind=unit, **kwargs)
|
|
58
58
|
if c_unit is None:
|
|
59
|
-
raise ValueError(
|
|
60
|
-
|
|
59
|
+
raise ValueError(
|
|
60
|
+
"The {:s} compression unit could not be found.".format(unit)
|
|
61
|
+
)
|
|
61
62
|
self._units.append(c_unit)
|
|
62
63
|
|
|
63
64
|
@property
|
|
@@ -76,13 +77,15 @@ class CompressionPipeline:
|
|
|
76
77
|
@property
|
|
77
78
|
def suffix(self):
|
|
78
79
|
"""The suffix usualy associated with this compression pipeline."""
|
|
79
|
-
s =
|
|
80
|
-
return
|
|
80
|
+
s = ".".join([s.suffix for s in self.units])
|
|
81
|
+
return "." + s if s else ""
|
|
81
82
|
|
|
82
83
|
@property
|
|
83
84
|
def compression_factor(self):
|
|
84
85
|
"""The minimal compression factor expected with such a compression pipeline."""
|
|
85
|
-
return functools.reduce(
|
|
86
|
+
return functools.reduce(
|
|
87
|
+
operator.mul, [s.cfactor for s in self.units], 1.0
|
|
88
|
+
)
|
|
86
89
|
|
|
87
90
|
@staticmethod
|
|
88
91
|
def _inputstream_size(stream):
|
|
@@ -93,13 +96,13 @@ class CompressionPipeline:
|
|
|
93
96
|
estimated_size = stream.tell()
|
|
94
97
|
stream.seek(0)
|
|
95
98
|
except AttributeError:
|
|
96
|
-
logger.warning(
|
|
99
|
+
logger.warning("Could not rewind <source:%s>", str(stream))
|
|
97
100
|
except OSError:
|
|
98
|
-
logger.debug(
|
|
101
|
+
logger.debug("Seek trouble <source:%s>", str(stream))
|
|
99
102
|
return estimated_size
|
|
100
103
|
|
|
101
104
|
@contextmanager
|
|
102
|
-
def _openstream(self, local, mode=
|
|
105
|
+
def _openstream(self, local, mode="rb"):
|
|
103
106
|
"""If *local* is not an opened file, open it..."""
|
|
104
107
|
if isinstance(local, str):
|
|
105
108
|
localfh = open(local, mode)
|
|
@@ -114,7 +117,9 @@ class CompressionPipeline:
|
|
|
114
117
|
"""Close a list of Popen objects (and look for the returncode)."""
|
|
115
118
|
for i, p in enumerate(processes):
|
|
116
119
|
if not self._sh.pclose(p):
|
|
117
|
-
logger.error(
|
|
120
|
+
logger.error(
|
|
121
|
+
"Abnormal return code for one of the processes (#%d)", i
|
|
122
|
+
)
|
|
118
123
|
|
|
119
124
|
@contextmanager
|
|
120
125
|
def compress2stream(self, local, iosponge=False):
|
|
@@ -134,7 +139,9 @@ class CompressionPipeline:
|
|
|
134
139
|
be properly closed
|
|
135
140
|
"""
|
|
136
141
|
with self._openstream(local) as stream:
|
|
137
|
-
estimated_size =
|
|
142
|
+
estimated_size = (
|
|
143
|
+
self._inputstream_size(stream) * self.compression_factor
|
|
144
|
+
)
|
|
138
145
|
processes = list()
|
|
139
146
|
lstream = stream
|
|
140
147
|
for unit in self.units:
|
|
@@ -161,7 +168,7 @@ class CompressionPipeline:
|
|
|
161
168
|
*local* can be an opened file-like object or a filename.
|
|
162
169
|
*destination* is a filename.
|
|
163
170
|
"""
|
|
164
|
-
with open(destination,
|
|
171
|
+
with open(destination, "wb") as fhout:
|
|
165
172
|
with self.compress2stream(local) as fhcompressed:
|
|
166
173
|
return self._xcopyfileobj(fhcompressed, fhout)
|
|
167
174
|
|
|
@@ -189,7 +196,7 @@ class CompressionPipeline:
|
|
|
189
196
|
When leaving the context, the gunzip process that uncompresses the data
|
|
190
197
|
will be properly closed.
|
|
191
198
|
"""
|
|
192
|
-
with self._openstream(destination,
|
|
199
|
+
with self._openstream(destination, "wb") as dstream:
|
|
193
200
|
processes = list()
|
|
194
201
|
instream = True
|
|
195
202
|
nunits = len(self.units)
|
|
@@ -208,7 +215,7 @@ class CompressionPipeline:
|
|
|
208
215
|
*destination* can be an opened file-like object or a filename.
|
|
209
216
|
"""
|
|
210
217
|
with self.stream2uncompress(destination) as fhuncompressed:
|
|
211
|
-
with open(local,
|
|
218
|
+
with open(local, "rb") as fhcompressed:
|
|
212
219
|
return self._xcopyfileobj(fhcompressed, fhuncompressed)
|
|
213
220
|
|
|
214
221
|
|
|
@@ -216,22 +223,22 @@ class CompressionUnit(footprints.FootprintBase):
|
|
|
216
223
|
"""Defines compress/uncompress methods for a given compression tool."""
|
|
217
224
|
|
|
218
225
|
_abstract = True
|
|
219
|
-
_collector = (
|
|
226
|
+
_collector = ("compression_unit",)
|
|
220
227
|
_footprint = dict(
|
|
221
|
-
info
|
|
222
|
-
attr
|
|
223
|
-
kind
|
|
224
|
-
info
|
|
228
|
+
info="Abstract Compression Unit",
|
|
229
|
+
attr=dict(
|
|
230
|
+
kind=dict(
|
|
231
|
+
info="The name of the compression tool.",
|
|
225
232
|
),
|
|
226
|
-
suffix
|
|
227
|
-
info
|
|
228
|
-
optional
|
|
233
|
+
suffix=dict(
|
|
234
|
+
info="The usual file extension for this compression tool.",
|
|
235
|
+
optional=True,
|
|
229
236
|
),
|
|
230
|
-
cfactor
|
|
231
|
-
info
|
|
232
|
-
type
|
|
233
|
-
default
|
|
234
|
-
optional
|
|
237
|
+
cfactor=dict(
|
|
238
|
+
info="The usual compression factor for this compression tool.",
|
|
239
|
+
type=float,
|
|
240
|
+
default=1.0,
|
|
241
|
+
optional=True,
|
|
235
242
|
),
|
|
236
243
|
),
|
|
237
244
|
)
|
|
@@ -255,68 +262,64 @@ class CompressionUnit(footprints.FootprintBase):
|
|
|
255
262
|
|
|
256
263
|
|
|
257
264
|
class GzipCompressionUnit(CompressionUnit):
|
|
258
|
-
|
|
259
265
|
_footprint = dict(
|
|
260
|
-
info
|
|
261
|
-
attr
|
|
262
|
-
kind
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
suffix = dict(
|
|
266
|
-
default = 'gz',
|
|
267
|
-
),
|
|
268
|
-
complevel = dict(
|
|
269
|
-
info = "The gzip algorithm compression level (see 'man gzip')",
|
|
270
|
-
type = int,
|
|
271
|
-
values = range(1, 10),
|
|
272
|
-
default = 6,
|
|
273
|
-
optional = True
|
|
266
|
+
info="Compress/Uncompress a stream using gzip",
|
|
267
|
+
attr=dict(
|
|
268
|
+
kind=dict(values=["gzip", "gz"]),
|
|
269
|
+
suffix=dict(
|
|
270
|
+
default="gz",
|
|
274
271
|
),
|
|
275
|
-
|
|
276
|
-
|
|
272
|
+
complevel=dict(
|
|
273
|
+
info="The gzip algorithm compression level (see 'man gzip')",
|
|
274
|
+
type=int,
|
|
275
|
+
values=range(1, 10),
|
|
276
|
+
default=6,
|
|
277
|
+
optional=True,
|
|
277
278
|
),
|
|
279
|
+
cfactor=dict(default=0.9),
|
|
278
280
|
),
|
|
279
281
|
)
|
|
280
282
|
|
|
281
283
|
def compress(self, sh, stream):
|
|
282
284
|
"""Compress the input *stream*. Returns a Popen object."""
|
|
283
|
-
return self._run_in_pipe(
|
|
284
|
-
|
|
285
|
+
return self._run_in_pipe(
|
|
286
|
+
sh, ["gzip", "--stdout", "-{!s}".format(self.complevel)], stream
|
|
287
|
+
)
|
|
285
288
|
|
|
286
289
|
def uncompress(self, sh, stream, outstream=True):
|
|
287
290
|
"""Uncompress the input *stream*. Returns a Popen object."""
|
|
288
|
-
return self._run_in_pipe(sh, [
|
|
291
|
+
return self._run_in_pipe(sh, ["gunzip", "--stdout"], stream, outstream)
|
|
289
292
|
|
|
290
293
|
|
|
291
294
|
class Bzip2CompressionUnit(CompressionUnit):
|
|
292
|
-
|
|
293
295
|
_footprint = dict(
|
|
294
|
-
info
|
|
295
|
-
attr
|
|
296
|
-
kind
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
suffix = dict(
|
|
300
|
-
default = 'bz2',
|
|
296
|
+
info="Compress/Uncompress a stream using bzip2",
|
|
297
|
+
attr=dict(
|
|
298
|
+
kind=dict(values=["bzip2", "bz2"]),
|
|
299
|
+
suffix=dict(
|
|
300
|
+
default="bz2",
|
|
301
301
|
),
|
|
302
|
-
complevel
|
|
303
|
-
info
|
|
304
|
-
type
|
|
305
|
-
values
|
|
306
|
-
default
|
|
307
|
-
optional
|
|
302
|
+
complevel=dict(
|
|
303
|
+
info="The bzip2 algorithm compression level (see 'man bzip2')",
|
|
304
|
+
type=int,
|
|
305
|
+
values=range(1, 10),
|
|
306
|
+
default=9,
|
|
307
|
+
optional=True,
|
|
308
308
|
),
|
|
309
|
-
cfactor
|
|
310
|
-
default
|
|
309
|
+
cfactor=dict(
|
|
310
|
+
default=0.85,
|
|
311
311
|
),
|
|
312
312
|
),
|
|
313
313
|
)
|
|
314
314
|
|
|
315
315
|
def compress(self, sh, stream):
|
|
316
316
|
"""Compress the input *stream*. Returns a Popen object."""
|
|
317
|
-
return self._run_in_pipe(
|
|
318
|
-
|
|
317
|
+
return self._run_in_pipe(
|
|
318
|
+
sh, ["bzip2", "--stdout", "-{!s}".format(self.complevel)], stream
|
|
319
|
+
)
|
|
319
320
|
|
|
320
321
|
def uncompress(self, sh, stream, outstream=True):
|
|
321
322
|
"""Uncompress the input *stream*. Returns a Popen object."""
|
|
322
|
-
return self._run_in_pipe(
|
|
323
|
+
return self._run_in_pipe(
|
|
324
|
+
sh, ["bunzip2", "--stdout"], stream, outstream
|
|
325
|
+
)
|
vortex/tools/date.py
CHANGED
|
@@ -11,10 +11,17 @@ import sys
|
|
|
11
11
|
from bronx.stdtypes import date as _b_date
|
|
12
12
|
|
|
13
13
|
_ALIASES = _b_date.local_date_functions.copy()
|
|
14
|
-
_ALIASES.update(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
_ALIASES.update(
|
|
15
|
+
dict(
|
|
16
|
+
guess=_b_date.guess,
|
|
17
|
+
daterange=_b_date.daterange,
|
|
18
|
+
stamp=_b_date.stamp,
|
|
19
|
+
Period=_b_date.Period,
|
|
20
|
+
Date=_b_date.Date,
|
|
21
|
+
Time=_b_date.Time,
|
|
22
|
+
Month=_b_date.Month,
|
|
23
|
+
)
|
|
24
|
+
)
|
|
18
25
|
|
|
19
26
|
for n, obj in _ALIASES.items():
|
|
20
27
|
sys.modules[__name__].__dict__.update(_ALIASES)
|