anemoi-utils 0.4.14__py3-none-any.whl → 0.4.16__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.
Potentially problematic release.
This version of anemoi-utils might be problematic. Click here for more details.
- anemoi/utils/_version.py +2 -2
- anemoi/utils/devtools.py +4 -6
- anemoi/utils/humanize.py +4 -10
- anemoi/utils/registry.py +17 -2
- {anemoi_utils-0.4.14.dist-info → anemoi_utils-0.4.16.dist-info}/METADATA +1 -1
- {anemoi_utils-0.4.14.dist-info → anemoi_utils-0.4.16.dist-info}/RECORD +10 -10
- {anemoi_utils-0.4.14.dist-info → anemoi_utils-0.4.16.dist-info}/WHEEL +0 -0
- {anemoi_utils-0.4.14.dist-info → anemoi_utils-0.4.16.dist-info}/entry_points.txt +0 -0
- {anemoi_utils-0.4.14.dist-info → anemoi_utils-0.4.16.dist-info}/licenses/LICENSE +0 -0
- {anemoi_utils-0.4.14.dist-info → anemoi_utils-0.4.16.dist-info}/top_level.txt +0 -0
anemoi/utils/_version.py
CHANGED
anemoi/utils/devtools.py
CHANGED
|
@@ -81,13 +81,11 @@ def plot_values(
|
|
|
81
81
|
ax.add_feature(cfeature.BORDERS, linestyle=":")
|
|
82
82
|
|
|
83
83
|
missing_values = np.isnan(values)
|
|
84
|
-
|
|
85
84
|
if missing_value is None:
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
values = np.where(missing_values, missing_value, values)
|
|
85
|
+
min = np.nanmin(values)
|
|
86
|
+
missing_value = min - np.abs(min) * 0.001
|
|
87
|
+
|
|
88
|
+
values = np.where(missing_values, missing_value, values)
|
|
91
89
|
|
|
92
90
|
if max_value is not None:
|
|
93
91
|
values = np.where(values > max_value, max_value, values)
|
anemoi/utils/humanize.py
CHANGED
|
@@ -48,7 +48,7 @@ def bytes_to_human(n: float) -> str:
|
|
|
48
48
|
"""
|
|
49
49
|
if n < 0:
|
|
50
50
|
sign = "-"
|
|
51
|
-
n
|
|
51
|
+
n = -n
|
|
52
52
|
else:
|
|
53
53
|
sign = ""
|
|
54
54
|
|
|
@@ -411,15 +411,9 @@ def when(
|
|
|
411
411
|
if years > 1:
|
|
412
412
|
return _("%d years" % (years,))
|
|
413
413
|
|
|
414
|
-
|
|
415
|
-
if
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
d = abs(now.month - month)
|
|
419
|
-
if d >= 12:
|
|
420
|
-
return _("a year")
|
|
421
|
-
else:
|
|
422
|
-
return _("%d month%s" % (d, _plural(d)))
|
|
414
|
+
delta = abs(now - then)
|
|
415
|
+
if delta.days > 1 and delta.days < 30:
|
|
416
|
+
return _("%d days" % (delta.days,))
|
|
423
417
|
|
|
424
418
|
return "on %s %d %s %d" % (
|
|
425
419
|
DOW[then.weekday()],
|
anemoi/utils/registry.py
CHANGED
|
@@ -88,14 +88,17 @@ class Registry:
|
|
|
88
88
|
The package name.
|
|
89
89
|
key : str, optional
|
|
90
90
|
The key to use for the registry, by default "_type".
|
|
91
|
+
api_version : str, optional
|
|
92
|
+
The API version, by default '1.0.0'.
|
|
91
93
|
"""
|
|
92
94
|
|
|
93
|
-
def __init__(self, package: str, key: str = "_type"):
|
|
95
|
+
def __init__(self, package: str, key: str = "_type", api_version: str = "1.0.0"):
|
|
94
96
|
self.package = package
|
|
95
97
|
self.__registered = {}
|
|
96
98
|
self._sources = {}
|
|
97
99
|
self.kind = package.split(".")[-1]
|
|
98
100
|
self.key = key
|
|
101
|
+
self.api_version = api_version
|
|
99
102
|
_BY_KIND[self.kind] = self
|
|
100
103
|
|
|
101
104
|
@classmethod
|
|
@@ -133,6 +136,9 @@ class Registry:
|
|
|
133
136
|
Wrapper, optional
|
|
134
137
|
A wrapper if the factory is None, otherwise None.
|
|
135
138
|
"""
|
|
139
|
+
|
|
140
|
+
name = name.replace("_", "-")
|
|
141
|
+
|
|
136
142
|
if factory is None:
|
|
137
143
|
# This happens when the @register decorator is used
|
|
138
144
|
return Wrapper(name, self)
|
|
@@ -162,7 +168,7 @@ class Registry:
|
|
|
162
168
|
except Exception as e:
|
|
163
169
|
if DEBUG_ANEMOI_REGISTRY:
|
|
164
170
|
raise
|
|
165
|
-
self.
|
|
171
|
+
self.__registered[name] = Error(e)
|
|
166
172
|
|
|
167
173
|
def is_registered(self, name: str) -> bool:
|
|
168
174
|
"""Check if a factory is registered.
|
|
@@ -177,6 +183,9 @@ class Registry:
|
|
|
177
183
|
bool
|
|
178
184
|
Whether the factory is registered.
|
|
179
185
|
"""
|
|
186
|
+
|
|
187
|
+
name = name.replace("_", "-")
|
|
188
|
+
|
|
180
189
|
ok = name in self.factories
|
|
181
190
|
if not ok:
|
|
182
191
|
LOG.error(f"Cannot find '{name}' in {self.package}")
|
|
@@ -199,6 +208,9 @@ class Registry:
|
|
|
199
208
|
Callable, optional
|
|
200
209
|
The factory if found, otherwise None.
|
|
201
210
|
"""
|
|
211
|
+
|
|
212
|
+
name = name.replace("_", "-")
|
|
213
|
+
|
|
202
214
|
if return_none:
|
|
203
215
|
return self.factories.get(name)
|
|
204
216
|
|
|
@@ -288,6 +300,9 @@ class Registry:
|
|
|
288
300
|
Any
|
|
289
301
|
The created instance.
|
|
290
302
|
"""
|
|
303
|
+
|
|
304
|
+
name = name.replace("_", "-")
|
|
305
|
+
|
|
291
306
|
factory = self.lookup(name)
|
|
292
307
|
return factory(*args, **kwargs)
|
|
293
308
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: anemoi-utils
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.16
|
|
4
4
|
Summary: A package to hold various functions to support training of ML models on ECMWF data.
|
|
5
5
|
Author-email: "European Centre for Medium-Range Weather Forecasts (ECMWF)" <software.support@ecmwf.int>
|
|
6
6
|
License: Apache License
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
anemoi/utils/__init__.py,sha256=uVhpF-VjIl_4mMywOVtgTutgsdIsqz-xdkwxeMhzuag,730
|
|
2
2
|
anemoi/utils/__main__.py,sha256=6LlE4MYrPvqqrykxXh7XMi50UZteUY59NeM8P9Zs2dU,910
|
|
3
|
-
anemoi/utils/_version.py,sha256=
|
|
3
|
+
anemoi/utils/_version.py,sha256=aZNmGWWE7ndWaFJGD1G8axbqrCNEX3UMJLUyVC4HPEM,513
|
|
4
4
|
anemoi/utils/caching.py,sha256=rXbeAmpBcMbbfN4EVblaHWKicsrtx1otER84FEBtz98,6183
|
|
5
5
|
anemoi/utils/checkpoints.py,sha256=N4WpAZXa4etrpSEKhHqUUtG2-x9w3FJMHcLO-dDAXPY,9600
|
|
6
6
|
anemoi/utils/cli.py,sha256=IyZfnSw0u0yYnrjOrzvm2RuuKvDk4cVb8pf8BkaChgA,6209
|
|
7
7
|
anemoi/utils/compatibility.py,sha256=wRBRMmxQP88rNcWiP5gqXliwYQbBv1iCAsDjcCRi5UY,2234
|
|
8
8
|
anemoi/utils/config.py,sha256=4K4_ePeuUPyIMsE7-r77OC87ntFGdVLskB0ow9XNzXI,16353
|
|
9
9
|
anemoi/utils/dates.py,sha256=CnY6JOdpk0T-waPEowMRTkcMzxcN0GcjPVtLkwH_byw,17196
|
|
10
|
-
anemoi/utils/devtools.py,sha256=
|
|
10
|
+
anemoi/utils/devtools.py,sha256=W3OBu96MkXRIl7Qh1SE5Zd6aB1R0QlnmlrlpBYM0fVY,3527
|
|
11
11
|
anemoi/utils/grib.py,sha256=201WcxjjAl92Y2HX2kZ2S8Qr5dN-oG7nV-vQLaybzP4,3610
|
|
12
12
|
anemoi/utils/grids.py,sha256=edTrMK8hpE9ZBzSfwcRftgk0jljNAK3i8CraadILQoM,4427
|
|
13
13
|
anemoi/utils/hindcasts.py,sha256=iYVIxSNFL2HJcc_k1abCFLkpJFGHT8WKRIR4wcAwA3s,2144
|
|
14
|
-
anemoi/utils/humanize.py,sha256=
|
|
14
|
+
anemoi/utils/humanize.py,sha256=pjnFJAKHbEAOfcvn8c48kt-8eFy6FGW_U2ruJvfamrA,25189
|
|
15
15
|
anemoi/utils/logs.py,sha256=naTgrmPwWHD4eekFttXftS4gtcAGYHpCqG4iwYprNDA,1804
|
|
16
16
|
anemoi/utils/provenance.py,sha256=tIIgweS0EJyaYzgKwuv3iWny-Gz7N5e5CNWH5MeSYWU,14615
|
|
17
|
-
anemoi/utils/registry.py,sha256=
|
|
17
|
+
anemoi/utils/registry.py,sha256=7r14_znm8yr6kv38a7F33MJHM8riRp3tOB_fFF_QQc4,9592
|
|
18
18
|
anemoi/utils/s3.py,sha256=xMT48kbcelcjjqsaU567WI3oZ5eqo88Rlgyx5ECszAU,4074
|
|
19
19
|
anemoi/utils/sanitise.py,sha256=ZYGdSX6qihQANr3pHZjbKnoapnzP1KcrWdW1Ul1mOGk,3668
|
|
20
20
|
anemoi/utils/sanitize.py,sha256=43ZKDcfVpeXSsJ9TFEc9aZnD6oe2cUh151XnDspM98M,462
|
|
@@ -30,9 +30,9 @@ anemoi/utils/mars/requests.py,sha256=VFMHBVAAl0_2lOcMBa1lvaKHctN0lDJsI6_U4BucGew
|
|
|
30
30
|
anemoi/utils/remote/__init__.py,sha256=-uaYFi4yRYFRf46ubQbJo86GCn6HE5VQrcaoyrmyW28,20704
|
|
31
31
|
anemoi/utils/remote/s3.py,sha256=spQ8l0rwQjLZh9dZu5cOsYIvNwKihQfCJ6YsFYegeqI,17339
|
|
32
32
|
anemoi/utils/remote/ssh.py,sha256=xNtsawh8okytCKRehkRCVExbHZj-CRUQNormEHglfuw,8088
|
|
33
|
-
anemoi_utils-0.4.
|
|
34
|
-
anemoi_utils-0.4.
|
|
35
|
-
anemoi_utils-0.4.
|
|
36
|
-
anemoi_utils-0.4.
|
|
37
|
-
anemoi_utils-0.4.
|
|
38
|
-
anemoi_utils-0.4.
|
|
33
|
+
anemoi_utils-0.4.16.dist-info/licenses/LICENSE,sha256=8HznKF1Vi2IvfLsKNE5A2iVyiri3pRjRPvPC9kxs6qk,11354
|
|
34
|
+
anemoi_utils-0.4.16.dist-info/METADATA,sha256=36Oea7pKpe5I3NxOuPP1ILtAm5pGZ2xtvMqsRz-UyvM,15360
|
|
35
|
+
anemoi_utils-0.4.16.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
|
|
36
|
+
anemoi_utils-0.4.16.dist-info/entry_points.txt,sha256=LENOkn88xzFQo-V59AKoA_F_cfYQTJYtrNTtf37YgHY,60
|
|
37
|
+
anemoi_utils-0.4.16.dist-info/top_level.txt,sha256=DYn8VPs-fNwr7fNH9XIBqeXIwiYYd2E2k5-dUFFqUz0,7
|
|
38
|
+
anemoi_utils-0.4.16.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|