anemoi-utils 0.3.5__py3-none-any.whl → 0.3.6__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/config.py +42 -0
- {anemoi_utils-0.3.5.dist-info → anemoi_utils-0.3.6.dist-info}/METADATA +1 -1
- {anemoi_utils-0.3.5.dist-info → anemoi_utils-0.3.6.dist-info}/RECORD +8 -8
- {anemoi_utils-0.3.5.dist-info → anemoi_utils-0.3.6.dist-info}/WHEEL +1 -1
- {anemoi_utils-0.3.5.dist-info → anemoi_utils-0.3.6.dist-info}/LICENSE +0 -0
- {anemoi_utils-0.3.5.dist-info → anemoi_utils-0.3.6.dist-info}/entry_points.txt +0 -0
- {anemoi_utils-0.3.5.dist-info → anemoi_utils-0.3.6.dist-info}/top_level.txt +0 -0
anemoi/utils/_version.py
CHANGED
anemoi/utils/config.py
CHANGED
|
@@ -6,10 +6,13 @@
|
|
|
6
6
|
# nor does it submit to any jurisdiction.
|
|
7
7
|
|
|
8
8
|
|
|
9
|
+
import json
|
|
9
10
|
import logging
|
|
10
11
|
import os
|
|
11
12
|
import threading
|
|
12
13
|
|
|
14
|
+
import yaml
|
|
15
|
+
|
|
13
16
|
try:
|
|
14
17
|
import tomllib # Only available since 3.11
|
|
15
18
|
except ImportError:
|
|
@@ -41,10 +44,49 @@ class DotDict(dict):
|
|
|
41
44
|
|
|
42
45
|
def __init__(self, *args, **kwargs):
|
|
43
46
|
super().__init__(*args, **kwargs)
|
|
47
|
+
|
|
44
48
|
for k, v in self.items():
|
|
45
49
|
if isinstance(v, dict):
|
|
46
50
|
self[k] = DotDict(v)
|
|
47
51
|
|
|
52
|
+
if isinstance(v, list):
|
|
53
|
+
self[k] = [DotDict(i) if isinstance(i, dict) else i for i in v]
|
|
54
|
+
|
|
55
|
+
if isinstance(v, tuple):
|
|
56
|
+
self[k] = [DotDict(i) if isinstance(i, dict) else i for i in v]
|
|
57
|
+
|
|
58
|
+
@classmethod
|
|
59
|
+
def from_file(cls, path: str):
|
|
60
|
+
_, ext = os.path.splitext(path)
|
|
61
|
+
if ext == ".yaml" or ext == ".yml":
|
|
62
|
+
return cls.from_yaml_file(path)
|
|
63
|
+
elif ext == ".json":
|
|
64
|
+
return cls.from_json_file(path)
|
|
65
|
+
elif ext == ".toml":
|
|
66
|
+
return cls.from_toml_file(path)
|
|
67
|
+
else:
|
|
68
|
+
raise ValueError(f"Unknown file extension {ext}")
|
|
69
|
+
|
|
70
|
+
@classmethod
|
|
71
|
+
def from_yaml_file(cls, path: str):
|
|
72
|
+
with open(path, "r") as file:
|
|
73
|
+
data = yaml.safe_load(file)
|
|
74
|
+
|
|
75
|
+
return cls(data)
|
|
76
|
+
|
|
77
|
+
@classmethod
|
|
78
|
+
def from_json_file(cls, path: str):
|
|
79
|
+
with open(path, "r") as file:
|
|
80
|
+
data = json.load(file)
|
|
81
|
+
|
|
82
|
+
return cls(data)
|
|
83
|
+
|
|
84
|
+
@classmethod
|
|
85
|
+
def from_toml_file(cls, path: str):
|
|
86
|
+
with open(path, "r") as file:
|
|
87
|
+
data = tomllib.load(file)
|
|
88
|
+
return cls(data)
|
|
89
|
+
|
|
48
90
|
def __getattr__(self, attr):
|
|
49
91
|
try:
|
|
50
92
|
return self[attr]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: anemoi-utils
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.6
|
|
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,10 +1,10 @@
|
|
|
1
1
|
anemoi/utils/__init__.py,sha256=zZZpbKIoGWwdCOuo6YSruLR7C0GzvzI1Wzhyqaa0K7M,456
|
|
2
2
|
anemoi/utils/__main__.py,sha256=cLA2PidDTOUHaDGzd0_E5iioKYNe-PSTv567Y2fuwQk,723
|
|
3
|
-
anemoi/utils/_version.py,sha256=
|
|
3
|
+
anemoi/utils/_version.py,sha256=IKAQ4gPrCQ2FWMXOFRqouULC2EQI1zCb4iXHsnfbmTQ,411
|
|
4
4
|
anemoi/utils/caching.py,sha256=HrC9aFHlcCTaM2Z5u0ivGIXz7eFu35UQQhUuwwuG2pk,1743
|
|
5
5
|
anemoi/utils/checkpoints.py,sha256=1_3mg4B-ykTVfIvIUEv7IxGyREx_ZcilVbB3U-V6O6I,5165
|
|
6
6
|
anemoi/utils/cli.py,sha256=w6YVYfJV-50Zm9FrO0KNrrIWDdgj5hPjxJvgAh391NY,3308
|
|
7
|
-
anemoi/utils/config.py,sha256=
|
|
7
|
+
anemoi/utils/config.py,sha256=HBU8UbT0ZSFVSgpQGY42bXukrGIJBPbdqsqK1Btx97A,3475
|
|
8
8
|
anemoi/utils/dates.py,sha256=Ot9OTY1uFvHxW1EU4DPv3oUqmzvkXTwKuwhlfVlY788,8426
|
|
9
9
|
anemoi/utils/grib.py,sha256=gVfo4KYQv31iRyoqRDwk5tiqZDUgOIvhag_kO0qjYD0,3067
|
|
10
10
|
anemoi/utils/humanize.py,sha256=LD6dGnqChxA5j3tMhSybsAGRQzi33d_qS9pUoUHubkc,10330
|
|
@@ -16,9 +16,9 @@ anemoi/utils/commands/__init__.py,sha256=qAybFZPBBQs0dyx7dZ3X5JsLpE90pwrqt1vSV7c
|
|
|
16
16
|
anemoi/utils/commands/checkpoint.py,sha256=SEnAizU3WklqMXUjmIh4eNrgBVwmheKG9gEBS90zwYU,1741
|
|
17
17
|
anemoi/utils/mars/__init__.py,sha256=RAeY8gJ7ZvsPlcIvrQ4fy9xVHs3SphTAPw_XJDtNIKo,1750
|
|
18
18
|
anemoi/utils/mars/mars.yaml,sha256=R0dujp75lLA4wCWhPeOQnzJ45WZAYLT8gpx509cBFlc,66
|
|
19
|
-
anemoi_utils-0.3.
|
|
20
|
-
anemoi_utils-0.3.
|
|
21
|
-
anemoi_utils-0.3.
|
|
22
|
-
anemoi_utils-0.3.
|
|
23
|
-
anemoi_utils-0.3.
|
|
24
|
-
anemoi_utils-0.3.
|
|
19
|
+
anemoi_utils-0.3.6.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
20
|
+
anemoi_utils-0.3.6.dist-info/METADATA,sha256=DHKiN2X6h1APP0fFqHPHGN6TNWv7X65V85PPHX5ghac,15513
|
|
21
|
+
anemoi_utils-0.3.6.dist-info/WHEEL,sha256=mguMlWGMX-VHnMpKOjjQidIo1ssRlCFu4a4mBpz1s2M,91
|
|
22
|
+
anemoi_utils-0.3.6.dist-info/entry_points.txt,sha256=LENOkn88xzFQo-V59AKoA_F_cfYQTJYtrNTtf37YgHY,60
|
|
23
|
+
anemoi_utils-0.3.6.dist-info/top_level.txt,sha256=DYn8VPs-fNwr7fNH9XIBqeXIwiYYd2E2k5-dUFFqUz0,7
|
|
24
|
+
anemoi_utils-0.3.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|