vortex-nwp 2.0.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 (144) hide show
  1. vortex/__init__.py +159 -0
  2. vortex/algo/__init__.py +13 -0
  3. vortex/algo/components.py +2462 -0
  4. vortex/algo/mpitools.py +1953 -0
  5. vortex/algo/mpitools_templates/__init__.py +1 -0
  6. vortex/algo/mpitools_templates/envelope_wrapper_default.tpl +27 -0
  7. vortex/algo/mpitools_templates/envelope_wrapper_mpiauto.tpl +29 -0
  8. vortex/algo/mpitools_templates/wrapstd_wrapper_default.tpl +18 -0
  9. vortex/algo/serversynctools.py +171 -0
  10. vortex/config.py +112 -0
  11. vortex/data/__init__.py +19 -0
  12. vortex/data/abstractstores.py +1510 -0
  13. vortex/data/containers.py +835 -0
  14. vortex/data/contents.py +622 -0
  15. vortex/data/executables.py +275 -0
  16. vortex/data/flow.py +119 -0
  17. vortex/data/geometries.ini +2689 -0
  18. vortex/data/geometries.py +799 -0
  19. vortex/data/handlers.py +1230 -0
  20. vortex/data/outflow.py +67 -0
  21. vortex/data/providers.py +487 -0
  22. vortex/data/resources.py +207 -0
  23. vortex/data/stores.py +1390 -0
  24. vortex/data/sync_templates/__init__.py +0 -0
  25. vortex/gloves.py +309 -0
  26. vortex/layout/__init__.py +20 -0
  27. vortex/layout/contexts.py +577 -0
  28. vortex/layout/dataflow.py +1220 -0
  29. vortex/layout/monitor.py +969 -0
  30. vortex/nwp/__init__.py +14 -0
  31. vortex/nwp/algo/__init__.py +21 -0
  32. vortex/nwp/algo/assim.py +537 -0
  33. vortex/nwp/algo/clim.py +1086 -0
  34. vortex/nwp/algo/coupling.py +831 -0
  35. vortex/nwp/algo/eda.py +840 -0
  36. vortex/nwp/algo/eps.py +785 -0
  37. vortex/nwp/algo/forecasts.py +886 -0
  38. vortex/nwp/algo/fpserver.py +1303 -0
  39. vortex/nwp/algo/ifsnaming.py +463 -0
  40. vortex/nwp/algo/ifsroot.py +404 -0
  41. vortex/nwp/algo/monitoring.py +263 -0
  42. vortex/nwp/algo/mpitools.py +694 -0
  43. vortex/nwp/algo/odbtools.py +1258 -0
  44. vortex/nwp/algo/oopsroot.py +916 -0
  45. vortex/nwp/algo/oopstests.py +220 -0
  46. vortex/nwp/algo/request.py +660 -0
  47. vortex/nwp/algo/stdpost.py +1641 -0
  48. vortex/nwp/data/__init__.py +30 -0
  49. vortex/nwp/data/assim.py +380 -0
  50. vortex/nwp/data/boundaries.py +314 -0
  51. vortex/nwp/data/climfiles.py +521 -0
  52. vortex/nwp/data/configfiles.py +153 -0
  53. vortex/nwp/data/consts.py +954 -0
  54. vortex/nwp/data/ctpini.py +149 -0
  55. vortex/nwp/data/diagnostics.py +209 -0
  56. vortex/nwp/data/eda.py +147 -0
  57. vortex/nwp/data/eps.py +432 -0
  58. vortex/nwp/data/executables.py +1045 -0
  59. vortex/nwp/data/fields.py +111 -0
  60. vortex/nwp/data/gridfiles.py +380 -0
  61. vortex/nwp/data/logs.py +584 -0
  62. vortex/nwp/data/modelstates.py +363 -0
  63. vortex/nwp/data/monitoring.py +193 -0
  64. vortex/nwp/data/namelists.py +696 -0
  65. vortex/nwp/data/obs.py +840 -0
  66. vortex/nwp/data/oopsexec.py +74 -0
  67. vortex/nwp/data/providers.py +207 -0
  68. vortex/nwp/data/query.py +206 -0
  69. vortex/nwp/data/stores.py +160 -0
  70. vortex/nwp/data/surfex.py +337 -0
  71. vortex/nwp/syntax/__init__.py +9 -0
  72. vortex/nwp/syntax/stdattrs.py +437 -0
  73. vortex/nwp/tools/__init__.py +10 -0
  74. vortex/nwp/tools/addons.py +40 -0
  75. vortex/nwp/tools/agt.py +67 -0
  76. vortex/nwp/tools/bdap.py +59 -0
  77. vortex/nwp/tools/bdcp.py +41 -0
  78. vortex/nwp/tools/bdm.py +24 -0
  79. vortex/nwp/tools/bdmp.py +54 -0
  80. vortex/nwp/tools/conftools.py +1661 -0
  81. vortex/nwp/tools/drhook.py +66 -0
  82. vortex/nwp/tools/grib.py +294 -0
  83. vortex/nwp/tools/gribdiff.py +104 -0
  84. vortex/nwp/tools/ifstools.py +203 -0
  85. vortex/nwp/tools/igastuff.py +273 -0
  86. vortex/nwp/tools/mars.py +68 -0
  87. vortex/nwp/tools/odb.py +657 -0
  88. vortex/nwp/tools/partitioning.py +258 -0
  89. vortex/nwp/tools/satrad.py +71 -0
  90. vortex/nwp/util/__init__.py +6 -0
  91. vortex/nwp/util/async.py +212 -0
  92. vortex/nwp/util/beacon.py +40 -0
  93. vortex/nwp/util/diffpygram.py +447 -0
  94. vortex/nwp/util/ens.py +279 -0
  95. vortex/nwp/util/hooks.py +139 -0
  96. vortex/nwp/util/taskdeco.py +85 -0
  97. vortex/nwp/util/usepygram.py +697 -0
  98. vortex/nwp/util/usetnt.py +101 -0
  99. vortex/proxy.py +6 -0
  100. vortex/sessions.py +374 -0
  101. vortex/syntax/__init__.py +9 -0
  102. vortex/syntax/stdattrs.py +867 -0
  103. vortex/syntax/stddeco.py +185 -0
  104. vortex/toolbox.py +1117 -0
  105. vortex/tools/__init__.py +20 -0
  106. vortex/tools/actions.py +523 -0
  107. vortex/tools/addons.py +316 -0
  108. vortex/tools/arm.py +96 -0
  109. vortex/tools/compression.py +325 -0
  110. vortex/tools/date.py +27 -0
  111. vortex/tools/ddhpack.py +10 -0
  112. vortex/tools/delayedactions.py +782 -0
  113. vortex/tools/env.py +541 -0
  114. vortex/tools/folder.py +834 -0
  115. vortex/tools/grib.py +738 -0
  116. vortex/tools/lfi.py +953 -0
  117. vortex/tools/listings.py +423 -0
  118. vortex/tools/names.py +637 -0
  119. vortex/tools/net.py +2124 -0
  120. vortex/tools/odb.py +10 -0
  121. vortex/tools/parallelism.py +368 -0
  122. vortex/tools/prestaging.py +210 -0
  123. vortex/tools/rawfiles.py +10 -0
  124. vortex/tools/schedulers.py +480 -0
  125. vortex/tools/services.py +940 -0
  126. vortex/tools/storage.py +996 -0
  127. vortex/tools/surfex.py +61 -0
  128. vortex/tools/systems.py +3976 -0
  129. vortex/tools/targets.py +440 -0
  130. vortex/util/__init__.py +9 -0
  131. vortex/util/config.py +1122 -0
  132. vortex/util/empty.py +24 -0
  133. vortex/util/helpers.py +216 -0
  134. vortex/util/introspection.py +69 -0
  135. vortex/util/iosponge.py +80 -0
  136. vortex/util/roles.py +49 -0
  137. vortex/util/storefunctions.py +129 -0
  138. vortex/util/structs.py +26 -0
  139. vortex/util/worker.py +162 -0
  140. vortex_nwp-2.0.0.dist-info/METADATA +67 -0
  141. vortex_nwp-2.0.0.dist-info/RECORD +144 -0
  142. vortex_nwp-2.0.0.dist-info/WHEEL +5 -0
  143. vortex_nwp-2.0.0.dist-info/licenses/LICENSE +517 -0
  144. vortex_nwp-2.0.0.dist-info/top_level.txt +1 -0
