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,314 @@
1
+ """
2
+ Resources to handle any boundary conditions data for a coupled model.
3
+ """
4
+
5
+ import re
6
+
7
+ from bronx.stdtypes import date
8
+ import footprints
9
+ from vortex.tools import env
10
+ from vortex.data.flow import GeoFlowResource, GeoPeriodFlowResource
11
+ from vortex.syntax.stddeco import (
12
+ namebuilding_append,
13
+ namebuilding_insert,
14
+ overwrite_realkind,
15
+ )
16
+ from vortex.syntax.stdattrs import term_deco, timeperiod_deco, a_cutoff
17
+ from vortex.data.geometries import LonlatGeometry
18
+
19
+ from ..tools.igastuff import archive_suffix
20
+
21
+ #: No automatic export
22
+ __all__ = []
23
+
24
+
25
+ @namebuilding_insert("radical", lambda s: "cpl")
26
+ @namebuilding_insert("src", lambda s: s._mysrc)
27
+ class _AbstractLAMBoundary(GeoFlowResource):
28
+ """
29
+ Class of a coupling file for a Limited Area Model.
30
+ A SpectralGeometry object is needed.
31
+ """
32
+
33
+ _abstract = True
34
+ _footprint = [
35
+ term_deco,
36
+ dict(
37
+ info="Coupling file for a limited area model",
38
+ attr=dict(
39
+ kind=dict(
40
+ values=["boundary", "elscf", "coupled"],
41
+ remap=dict(autoremap="first"),
42
+ ),
43
+ nativefmt=dict(
44
+ values=[
45
+ "fa",
46
+ "grib",
47
+ "netcdf",
48
+ "ascii",
49
+ "wbcpack",
50
+ "unknown",
51
+ ],
52
+ default="fa",
53
+ ),
54
+ ),
55
+ ),
56
+ ]
57
+
58
+ @property
59
+ def realkind(self):
60
+ return "boundary"
61
+
62
+ @property
63
+ def _mysrc(self):
64
+ raise NotImplementedError
65
+
66
+ def olive_basename(self):
67
+ """OLIVE specific naming convention."""
68
+ if self.mailbox.get("block", "-") == "surfan":
69
+ hhreal = self.term
70
+ else:
71
+ e = env.current()
72
+ if "HHDELTA_CPL" in e:
73
+ actualbase = self.date - date.Time(e.HHDELTA_CPL + "H")
74
+ else:
75
+ actualbase = date.synop(base=self.date)
76
+ hhreal = (self.date - actualbase).time() + self.term
77
+ return "ELSCFALAD_" + self.geometry.area + "+" + hhreal.fmthour
78
+
79
+ def archive_basename(self):
80
+ """OP ARCHIVE specific naming convention."""
81
+ suffix = archive_suffix(self.model, self.cutoff, self.date)
82
+ prefix = "COUPL"
83
+ source = (
84
+ self._mysrc[0] if isinstance(self._mysrc, list) else self._mysrc
85
+ )
86
+ if re.match("assist1bis|testms1", self.geometry.area):
87
+ prefix = "COUPL1"
88
+ if re.match("ifs|ecmwf", source) and "16km" in self.geometry.rnice:
89
+ prefix = "COUPLIFS"
90
+
91
+ if self.model == "mocage":
92
+ valid = (self.date + self.term).ymd
93
+ return "SM" + self.geometry.area + "+" + valid
94
+
95
+ return prefix + self.term.fmthour + ".r{!s}".format(suffix)
96
+
97
+ def iga_pathinfo(self):
98
+ """Standard path information for IGA inline cache."""
99
+ if self.model == "arome":
100
+ directory = "fic_day"
101
+ elif self.model == "mfwam":
102
+ directory = "guess"
103
+ else:
104
+ directory = "autres"
105
+ return dict(
106
+ fmt=directory,
107
+ model=self.model,
108
+ nativefmt=self.nativefmt,
109
+ )
110
+
111
+ def _geo2basename_info(self, add_stretching=True):
112
+ """Particular geometry dictionnary for _AbstractLamBoundary class and derivated ones."""
113
+ if isinstance(self.geometry, LonlatGeometry):
114
+ lgeo = [self.geometry.area, self.geometry.rnice]
115
+ else:
116
+ lgeo = super()._geo2basename_info(add_stretching)
117
+ return lgeo
118
+
119
+
120
+ class LAMBoundary(_AbstractLAMBoundary):
121
+ """
122
+ Class of a coupling file for a Limited Area Model.
123
+ A SpectralGeometry object is needed and the source model is given in the footprint.
124
+ """
125
+
126
+ _footprint = dict(
127
+ attr=dict(
128
+ source=dict(
129
+ values=[
130
+ "arpege",
131
+ "aladin",
132
+ "arome",
133
+ "ifs",
134
+ "ecmwf",
135
+ "psy4",
136
+ "mercator_global",
137
+ "glo12",
138
+ "mfwam",
139
+ ]
140
+ ),
141
+ )
142
+ )
143
+
144
+ @property
145
+ def _mysrc(self):
146
+ return self.source
147
+
148
+
149
+ _a_source_cutoff = a_cutoff
150
+ del _a_source_cutoff["alias"]
151
+ _a_source_cutoff["optional"] = True
152
+ _a_source_cutoff["default"] = "production"
153
+
154
+
155
+ class EnhancedLAMBoundary(_AbstractLAMBoundary):
156
+ """
157
+ Class of a coupling file for a Limited Area Model.
158
+ A SpectralGeometry object is needed and the source app, source conf and
159
+ source cutoff is given in the footprint.
160
+ """
161
+
162
+ _footprint = dict(
163
+ attr=dict(
164
+ source_app=dict(),
165
+ source_conf=dict(),
166
+ source_cutoff=_a_source_cutoff,
167
+ )
168
+ )
169
+
170
+ @property
171
+ def _mysrc(self):
172
+ return [
173
+ self.source_app,
174
+ self.source_conf,
175
+ {"cutoff": self.source_cutoff},
176
+ ]
177
+
178
+
179
+ _abs_forcing_fp = footprints.DecorativeFootprint(
180
+ info="Coupling file for any offline model.",
181
+ attr=dict(
182
+ kind=dict(
183
+ values=[
184
+ "forcing",
185
+ ],
186
+ ),
187
+ filling=dict(),
188
+ source_app=dict(),
189
+ source_conf=dict(),
190
+ source_cutoff=_a_source_cutoff,
191
+ ),
192
+ decorator=[
193
+ namebuilding_insert(
194
+ "src",
195
+ lambda s: [
196
+ s.source_app,
197
+ s.source_conf,
198
+ {"cutoff": s.source_cutoff},
199
+ ],
200
+ ),
201
+ overwrite_realkind("forcing"),
202
+ ],
203
+ )
204
+
205
+
206
+ class _AbstractForcing(GeoFlowResource):
207
+ """Abstract class for date-based coupling file for any offline model."""
208
+
209
+ _abstract = True
210
+ _footprint = [
211
+ _abs_forcing_fp,
212
+ ]
213
+
214
+
215
+ class _AbstractPeriodForcing(GeoPeriodFlowResource):
216
+ """Abstract class for period-based coupling file for any offline model."""
217
+
218
+ _abstract = True
219
+ _footprint = [
220
+ _abs_forcing_fp,
221
+ ]
222
+
223
+
224
+ _abs_external_forcing_fp = footprints.DecorativeFootprint(
225
+ dict(
226
+ attr=dict(
227
+ model=dict(
228
+ outcast=[
229
+ "surfex",
230
+ ],
231
+ ),
232
+ ),
233
+ ),
234
+ decorator=[namebuilding_append("src", lambda s: s.filling)],
235
+ )
236
+
237
+
238
+ class ExternalForcing(_AbstractForcing):
239
+ """Class for date-based coupling file for any offline model.
240
+
241
+ This class takes an optional **term** attribute.
242
+ """
243
+
244
+ _footprint = [term_deco, _abs_external_forcing_fp]
245
+
246
+
247
+ class ExternalTimePeriodForcing(_AbstractForcing):
248
+ """Class for date-based coupling file for any offline model.
249
+
250
+ This class needs a **begintime**/**endtime** attribute.
251
+ """
252
+
253
+ _footprint = [timeperiod_deco, _abs_external_forcing_fp]
254
+
255
+
256
+ _abs_surfex_forcing_fp = footprints.DecorativeFootprint(
257
+ dict(
258
+ info="Coupling/Forcing file for Surfex.",
259
+ attr=dict(
260
+ model=dict(
261
+ values=[
262
+ "surfex",
263
+ ],
264
+ ),
265
+ filling=dict(
266
+ optional=True,
267
+ default="atm",
268
+ ),
269
+ nativefmt=dict(
270
+ values=["netcdf", "ascii", "tar"],
271
+ default="netcdf",
272
+ ),
273
+ ),
274
+ ),
275
+ decorator=[
276
+ namebuilding_append(
277
+ "src",
278
+ lambda s: None if s.filling == "atm" else s.filling,
279
+ none_discard=True,
280
+ )
281
+ ],
282
+ )
283
+
284
+
285
+ class SurfexForcing(_AbstractForcing):
286
+ """Class for date-based coupling file for Surfex.
287
+
288
+ This class takes an optional **term** attribute.
289
+ """
290
+
291
+ _footprint = [
292
+ term_deco,
293
+ _abs_surfex_forcing_fp,
294
+ ]
295
+
296
+
297
+ class SurfexTimePeriodForcing(_AbstractForcing):
298
+ """Class for date-based coupling file for Surfex.
299
+
300
+ This class needs a **begintime**/**endtime** attribute.
301
+ """
302
+
303
+ _footprint = [
304
+ timeperiod_deco,
305
+ _abs_surfex_forcing_fp,
306
+ ]
307
+
308
+
309
+ class SurfexPeriodForcing(_AbstractPeriodForcing):
310
+ """Class for period-based coupling file for Surfex."""
311
+
312
+ _footprint = [
313
+ _abs_surfex_forcing_fp,
314
+ ]