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
@@ -0,0 +1,273 @@
1
+ """
2
+ TODO: Module documentation.
3
+ """
4
+
5
+ import re
6
+
7
+ #: No automatic export
8
+ __all__ = []
9
+
10
+ #: Specific tricks for base naming in iga fuzzy namespace.
11
+ fuzzystr = dict(
12
+ histfix=dict(
13
+ historic=dict(
14
+ pearp="prev",
15
+ arome="AROM",
16
+ arpege="arpe",
17
+ arp_court="arpe",
18
+ aearp="arpe",
19
+ aladin="ALAD",
20
+ surfex="SURF",
21
+ )
22
+ ),
23
+ prefix=dict(
24
+ # LFM 2016/12/30: It was dble='PA' but apparently it's wrong. No idea why...
25
+ gridpoint=dict(oper="PE", dble="PE", mirr="PE", hycom_grb="vent"),
26
+ historic=dict(
27
+ hycom="s_init0_", mfwam="BLS_", mfwam_BLS="BLS_", mfwam_LAW="LAW_"
28
+ ),
29
+ analysis=dict(hycom="s_init0_", mfwam="LAW_"),
30
+ ),
31
+ suffix=dict(
32
+ bgstderr=dict(input="in", output="out"),
33
+ analysis=dict(
34
+ hycom_hycom=".gz", hycom_surcotes=".gz", hycom_surcotes_oi=".gz"
35
+ ),
36
+ historic=dict(
37
+ surfex_arpege=".sfx",
38
+ surfex_aearp=".sfx",
39
+ hycom_hycom=".gz",
40
+ hycom_surcotes=".gz",
41
+ hycom_surcotes_oi=".gz",
42
+ ),
43
+ gridpoint=dict(hycom_grb="grb"),
44
+ ),
45
+ term0003=dict(
46
+ bgstderr=dict(input="", output="_assim"),
47
+ ),
48
+ term0009=dict(
49
+ bgstderr=dict(input="", output="_production"),
50
+ ),
51
+ term0012=dict(
52
+ bgstderr=dict(input="_production_dsbscr", output="_production_dsbscr"),
53
+ ),
54
+ varbcarpege=dict(
55
+ varbc=dict(input=".cycle_arp", output=".cycle"),
56
+ ),
57
+ varbcaladin=dict(
58
+ varbc=dict(input=".cycle_alad", output=".cycle"),
59
+ ),
60
+ varbcarome=dict(
61
+ varbc=dict(input=".cycle_aro", output=".cycle"),
62
+ ),
63
+ surf0000=dict(
64
+ histsurf=dict(input="INIT_SURF", output="INIT_SURF"),
65
+ historic=dict(input="INIT_SURF", output="INIT_SURF"),
66
+ ),
67
+ surf0003=dict(
68
+ histsurf=dict(input="PREP", output="AROMOUT_.0003"),
69
+ historic=dict(input="PREP", output="AROMOUT_.0003"),
70
+ ),
71
+ surf0006=dict(
72
+ histsurf=dict(input="PREP", output="AROMOUT_.0006"),
73
+ historic=dict(input="PREP", output="AROMOUT_.0006"),
74
+ ),
75
+ )
76
+
77
+ arpcourt_vconf = ("courtfr", "frcourt", "court")
78
+
79
+
80
+ def fuzzyname(entry, realkind, key, default=None):
81
+ """Returns any non-standard naming convention in the operational namespace."""
82
+ try:
83
+ return fuzzystr[entry][realkind][key]
84
+ except KeyError:
85
+ if default is not None:
86
+ return default
87
+ raise
88
+
89
+
90
+ def archive_suffix(model, cutoff, date, vconf=None):
91
+ """Returns the suffix for iga filenames according to specified ``model``, ``cutoff`` and ``date`` hour."""
92
+
93
+ hh = range(0, 21, 3)
94
+ hrange = []
95
+ for h in hh:
96
+ hrange.append("%02d" % h)
97
+
98
+ if cutoff == "assim":
99
+ rr = dict(zip(zip((cutoff,) * len(hrange), hh), hrange))
100
+ else:
101
+ if re.search(r"court|arome", model) or vconf in arpcourt_vconf:
102
+ rr = dict(
103
+ zip(
104
+ zip((cutoff,) * len(hrange), hh),
105
+ ("CM", "TR", "SX", "NF", "PM", "QZ", "DH", "VU"),
106
+ )
107
+ )
108
+ else:
109
+ rr = dict(
110
+ zip(
111
+ zip((cutoff,) * len(hrange), hh),
112
+ ("AM", "TR", "SX", "NF", "PM", "QZ", "DH", "VU"),
113
+ )
114
+ )
115
+
116
+ return str(rr[(cutoff, date.hour)])
117
+
118
+
119
+ class _BaseIgakeyFactory(str):
120
+ """
121
+ Given the vapp/vconf, returns a default value for the igakey attribute.
122
+
123
+ Needs to be subclassed !
124
+ """
125
+
126
+ _re_appconf = re.compile(r"^(\w+)/([\w@]+)$")
127
+ _keymap = {}
128
+
129
+ def __new__(cls, value):
130
+ """
131
+ If the input string is something like "vapp/vconf", use a mapping
132
+ between vapp/vconf pairs and the igakey (see _keymap).
133
+ If no mapping is found, it returns vapp.
134
+ """
135
+ val_split = cls._re_appconf.match(value)
136
+ if val_split:
137
+ value = cls._keymap.get(val_split.group(1), {}).get(
138
+ val_split.group(2), val_split.group(1)
139
+ )
140
+ return str.__new__(cls, value)
141
+
142
+
143
+ class IgakeyFactoryArchive(_BaseIgakeyFactory):
144
+ """
145
+ Given the vapp/vconf, returns a default value for the igakey attribute
146
+ """
147
+
148
+ _keymap = {
149
+ "arpege": {
150
+ "4dvarfr": "arpege",
151
+ "4dvar": "arpege",
152
+ "pearp": "pearp",
153
+ "aearp": "aearp",
154
+ "courtfr": "arpege",
155
+ "frcourt": "arpege",
156
+ "court": "arpege",
157
+ },
158
+ "mocage": {
159
+ "camsfcst": "macc",
160
+ "camsassim": "macc",
161
+ },
162
+ "arome": {
163
+ "3dvarfr": "arome",
164
+ "france": "arome",
165
+ "pegase": "pegase",
166
+ },
167
+ "aladin": {
168
+ "antiguy": "antiguy",
169
+ "caledonie": "caledonie",
170
+ "nc": "caledonie",
171
+ "polynesie": "polynesie",
172
+ "reunion": "reunion",
173
+ },
174
+ "hycom": {
175
+ "atl@anarp": "surcotes",
176
+ "med@anarp": "surcotes",
177
+ "atl@fcarp": "surcotes",
178
+ "med@fcarp": "surcotes",
179
+ "atl@anaro": "surcotes",
180
+ "med@anaro": "surcotes",
181
+ "atl@fcaro": "surcotes",
182
+ "med@fcaro": "surcotes",
183
+ "atl@fcaoc": "surcotes",
184
+ "med@fcaoc": "surcotes",
185
+ "oin@ancep": "surcotes_oi",
186
+ "oin@fcaro": "surcotes_oi",
187
+ },
188
+ "mfwam": {
189
+ "globalcep02": "mfwamglocep02",
190
+ "globalcep01": "mfwamglocep01",
191
+ "reuaro01": "mfwamreuaro",
192
+ "polyaro01": "mfwampolyaro",
193
+ "caledaro01": "mfwamcaledaro",
194
+ "globalarp02": "mfwamgloarp02",
195
+ "globalarpc02": "mfwamgloarpc02",
196
+ "atourxarp01": "mfwamatourx01arp",
197
+ "euratarpc01": "mfwameurcourt",
198
+ "frangparo0025": "mfwamfrangp0025",
199
+ "frangparoifs0025": "mfwamfrangp0025ifs",
200
+ "assmp1": "mfwamassmp1",
201
+ "assmp2": "mfwamassmp2",
202
+ "assms1": "mfwamassms1",
203
+ "assms2": "mfwamassms2",
204
+ "angola0025": "mfwamangola",
205
+ },
206
+ }
207
+
208
+
209
+ class IgakeyFactoryInline(_BaseIgakeyFactory):
210
+ """
211
+ Given the vapp/vconf, returns a default value for the igakey attribute
212
+ """
213
+
214
+ _keymap = {
215
+ "arpege": {
216
+ "4dvarfr": "france",
217
+ "4dvar": "france",
218
+ "pearp": "pearp",
219
+ "aearp": "aearp",
220
+ "courtfr": "frcourt",
221
+ "frcourt": "frcourt",
222
+ "court": "frcourt",
223
+ },
224
+ "arome": {
225
+ "3dvarfr": "france",
226
+ "france": "france",
227
+ "pegase": "pegase",
228
+ },
229
+ "aladin": {
230
+ "antiguy": "antiguy",
231
+ "caledonie": "caledonie",
232
+ "nc": "caledonie",
233
+ "polynesie": "polynesie",
234
+ "reunion": "reunion",
235
+ },
236
+ "hycom": {
237
+ "atl@anarp": "surcotes",
238
+ "med@anarp": "surcotes",
239
+ "atl@fcarp": "surcotes",
240
+ "med@fcarp": "surcotes",
241
+ "atl@ancep": "surcotes",
242
+ "med@ancep": "surcotes",
243
+ "atl@fccep": "surcotes",
244
+ "med@fccep": "surcotes",
245
+ "atl@anaro": "surcotes",
246
+ "med@anaro": "surcotes",
247
+ "atl@fcaro": "surcotes",
248
+ "med@fcaro": "surcotes",
249
+ "atl@red": "surcotes",
250
+ "med@red": "surcotes",
251
+ "oin@ancep": "surcotes_oi",
252
+ "oin@fcaro": "surcotes_oi",
253
+ "oin@red": "surcotes_oi",
254
+ },
255
+ "mfwam": {
256
+ "globalcep02": "mfwamglocep02",
257
+ "globalcep01": "mfwamglocep01",
258
+ "reuaro01": "mfwamreuaro",
259
+ "polyaro01": "mfwampolyaro",
260
+ "caledaro01": "mfwamcaledaro",
261
+ "globalarp02": "mfwamgloarp02",
262
+ "globalarpc02": "mfwamgloarpc02",
263
+ "atourxarp01": "mfwamatourx01arp",
264
+ "euratarpc01": "mfwameurcourt",
265
+ "frangparo0025": "mfwamfrangp0025",
266
+ "frangparoifs0025": "mfwamfrangp0025ifs",
267
+ "assmp1": "mfwamassmp1",
268
+ "assmp2": "mfwamassmp2",
269
+ "assms1": "mfwamassms1",
270
+ "assms2": "mfwamassms2",
271
+ "angola0025": "mfwamangola",
272
+ },
273
+ }
@@ -0,0 +1,68 @@
1
+ """
2
+ Utility classes and function to work with the Mars database.
3
+ """
4
+
5
+ from bronx.fancies import loggers
6
+
7
+ from vortex.util.config import GenericConfigParser
8
+
9
+ #: No automatic export
10
+ __all__ = []
11
+
12
+ logger = loggers.getLogger(__name__)
13
+
14
+
15
+ class MarsError(Exception):
16
+ """General Mars error."""
17
+
18
+ pass
19
+
20
+
21
+ class MarsConfigurationError(MarsError):
22
+ """Specific Mars configuration error."""
23
+
24
+ pass
25
+
26
+
27
+ class MarsGetError(MarsError):
28
+ """Generic Mars get error."""
29
+
30
+ pass
31
+
32
+
33
+ def findMarsExtractCommand(sh, inifile=None, command=None):
34
+ actual_command = command
35
+ if actual_command is None:
36
+ actual_inifile = inifile
37
+ if actual_inifile is None:
38
+ actual_command = sh.default_target.get("mars:command", None)
39
+ else:
40
+ actual_config = GenericConfigParser(inifile=actual_inifile)
41
+ if actual_config.has_section("mars") and actual_config.has_option(
42
+ "mars", "command"
43
+ ):
44
+ actual_command = actual_config.get("mars", "command")
45
+ if actual_command is None:
46
+ raise MarsConfigurationError("Could not find a proper command.")
47
+ return actual_command
48
+
49
+
50
+ def callMarsExtract(sh, query_file, command=None, fatal=True):
51
+ """
52
+ Build the command line used to execute the Mars query and launch it.
53
+
54
+ :param: sh: the system object used
55
+ :param query_file: The file containing the Mars query.
56
+ :param command: The command to be used to launch the Mars extraction.
57
+ :param fatal: Parameter indicating whether the fail of the request should be fatal or not
58
+ :return: The return code of the Mars extraction.
59
+ """
60
+ command_line = " ".join([command, query_file])
61
+ return sh.spawn(
62
+ [
63
+ command_line,
64
+ ],
65
+ shell=True,
66
+ output=False,
67
+ fatal=fatal,
68
+ )