File without changes
vortex/gloves.py ADDED
@@ -0,0 +1,309 @@
1
+ """
2
+ GLObal Versatile Environment classes are responsible for session-wide
3
+ configuration (username, emil adress, ...)
4
+ """
5
+
6
+ from bronx.fancies import loggers
7
+ import footprints
8
+
9
+ from vortex.tools.env import Environment
10
+
11
+ #: No automatic export
12
+ __all__ = []
13
+
14
+ logger = loggers.getLogger(__name__)
15
+
16
+
17
+ class Glove(footprints.FootprintBase):
18
+ """Base class for GLObal Versatile Environment."""
19
+
20
+ _abstract = True
21
+ _collector = ("glove",)
22
+ _footprint = dict(
23
+ info="Abstract glove",
24
+ attr=dict(
25
+ email=dict(
26
+ alias=["address"],
27
+ optional=True,
28
+ default=Environment(active=False)["email"],
29
+ access="rwx",
30
+ ),
31
+ vapp=dict(
32
+ optional=True,
33
+ default="play",
34
+ access="rwx",
35
+ ),
36
+ vconf=dict(
37
+ optional=True,
38
+ default="sandbox",
39
+ access="rwx",
40
+ ),
41
+ tag=dict(
42
+ optional=True,
43
+ default="default",
44
+ ),
45
+ user=dict(
46
+ alias=("logname", "username"),
47
+ optional=True,
48
+ default=Environment(active=False)["logname"],
49
+ ),
50
+ profile=dict(
51
+ alias=("kind", "membership"),
52
+ values=["oper", "dble", "test", "research", "tourist"],
53
+ remap=dict(tourist="research"),
54
+ ),
55
+ ),
56
+ )
57
+
58
+ def __init__(self, *args, **kw):
59
+ logger.debug("Glove abstract %s init", self.__class__)
60
+ super().__init__(*args, **kw)
61
+ self._rmdepthmin = 3
62
+ self._siteroot = None
63
+ self._siteconf = None
64
+ self._sitedoc = None
65
+ self._sitesrc = None
66
+ self._ftdhost = None
67
+ self._ftduser = None
68
+ self._ftusers = dict()
69
+
70
+ @property
71
+ def realkind(self):
72
+ """Returns the litteral string identity of the current glove."""
73
+ return "glove"
74
+
75
+ @property
76
+ def configrc(self):
77
+ """Returns the path of the default directory where ``.ini`` files are stored."""
78
+ return Environment(active=False).HOME + "/.vortexrc"
79
+
80
+ @property
81
+ def siteroot(self):
82
+ """Returns the path of the vortex install directory."""
83
+ if not self._siteroot:
84
+ self._siteroot = "/".join(__file__.split("/")[0:-3])
85
+ return self._siteroot
86
+
87
+ @property
88
+ def siteconf(self):
89
+ """Returns the path of the default directory where ``.ini`` files are stored."""
90
+ if not self._siteconf:
91
+ self._siteconf = "/".join((self.siteroot, "conf"))
92
+ return self._siteconf
93
+
94
+ @property
95
+ def sitedoc(self):
96
+ """Returns the path of the default directory where ``.ini`` files are stored."""
97
+ if not self._sitedoc:
98
+ self._sitedoc = "/".join((self.siteroot, "sphinx"))
99
+ return self._sitedoc
100
+
101
+ @property
102
+ def sitesrc(self):
103
+ """Returns the path of the default directory where ``.ini`` files are stored."""
104
+ if not self._sitesrc:
105
+ self._sitesrc = (
106
+ "/".join((self.siteroot, "site")),
107
+ "/".join((self.siteroot, "src")),
108
+ )
109
+ return self._sitesrc
110
+
111
+ def setenv(self, app=None, conf=None):
112
+ """Change ``vapp`` or/and ``vconf`` in one call."""
113
+ if app is not None:
114
+ self.vapp = app
115
+ if conf is not None:
116
+ self.vconf = conf
117
+ return (self.vapp, self.vconf)
118
+
119
+ def setmail(self, domain=None):
120
+ """Refresh actual email with current username and provided ``domain``."""
121
+ if domain is None:
122
+ from vortex import sessions
123
+
124
+ domain = sessions.system().getfqdn()
125
+ return "@".join((self.user, domain))
126
+
127
+ @property
128
+ def xmail(self):
129
+ if self.email is None:
130
+ return self.setmail()
131
+ else:
132
+ return self.email
133
+
134
+ def safedirs(self):
135
+ """Protected paths as a list a tuples (path, depth)."""
136
+ e = Environment(active=False)
137
+ return [(e.HOME, 2), (e.TMPDIR, 1)]
138
+
139
+ def setftuser(self, user, hostname=None):
140
+ """Register a default username for *hostname*.
141
+
142
+ If *hostname* is omitted the default username is set.
143
+ """
144
+ if hostname is None:
145
+ self._ftduser = user
146
+ else:
147
+ if not user:
148
+ del self._ftusers[hostname]
149
+ else:
150
+ self._ftusers[hostname] = user
151
+
152
+ def getftuser(self, hostname, defaults_to_user=True):
153
+ """Get the default username for a given *hostname*."""
154
+ if self._ftusers.get(hostname, None):
155
+ return self._ftusers[hostname]
156
+ else:
157
+ if self._ftduser:
158
+ return self._ftduser
159
+ else:
160
+ return Environment.current().get(
161
+ "VORTEX_ARCHIVE_USER",
162
+ self.user if defaults_to_user else None,
163
+ )
164
+
165
+ def _get_default_fthost(self):
166
+ if self._ftdhost:
167
+ return self._ftdhost
168
+ else:
169
+ return Environment.current().get("VORTEX_ARCHIVE_HOST", None)
170
+
171
+ def _set_default_fthost(self, value):
172
+ self._ftdhost = value
173
+
174
+ def _del_default_fthost(self):
175
+ self._ftdhost = None
176
+
177
+ default_fthost = property(
178
+ _get_default_fthost, _set_default_fthost, _del_default_fthost
179
+ )
180
+
181
+ def describeftsettings(self, indent="+ "):
182
+ """Returns a printable description of default file transfert usernames."""
183
+ card = "\n".join(
184
+ [
185
+ "{0}{3:48s} = {4:s}",
186
+ ]
187
+ + [
188
+ "{0}{1:48s} = {2:s}",
189
+ ]
190
+ + (
191
+ [
192
+ "{0}Host specific FT users:",
193
+ ]
194
+ if self._ftusers
195
+ else []
196
+ )
197
+ + [
198
+ "{0}" + " {:46s} = {:s}".format(k, v)
199
+ for k, v in self._ftusers.items()
200
+ if v
201
+ ]
202
+ ).format(
203
+ indent,
204
+ "Default FT User",
205
+ str(self._ftduser),
206
+ "Default FT Host",
207
+ str(self._ftdhost),
208
+ )
209
+ return card
210
+
211
+ def idcard(self, indent="+ "):
212
+ """Returns a printable description of the current glove."""
213
+ card = "\n".join(
214
+ (
215
+ "{0}User = {1:s}",
216
+ "{0}Profile = {2!s}",
217
+ "{0}Vapp = {3:s}",
218
+ "{0}Vconf = {4:s}",
219
+ "{0}Configrc = {5:s}",
220
+ )
221
+ ).format(
222
+ indent,
223
+ self.user,
224
+ self.profile,
225
+ self.vapp,
226
+ self.vconf,
227
+ self.configrc,
228
+ )
229
+ return card
230
+
231
+
232
+ class ResearchGlove(Glove):
233
+ """
234
+ The default glove as long as you do not need operational privileges.
235
+ Optional arguments are:
236
+
237
+ * mail
238
+ * profile (default is research)
239
+ """
240
+
241
+ _explicit = False
242
+ _footprint = dict(
243
+ info="Research glove",
244
+ attr=dict(
245
+ profile=dict(
246
+ optional=True,
247
+ values=["research", "tourist"],
248
+ default="research",
249
+ )
250
+ ),
251
+ )
252
+
253
+ @property
254
+ def realkind(self):
255
+ return "research"
256
+
257
+
258
+ class OperGlove(Glove):
259
+ """
260
+ The default glove if you need operational privileges.
261
+ Mandatory arguments are:
262
+
263
+ * user
264
+ * profile
265
+ """
266
+
267
+ _footprint = dict(
268
+ info="Operational glove",
269
+ attr=dict(
270
+ user=dict(values=["mxpt001"]),
271
+ profile=dict(
272
+ optional=False,
273
+ values=["oper", "dble", "test", "miroir"],
274
+ ),
275
+ ),
276
+ )
277
+
278
+ @property
279
+ def realkind(self):
280
+ return "opuser"
281
+
282
+
283
+ class UnitTestGlove(ResearchGlove):
284
+ """A very special glove for unit-tests."""
285
+
286
+ _footprint = dict(
287
+ info="Unit-Test Glove",
288
+ attr=dict(
289
+ profile=dict(
290
+ optional=False,
291
+ values=["utest"],
292
+ ),
293
+ test_configrc=dict(
294
+ optional=False,
295
+ ),
296
+ test_siteroot=dict(
297
+ optional=False,
298
+ ),
299
+ ),
300
+ )
301
+
302
+ def __init__(self, *args, **kw):
303
+ super().__init__(*args, **kw)
304
+ self._siteroot = self.test_siteroot
305
+
306
+ @property
307
+ def configrc(self):
308
+ """Returns the path of the default directory where ``.ini`` files are stored."""
309
+ return self.test_configrc
@@ -0,0 +1,20 @@
1
+ """
2
+ Package dealing with various aspects of the VORTEX session organisation/layout.
3
+
4
+ It provides modules to keep track of all the input/output data handled during
5
+ a VORTEX session:
6
+
7
+ * the :mod:`dataflow` module defines the :class:`~dataflow.Section` class
8
+ and all the necessary class to gather and manipulate :class:`~dataflow.Section`
9
+ objects ;
10
+ * the :mod:`contexts` module is dedicated to the :class:`~contexts.Context`
11
+ class that provide a logical separation within VORTEX sessions. It mantains
12
+ the list of sections and environment variables ;
13
+ * the :mod:`monitor` module defines utility classes to monitor the state of an
14
+ ensemble of :class:`~dataflow.Section` objects.
15
+ """
16
+
17
+ #: No automatic export
18
+ __all__ = []
19
+
20
+ __tocinfoline__ = "Package that helps organising a VORTEX session."