anemoi-utils 0.1.6__py3-none-any.whl → 0.1.7__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 CHANGED
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '0.1.6'
16
- __version_tuple__ = version_tuple = (0, 1, 6)
15
+ __version__ = version = '0.1.7'
16
+ __version_tuple__ = version_tuple = (0, 1, 7)
@@ -6,8 +6,7 @@
6
6
  # granted to it by virtue of its status as an intergovernmental organisation
7
7
  # nor does it submit to any jurisdiction.
8
8
 
9
- """
10
- Read and write extra metadata in PyTorch checkpoints files. These files
9
+ """Read and write extra metadata in PyTorch checkpoints files. These files
11
10
  are zip archives containing the model weights.
12
11
  """
13
12
 
anemoi/utils/grib.py CHANGED
@@ -11,10 +11,13 @@ See https://codes.ecmwf.int/grib/param-db/ for more information.
11
11
 
12
12
  """
13
13
 
14
+ import logging
14
15
  import re
15
16
 
16
17
  import requests
17
18
 
19
+ LOG = logging.getLogger(__name__)
20
+
18
21
 
19
22
  def _search(name):
20
23
  name = re.escape(name)
@@ -26,7 +29,12 @@ def _search(name):
26
29
 
27
30
  if len(results) > 1:
28
31
  names = [f'{r.get("id")} ({r.get("name")})' for r in results]
29
- raise ValueError(f"{name} is ambiguous: {', '.join(names)}")
32
+ dissemination = [r for r in results if "dissemination" in r.get("access_ids", [])]
33
+ if len(dissemination) == 1:
34
+ return dissemination[0]
35
+
36
+ results = sorted(results, key=lambda x: x["id"])
37
+ LOG.warning(f"{name} is ambiguous: {', '.join(names)}. Using param_id={results[0]['id']}")
30
38
 
31
39
  return results[0]
32
40
 
@@ -44,7 +52,6 @@ def shortname_to_paramid(shortname: str) -> int:
44
52
  int
45
53
  Parameter id.
46
54
 
47
-
48
55
  >>> shortname_to_paramid("2t")
49
56
  167
50
57
 
@@ -65,7 +72,6 @@ def paramid_to_shortname(paramid: int) -> str:
65
72
  str
66
73
  Parameter shortname.
67
74
 
68
-
69
75
  >>> paramid_to_shortname(167)
70
76
  '2t'
71
77
 
@@ -5,8 +5,7 @@
5
5
  # granted to it by virtue of its status as an intergovernmental organisation
6
6
  # nor does it submit to any jurisdiction.
7
7
 
8
- """
9
- Collect information about the current environment, like:
8
+ """Collect information about the current environment, like:
10
9
 
11
10
  - The Python version
12
11
  - The versions of the modules which are currently loaded
@@ -215,7 +214,6 @@ def git_check(*args):
215
214
  dict
216
215
  An object with the git information for the given arguments.
217
216
 
218
-
219
217
  >>> {
220
218
  "anemoi.utils": {
221
219
  "sha1": "c999d83ae283bcbb99f68d92c42d24315922129f",
anemoi/utils/text.py CHANGED
@@ -5,9 +5,7 @@
5
5
  # granted to it by virtue of its status as an intergovernmental organisation
6
6
  # nor does it submit to any jurisdiction.
7
7
 
8
- """
9
- Text utilities
10
- """
8
+ """Text utilities"""
11
9
 
12
10
  import sys
13
11
  from collections import defaultdict
@@ -58,9 +56,6 @@ def boxed(text, min_width=80, max_width=80) -> str:
58
56
  str
59
57
  A boxed version of the input text
60
58
 
61
-
62
-
63
-
64
59
  """
65
60
 
66
61
  lines = text.split("\n")
@@ -266,7 +261,6 @@ def table(rows, header, align, margin=0):
266
261
  margin : int, optional
267
262
  Extra spaces on the left side of the table, by default 0
268
263
 
269
-
270
264
  Returns
271
265
  -------
272
266
  str
@@ -339,7 +333,6 @@ def progress(done, todo, width=80) -> str:
339
333
  str
340
334
  _description_
341
335
 
342
-
343
336
  """
344
337
  done = min(int(done / todo * width + 0.5), width)
345
338
  return green("█" * done) + red("█" * (width - done))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: anemoi-utils
3
- Version: 0.1.6
3
+ Version: 0.1.7
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
@@ -0,0 +1,14 @@
1
+ anemoi/utils/__init__.py,sha256=zZZpbKIoGWwdCOuo6YSruLR7C0GzvzI1Wzhyqaa0K7M,456
2
+ anemoi/utils/_version.py,sha256=0A08Kvw-SYs_CkLPEV1KmD8lb9IPH1psSxb5iQEGtI8,411
3
+ anemoi/utils/checkpoints.py,sha256=IR86FFNh5JR_uQVlgybnZG74PyU0CNLhyocqARwZIrs,2069
4
+ anemoi/utils/config.py,sha256=XEesqODvkuE3ZA7dnEnZ-ooBRtU6ecPmkfP65FtialA,2147
5
+ anemoi/utils/dates.py,sha256=ZabXLecHMio9ecIJbUxNcfOFoGfkcotSwy_xw1kNQ9w,6474
6
+ anemoi/utils/grib.py,sha256=OclNgX4j8tmNrWlYliKNmGAH9s3W8WctVSuD0AmKl3I,1991
7
+ anemoi/utils/humanize.py,sha256=LD6dGnqChxA5j3tMhSybsAGRQzi33d_qS9pUoUHubkc,10330
8
+ anemoi/utils/provenance.py,sha256=v54L9jF1JgYcclOhg3iojRl1v3ajbiWz_oc289xTgO4,9574
9
+ anemoi/utils/text.py,sha256=pGWtDvRFoDxAnSuZJiA-GOGJOJLHsw2dAm0tfVvPKno,8599
10
+ anemoi_utils-0.1.7.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
11
+ anemoi_utils-0.1.7.dist-info/METADATA,sha256=SOY4kfNg3FS9inC65CS6j6U2GrnI4xkl2Tr1x34Tq6c,15079
12
+ anemoi_utils-0.1.7.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
13
+ anemoi_utils-0.1.7.dist-info/top_level.txt,sha256=DYn8VPs-fNwr7fNH9XIBqeXIwiYYd2E2k5-dUFFqUz0,7
14
+ anemoi_utils-0.1.7.dist-info/RECORD,,
@@ -1,14 +0,0 @@
1
- anemoi/utils/__init__.py,sha256=zZZpbKIoGWwdCOuo6YSruLR7C0GzvzI1Wzhyqaa0K7M,456
2
- anemoi/utils/_version.py,sha256=L9DFp_i-1xztMRdin6ZHqLFMlDKUn5bsVgheqXFwTTc,411
3
- anemoi/utils/checkpoints.py,sha256=j1QMmffpo6Blo6kmAJDdUzK3dqq30UWIsWghFqsY4QU,2070
4
- anemoi/utils/config.py,sha256=XEesqODvkuE3ZA7dnEnZ-ooBRtU6ecPmkfP65FtialA,2147
5
- anemoi/utils/dates.py,sha256=ZabXLecHMio9ecIJbUxNcfOFoGfkcotSwy_xw1kNQ9w,6474
6
- anemoi/utils/grib.py,sha256=8fxp2O7tXrFvvp0h68IZ0OhDkyH7GQFTX_6qwJ-hzBs,1692
7
- anemoi/utils/humanize.py,sha256=LD6dGnqChxA5j3tMhSybsAGRQzi33d_qS9pUoUHubkc,10330
8
- anemoi/utils/provenance.py,sha256=RiDpevwTbCzTAkU0oL7pNwST37xt4W9GOkeNNDqbAgk,9576
9
- anemoi/utils/text.py,sha256=mBCPH9NwLyWCU9GkXzB0K4xiDN6UQ1XGlD4T5d8x8Vk,8606
10
- anemoi_utils-0.1.6.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
11
- anemoi_utils-0.1.6.dist-info/METADATA,sha256=gGK2zftLCNffyYnA0FhMXja0k5MOKzoixlL24O29dhk,15079
12
- anemoi_utils-0.1.6.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
13
- anemoi_utils-0.1.6.dist-info/top_level.txt,sha256=DYn8VPs-fNwr7fNH9XIBqeXIwiYYd2E2k5-dUFFqUz0,7
14
- anemoi_utils-0.1.6.dist-info/RECORD,,