anemoi-utils 0.2.0__tar.gz → 0.3.0__tar.gz
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-0.2.0 → anemoi_utils-0.3.0}/.pre-commit-config.yaml +14 -3
- {anemoi_utils-0.2.0 → anemoi_utils-0.3.0}/PKG-INFO +32 -29
- {anemoi_utils-0.2.0 → anemoi_utils-0.3.0}/docs/conf.py +2 -0
- anemoi_utils-0.3.0/pyproject.toml +108 -0
- anemoi_utils-0.3.0/src/anemoi/utils/__main__.py +28 -0
- {anemoi_utils-0.2.0 → anemoi_utils-0.3.0}/src/anemoi/utils/_version.py +2 -2
- anemoi_utils-0.2.0/src/anemoi/utils/commands/__init__.py → anemoi_utils-0.3.0/src/anemoi/utils/cli.py +71 -23
- anemoi_utils-0.3.0/src/anemoi/utils/commands/__init__.py +24 -0
- {anemoi_utils-0.2.0 → anemoi_utils-0.3.0}/src/anemoi/utils/timer.py +2 -0
- {anemoi_utils-0.2.0 → anemoi_utils-0.3.0}/src/anemoi_utils.egg-info/PKG-INFO +32 -29
- {anemoi_utils-0.2.0 → anemoi_utils-0.3.0}/src/anemoi_utils.egg-info/SOURCES.txt +1 -0
- {anemoi_utils-0.2.0 → anemoi_utils-0.3.0}/src/anemoi_utils.egg-info/requires.txt +16 -14
- anemoi_utils-0.2.0/pyproject.toml +0 -98
- anemoi_utils-0.2.0/src/anemoi/utils/__main__.py +0 -72
- {anemoi_utils-0.2.0 → anemoi_utils-0.3.0}/.github/workflows/python-publish.yml +0 -0
- {anemoi_utils-0.2.0 → anemoi_utils-0.3.0}/.gitignore +0 -0
- {anemoi_utils-0.2.0 → anemoi_utils-0.3.0}/.readthedocs.yaml +0 -0
- {anemoi_utils-0.2.0 → anemoi_utils-0.3.0}/LICENSE +0 -0
- {anemoi_utils-0.2.0 → anemoi_utils-0.3.0}/README.md +0 -0
- {anemoi_utils-0.2.0 → anemoi_utils-0.3.0}/docs/Makefile +0 -0
- {anemoi_utils-0.2.0 → anemoi_utils-0.3.0}/docs/_static/logo.png +0 -0
- {anemoi_utils-0.2.0 → anemoi_utils-0.3.0}/docs/_static/style.css +0 -0
- {anemoi_utils-0.2.0 → anemoi_utils-0.3.0}/docs/_templates/.gitkeep +0 -0
- {anemoi_utils-0.2.0 → anemoi_utils-0.3.0}/docs/index.rst +0 -0
- {anemoi_utils-0.2.0 → anemoi_utils-0.3.0}/docs/installing.rst +0 -0
- {anemoi_utils-0.2.0 → anemoi_utils-0.3.0}/docs/modules/checkpoints.rst +0 -0
- {anemoi_utils-0.2.0 → anemoi_utils-0.3.0}/docs/modules/config.rst +0 -0
- {anemoi_utils-0.2.0 → anemoi_utils-0.3.0}/docs/modules/dates.rst +0 -0
- {anemoi_utils-0.2.0 → anemoi_utils-0.3.0}/docs/modules/grib.rst +0 -0
- {anemoi_utils-0.2.0 → anemoi_utils-0.3.0}/docs/modules/humanize.rst +0 -0
- {anemoi_utils-0.2.0 → anemoi_utils-0.3.0}/docs/modules/provenance.rst +0 -0
- {anemoi_utils-0.2.0 → anemoi_utils-0.3.0}/docs/modules/text.rst +0 -0
- {anemoi_utils-0.2.0 → anemoi_utils-0.3.0}/docs/requirements.txt +0 -0
- {anemoi_utils-0.2.0 → anemoi_utils-0.3.0}/setup.cfg +0 -0
- {anemoi_utils-0.2.0 → anemoi_utils-0.3.0}/src/anemoi/utils/__init__.py +0 -0
- {anemoi_utils-0.2.0 → anemoi_utils-0.3.0}/src/anemoi/utils/caching.py +0 -0
- {anemoi_utils-0.2.0 → anemoi_utils-0.3.0}/src/anemoi/utils/checkpoints.py +0 -0
- {anemoi_utils-0.2.0 → anemoi_utils-0.3.0}/src/anemoi/utils/commands/checkpoint.py +0 -0
- {anemoi_utils-0.2.0 → anemoi_utils-0.3.0}/src/anemoi/utils/config.py +0 -0
- {anemoi_utils-0.2.0 → anemoi_utils-0.3.0}/src/anemoi/utils/dates.py +0 -0
- {anemoi_utils-0.2.0 → anemoi_utils-0.3.0}/src/anemoi/utils/grib.py +0 -0
- {anemoi_utils-0.2.0 → anemoi_utils-0.3.0}/src/anemoi/utils/humanize.py +0 -0
- {anemoi_utils-0.2.0 → anemoi_utils-0.3.0}/src/anemoi/utils/mars/__init__.py +0 -0
- {anemoi_utils-0.2.0 → anemoi_utils-0.3.0}/src/anemoi/utils/mars/mars.yaml +0 -0
- {anemoi_utils-0.2.0 → anemoi_utils-0.3.0}/src/anemoi/utils/provenance.py +0 -0
- {anemoi_utils-0.2.0 → anemoi_utils-0.3.0}/src/anemoi/utils/text.py +0 -0
- {anemoi_utils-0.2.0 → anemoi_utils-0.3.0}/src/anemoi_utils.egg-info/dependency_links.txt +0 -0
- {anemoi_utils-0.2.0 → anemoi_utils-0.3.0}/src/anemoi_utils.egg-info/entry_points.txt +0 -0
- {anemoi_utils-0.2.0 → anemoi_utils-0.3.0}/src/anemoi_utils.egg-info/top_level.txt +0 -0
- {anemoi_utils-0.2.0 → anemoi_utils-0.3.0}/tests/requirements.txt +0 -0
- {anemoi_utils-0.2.0 → anemoi_utils-0.3.0}/tests/test_dates.py +0 -0
- {anemoi_utils-0.2.0 → anemoi_utils-0.3.0}/tests/test_utils.py +0 -0
|
@@ -13,7 +13,7 @@ repos:
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
16
|
-
rev: v4.
|
|
16
|
+
rev: v4.6.0
|
|
17
17
|
hooks:
|
|
18
18
|
- id: check-yaml # Check YAML files for syntax errors only
|
|
19
19
|
args: [--unsafe, --allow-multiple-documents]
|
|
@@ -25,7 +25,7 @@ repos:
|
|
|
25
25
|
- id: check-merge-conflict # Check for files that contain merge conflict
|
|
26
26
|
|
|
27
27
|
- repo: https://github.com/psf/black-pre-commit-mirror
|
|
28
|
-
rev: 24.
|
|
28
|
+
rev: 24.4.2
|
|
29
29
|
hooks:
|
|
30
30
|
- id: black
|
|
31
31
|
args: [--line-length=120]
|
|
@@ -41,7 +41,7 @@ repos:
|
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
44
|
-
rev: v0.
|
|
44
|
+
rev: v0.4.6
|
|
45
45
|
hooks:
|
|
46
46
|
- id: ruff
|
|
47
47
|
exclude: '(dev/.*|.*_)\.py$'
|
|
@@ -68,3 +68,14 @@ repos:
|
|
|
68
68
|
hooks:
|
|
69
69
|
- id: docconvert
|
|
70
70
|
args: ["numpy"]
|
|
71
|
+
|
|
72
|
+
- repo: https://github.com/b8raoult/optional-dependencies-all
|
|
73
|
+
rev: "0.0.2"
|
|
74
|
+
hooks:
|
|
75
|
+
- id: optional-dependencies-all
|
|
76
|
+
args: ["--inplace", "--all-key", "all", "--exclude-keys", "dev,docs"]
|
|
77
|
+
|
|
78
|
+
- repo: https://github.com/tox-dev/pyproject-fmt
|
|
79
|
+
rev: "2.1.3"
|
|
80
|
+
hooks:
|
|
81
|
+
- id: pyproject-fmt
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: anemoi-utils
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
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
|
|
@@ -205,51 +205,54 @@ License: Apache License
|
|
|
205
205
|
See the License for the specific language governing permissions and
|
|
206
206
|
limitations under the License.
|
|
207
207
|
|
|
208
|
-
Project-URL: Homepage, https://github.com/ecmwf/anemoi-utils/
|
|
209
208
|
Project-URL: Documentation, https://anemoi-utils.readthedocs.io/
|
|
210
|
-
Project-URL:
|
|
209
|
+
Project-URL: Homepage, https://github.com/ecmwf/anemoi-utils/
|
|
211
210
|
Project-URL: Issues, https://github.com/ecmwf/anemoi-utils/issues
|
|
212
|
-
|
|
211
|
+
Project-URL: Repository, https://github.com/ecmwf/anemoi-utils/
|
|
212
|
+
Keywords: ai,tools
|
|
213
213
|
Classifier: Development Status :: 4 - Beta
|
|
214
214
|
Classifier: Intended Audience :: Developers
|
|
215
215
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
216
|
-
Classifier:
|
|
216
|
+
Classifier: Operating System :: OS Independent
|
|
217
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
217
218
|
Classifier: Programming Language :: Python :: 3.9
|
|
218
219
|
Classifier: Programming Language :: Python :: 3.10
|
|
219
220
|
Classifier: Programming Language :: Python :: 3.11
|
|
221
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
220
222
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
221
223
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
222
|
-
Classifier: Operating System :: OS Independent
|
|
223
224
|
Requires-Python: >=3.9
|
|
224
225
|
License-File: LICENSE
|
|
225
|
-
Requires-Dist: tomli
|
|
226
226
|
Requires-Dist: pyyaml
|
|
227
|
+
Requires-Dist: tomli
|
|
227
228
|
Requires-Dist: tqdm
|
|
228
|
-
Provides-Extra: provenance
|
|
229
|
-
Requires-Dist: GitPython; extra == "provenance"
|
|
230
|
-
Requires-Dist: nvsmi; extra == "provenance"
|
|
231
|
-
Provides-Extra: text
|
|
232
|
-
Requires-Dist: termcolor; extra == "text"
|
|
233
|
-
Provides-Extra: grib
|
|
234
|
-
Requires-Dist: requests; extra == "grib"
|
|
235
|
-
Provides-Extra: docs
|
|
236
|
-
Requires-Dist: tomli; extra == "docs"
|
|
237
|
-
Requires-Dist: termcolor; extra == "docs"
|
|
238
|
-
Requires-Dist: requests; extra == "docs"
|
|
239
|
-
Requires-Dist: sphinx; extra == "docs"
|
|
240
|
-
Requires-Dist: sphinx_rtd_theme; extra == "docs"
|
|
241
|
-
Requires-Dist: nbsphinx; extra == "docs"
|
|
242
|
-
Requires-Dist: pandoc; extra == "docs"
|
|
243
|
-
Requires-Dist: sphinx_argparse; extra == "docs"
|
|
244
229
|
Provides-Extra: all
|
|
245
|
-
Requires-Dist:
|
|
246
|
-
Requires-Dist: GitPython; extra == "all"
|
|
230
|
+
Requires-Dist: gitpython; extra == "all"
|
|
247
231
|
Requires-Dist: nvsmi; extra == "all"
|
|
248
|
-
Requires-Dist:
|
|
232
|
+
Requires-Dist: pyyaml; extra == "all"
|
|
249
233
|
Requires-Dist: requests; extra == "all"
|
|
234
|
+
Requires-Dist: termcolor; extra == "all"
|
|
235
|
+
Requires-Dist: tomli; extra == "all"
|
|
236
|
+
Requires-Dist: tqdm; extra == "all"
|
|
250
237
|
Provides-Extra: dev
|
|
251
|
-
Requires-Dist:
|
|
252
|
-
Requires-Dist: GitPython; extra == "dev"
|
|
238
|
+
Requires-Dist: gitpython; extra == "dev"
|
|
253
239
|
Requires-Dist: nvsmi; extra == "dev"
|
|
254
|
-
Requires-Dist: termcolor; extra == "dev"
|
|
255
240
|
Requires-Dist: requests; extra == "dev"
|
|
241
|
+
Requires-Dist: termcolor; extra == "dev"
|
|
242
|
+
Requires-Dist: tomli; extra == "dev"
|
|
243
|
+
Provides-Extra: docs
|
|
244
|
+
Requires-Dist: nbsphinx; extra == "docs"
|
|
245
|
+
Requires-Dist: pandoc; extra == "docs"
|
|
246
|
+
Requires-Dist: requests; extra == "docs"
|
|
247
|
+
Requires-Dist: sphinx; extra == "docs"
|
|
248
|
+
Requires-Dist: sphinx-argparse; extra == "docs"
|
|
249
|
+
Requires-Dist: sphinx-rtd-theme; extra == "docs"
|
|
250
|
+
Requires-Dist: termcolor; extra == "docs"
|
|
251
|
+
Requires-Dist: tomli; extra == "docs"
|
|
252
|
+
Provides-Extra: grib
|
|
253
|
+
Requires-Dist: requests; extra == "grib"
|
|
254
|
+
Provides-Extra: provenance
|
|
255
|
+
Requires-Dist: gitpython; extra == "provenance"
|
|
256
|
+
Requires-Dist: nvsmi; extra == "provenance"
|
|
257
|
+
Provides-Extra: text
|
|
258
|
+
Requires-Dist: termcolor; extra == "text"
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# (C) Copyright 2024 ECMWF.
|
|
3
|
+
#
|
|
4
|
+
# This software is licensed under the terms of the Apache Licence Version 2.0
|
|
5
|
+
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
# In applying this licence, ECMWF does not waive the privileges and immunities
|
|
7
|
+
# granted to it by virtue of its status as an intergovernmental organisation
|
|
8
|
+
# nor does it submit to any jurisdiction.
|
|
9
|
+
|
|
10
|
+
# https://packaging.python.org/en/latest/guides/writing-pyproject-toml/
|
|
11
|
+
|
|
12
|
+
[build-system]
|
|
13
|
+
requires = [
|
|
14
|
+
"setuptools>=60",
|
|
15
|
+
"setuptools-scm>=8",
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
[project]
|
|
19
|
+
name = "anemoi-utils"
|
|
20
|
+
|
|
21
|
+
description = "A package to hold various functions to support training of ML models on ECMWF data."
|
|
22
|
+
keywords = [
|
|
23
|
+
"ai",
|
|
24
|
+
"tools",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
license = { file = "LICENSE" }
|
|
28
|
+
authors = [
|
|
29
|
+
{ name = "European Centre for Medium-Range Weather Forecasts (ECMWF)", email = "software.support@ecmwf.int" },
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
requires-python = ">=3.9"
|
|
33
|
+
|
|
34
|
+
classifiers = [
|
|
35
|
+
"Development Status :: 4 - Beta",
|
|
36
|
+
"Intended Audience :: Developers",
|
|
37
|
+
"License :: OSI Approved :: Apache Software License",
|
|
38
|
+
"Operating System :: OS Independent",
|
|
39
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
40
|
+
"Programming Language :: Python :: 3.9",
|
|
41
|
+
"Programming Language :: Python :: 3.10",
|
|
42
|
+
"Programming Language :: Python :: 3.11",
|
|
43
|
+
"Programming Language :: Python :: 3.12",
|
|
44
|
+
"Programming Language :: Python :: Implementation :: CPython",
|
|
45
|
+
"Programming Language :: Python :: Implementation :: PyPy",
|
|
46
|
+
]
|
|
47
|
+
|
|
48
|
+
dynamic = [
|
|
49
|
+
"version",
|
|
50
|
+
]
|
|
51
|
+
dependencies = [
|
|
52
|
+
"pyyaml",
|
|
53
|
+
"tomli", # Only needed before 3.11
|
|
54
|
+
"tqdm",
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
optional-dependencies.all = [
|
|
58
|
+
"gitpython",
|
|
59
|
+
"nvsmi",
|
|
60
|
+
"pyyaml",
|
|
61
|
+
"requests",
|
|
62
|
+
"termcolor",
|
|
63
|
+
"tomli",
|
|
64
|
+
"tqdm",
|
|
65
|
+
]
|
|
66
|
+
optional-dependencies.dev = [
|
|
67
|
+
"gitpython",
|
|
68
|
+
"nvsmi",
|
|
69
|
+
"requests",
|
|
70
|
+
"termcolor",
|
|
71
|
+
"tomli", # Only needed before 3.11
|
|
72
|
+
]
|
|
73
|
+
# Loaded by read-the-docs
|
|
74
|
+
# `pip install .[docs]`
|
|
75
|
+
optional-dependencies.docs = [
|
|
76
|
+
"nbsphinx",
|
|
77
|
+
"pandoc",
|
|
78
|
+
"requests",
|
|
79
|
+
"sphinx",
|
|
80
|
+
"sphinx-argparse",
|
|
81
|
+
"sphinx-rtd-theme",
|
|
82
|
+
"termcolor",
|
|
83
|
+
"tomli", # Only needed before 3.11
|
|
84
|
+
]
|
|
85
|
+
optional-dependencies.grib = [
|
|
86
|
+
"requests",
|
|
87
|
+
]
|
|
88
|
+
|
|
89
|
+
optional-dependencies.provenance = [
|
|
90
|
+
"gitpython",
|
|
91
|
+
"nvsmi",
|
|
92
|
+
]
|
|
93
|
+
optional-dependencies.text = [
|
|
94
|
+
"termcolor",
|
|
95
|
+
]
|
|
96
|
+
urls.Documentation = "https://anemoi-utils.readthedocs.io/"
|
|
97
|
+
urls.Homepage = "https://github.com/ecmwf/anemoi-utils/"
|
|
98
|
+
urls.Issues = "https://github.com/ecmwf/anemoi-utils/issues"
|
|
99
|
+
urls.Repository = "https://github.com/ecmwf/anemoi-utils/"
|
|
100
|
+
scripts.anemoi-utils = "anemoi.utils.__main__:main"
|
|
101
|
+
|
|
102
|
+
[tool.setuptools.package-data]
|
|
103
|
+
"anemoi.utils.mars" = [
|
|
104
|
+
"*.yaml",
|
|
105
|
+
]
|
|
106
|
+
|
|
107
|
+
[tool.setuptools_scm]
|
|
108
|
+
version_file = "src/anemoi/utils/_version.py"
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# (C) Copyright 2024 ECMWF.
|
|
3
|
+
#
|
|
4
|
+
# This software is licensed under the terms of the Apache Licence Version 2.0
|
|
5
|
+
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
# In applying this licence, ECMWF does not waive the privileges and immunities
|
|
7
|
+
# granted to it by virtue of its status as an intergovernmental organisation
|
|
8
|
+
# nor does it submit to any jurisdiction.
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
from anemoi.utils.cli import cli_main
|
|
12
|
+
from anemoi.utils.cli import make_parser
|
|
13
|
+
|
|
14
|
+
from . import __version__
|
|
15
|
+
from .commands import COMMANDS
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
# For read-the-docs
|
|
19
|
+
def create_parser():
|
|
20
|
+
return make_parser(__doc__, COMMANDS)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def main():
|
|
24
|
+
cli_main(__version__, __doc__, COMMANDS)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
if __name__ == "__main__":
|
|
28
|
+
main()
|
|
@@ -1,23 +1,66 @@
|
|
|
1
|
-
|
|
2
|
-
# (C) Copyright 2024 ECMWF.
|
|
3
|
-
#
|
|
1
|
+
# (C) Copyright 2024 European Centre for Medium-Range Weather Forecasts.
|
|
4
2
|
# This software is licensed under the terms of the Apache Licence Version 2.0
|
|
5
3
|
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
4
|
# In applying this licence, ECMWF does not waive the privileges and immunities
|
|
7
5
|
# granted to it by virtue of its status as an intergovernmental organisation
|
|
8
6
|
# nor does it submit to any jurisdiction.
|
|
9
|
-
#
|
|
10
7
|
|
|
11
8
|
import argparse
|
|
12
9
|
import importlib
|
|
13
10
|
import logging
|
|
14
11
|
import os
|
|
15
12
|
import sys
|
|
13
|
+
import traceback
|
|
16
14
|
|
|
17
15
|
LOG = logging.getLogger(__name__)
|
|
18
16
|
|
|
19
17
|
|
|
20
|
-
|
|
18
|
+
class Command:
|
|
19
|
+
def run(self, args):
|
|
20
|
+
raise NotImplementedError(f"Command not implemented: {args.command}")
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def make_parser(description, commands):
|
|
24
|
+
parser = argparse.ArgumentParser(
|
|
25
|
+
description=description,
|
|
26
|
+
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
parser.add_argument(
|
|
30
|
+
"--version",
|
|
31
|
+
"-V",
|
|
32
|
+
action="store_true",
|
|
33
|
+
help="show the version and exit",
|
|
34
|
+
)
|
|
35
|
+
parser.add_argument(
|
|
36
|
+
"--debug",
|
|
37
|
+
"-d",
|
|
38
|
+
action="store_true",
|
|
39
|
+
help="Debug mode",
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
subparsers = parser.add_subparsers(help="commands:", dest="command")
|
|
43
|
+
for name, command in commands.items():
|
|
44
|
+
command_parser = subparsers.add_parser(name, help=command.__doc__)
|
|
45
|
+
command.add_arguments(command_parser)
|
|
46
|
+
|
|
47
|
+
return parser
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class Failed(Command):
|
|
51
|
+
def __init__(self, name, error):
|
|
52
|
+
self.name = name
|
|
53
|
+
self.error = error
|
|
54
|
+
|
|
55
|
+
def add_arguments(self, command_parser):
|
|
56
|
+
command_parser.add_argument("x", nargs=argparse.REMAINDER)
|
|
57
|
+
|
|
58
|
+
def run(self, args):
|
|
59
|
+
print(f"Command '{self.name}' not available: {self.error}")
|
|
60
|
+
sys.exit(1)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def register_commands(here, package, select, fail=None):
|
|
21
64
|
result = {}
|
|
22
65
|
not_available = {}
|
|
23
66
|
|
|
@@ -52,27 +95,32 @@ def register(here, package, select, fail=None):
|
|
|
52
95
|
return result
|
|
53
96
|
|
|
54
97
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
98
|
+
def cli_main(version, description, commands):
|
|
99
|
+
parser = make_parser(description, commands)
|
|
100
|
+
args = parser.parse_args()
|
|
58
101
|
|
|
102
|
+
if args.version:
|
|
103
|
+
print(version)
|
|
104
|
+
return
|
|
59
105
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
self.error = error
|
|
106
|
+
if args.command is None:
|
|
107
|
+
parser.print_help()
|
|
108
|
+
return
|
|
64
109
|
|
|
65
|
-
|
|
66
|
-
command_parser.add_argument("x", nargs=argparse.REMAINDER)
|
|
110
|
+
cmd = commands[args.command]
|
|
67
111
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
112
|
+
logging.basicConfig(
|
|
113
|
+
format="%(asctime)s %(levelname)s %(message)s",
|
|
114
|
+
datefmt="%Y-%m-%d %H:%M:%S",
|
|
115
|
+
level=logging.DEBUG if args.debug else logging.INFO,
|
|
116
|
+
)
|
|
71
117
|
|
|
118
|
+
try:
|
|
119
|
+
cmd.run(args)
|
|
120
|
+
except ValueError as e:
|
|
121
|
+
traceback.print_exc()
|
|
122
|
+
LOG.error("\n💣 %s", str(e).lstrip())
|
|
123
|
+
LOG.error("💣 Exiting")
|
|
124
|
+
sys.exit(1)
|
|
72
125
|
|
|
73
|
-
|
|
74
|
-
os.path.dirname(__file__),
|
|
75
|
-
__name__,
|
|
76
|
-
lambda x: x.command(),
|
|
77
|
-
lambda name, error: Failed(name, error),
|
|
78
|
-
)
|
|
126
|
+
sys.exit(0)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# (C) Copyright 2024 ECMWF.
|
|
3
|
+
#
|
|
4
|
+
# This software is licensed under the terms of the Apache Licence Version 2.0
|
|
5
|
+
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
# In applying this licence, ECMWF does not waive the privileges and immunities
|
|
7
|
+
# granted to it by virtue of its status as an intergovernmental organisation
|
|
8
|
+
# nor does it submit to any jurisdiction.
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
import os
|
|
12
|
+
|
|
13
|
+
from anemoi.utils.cli import Command
|
|
14
|
+
from anemoi.utils.cli import Failed
|
|
15
|
+
from anemoi.utils.cli import register_commands
|
|
16
|
+
|
|
17
|
+
__all__ = ["Command"]
|
|
18
|
+
|
|
19
|
+
COMMANDS = register_commands(
|
|
20
|
+
os.path.dirname(__file__),
|
|
21
|
+
__name__,
|
|
22
|
+
lambda x: x.command(),
|
|
23
|
+
lambda name, error: Failed(name, error),
|
|
24
|
+
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: anemoi-utils
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
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
|
|
@@ -205,51 +205,54 @@ License: Apache License
|
|
|
205
205
|
See the License for the specific language governing permissions and
|
|
206
206
|
limitations under the License.
|
|
207
207
|
|
|
208
|
-
Project-URL: Homepage, https://github.com/ecmwf/anemoi-utils/
|
|
209
208
|
Project-URL: Documentation, https://anemoi-utils.readthedocs.io/
|
|
210
|
-
Project-URL:
|
|
209
|
+
Project-URL: Homepage, https://github.com/ecmwf/anemoi-utils/
|
|
211
210
|
Project-URL: Issues, https://github.com/ecmwf/anemoi-utils/issues
|
|
212
|
-
|
|
211
|
+
Project-URL: Repository, https://github.com/ecmwf/anemoi-utils/
|
|
212
|
+
Keywords: ai,tools
|
|
213
213
|
Classifier: Development Status :: 4 - Beta
|
|
214
214
|
Classifier: Intended Audience :: Developers
|
|
215
215
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
216
|
-
Classifier:
|
|
216
|
+
Classifier: Operating System :: OS Independent
|
|
217
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
217
218
|
Classifier: Programming Language :: Python :: 3.9
|
|
218
219
|
Classifier: Programming Language :: Python :: 3.10
|
|
219
220
|
Classifier: Programming Language :: Python :: 3.11
|
|
221
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
220
222
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
221
223
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
222
|
-
Classifier: Operating System :: OS Independent
|
|
223
224
|
Requires-Python: >=3.9
|
|
224
225
|
License-File: LICENSE
|
|
225
|
-
Requires-Dist: tomli
|
|
226
226
|
Requires-Dist: pyyaml
|
|
227
|
+
Requires-Dist: tomli
|
|
227
228
|
Requires-Dist: tqdm
|
|
228
|
-
Provides-Extra: provenance
|
|
229
|
-
Requires-Dist: GitPython; extra == "provenance"
|
|
230
|
-
Requires-Dist: nvsmi; extra == "provenance"
|
|
231
|
-
Provides-Extra: text
|
|
232
|
-
Requires-Dist: termcolor; extra == "text"
|
|
233
|
-
Provides-Extra: grib
|
|
234
|
-
Requires-Dist: requests; extra == "grib"
|
|
235
|
-
Provides-Extra: docs
|
|
236
|
-
Requires-Dist: tomli; extra == "docs"
|
|
237
|
-
Requires-Dist: termcolor; extra == "docs"
|
|
238
|
-
Requires-Dist: requests; extra == "docs"
|
|
239
|
-
Requires-Dist: sphinx; extra == "docs"
|
|
240
|
-
Requires-Dist: sphinx_rtd_theme; extra == "docs"
|
|
241
|
-
Requires-Dist: nbsphinx; extra == "docs"
|
|
242
|
-
Requires-Dist: pandoc; extra == "docs"
|
|
243
|
-
Requires-Dist: sphinx_argparse; extra == "docs"
|
|
244
229
|
Provides-Extra: all
|
|
245
|
-
Requires-Dist:
|
|
246
|
-
Requires-Dist: GitPython; extra == "all"
|
|
230
|
+
Requires-Dist: gitpython; extra == "all"
|
|
247
231
|
Requires-Dist: nvsmi; extra == "all"
|
|
248
|
-
Requires-Dist:
|
|
232
|
+
Requires-Dist: pyyaml; extra == "all"
|
|
249
233
|
Requires-Dist: requests; extra == "all"
|
|
234
|
+
Requires-Dist: termcolor; extra == "all"
|
|
235
|
+
Requires-Dist: tomli; extra == "all"
|
|
236
|
+
Requires-Dist: tqdm; extra == "all"
|
|
250
237
|
Provides-Extra: dev
|
|
251
|
-
Requires-Dist:
|
|
252
|
-
Requires-Dist: GitPython; extra == "dev"
|
|
238
|
+
Requires-Dist: gitpython; extra == "dev"
|
|
253
239
|
Requires-Dist: nvsmi; extra == "dev"
|
|
254
|
-
Requires-Dist: termcolor; extra == "dev"
|
|
255
240
|
Requires-Dist: requests; extra == "dev"
|
|
241
|
+
Requires-Dist: termcolor; extra == "dev"
|
|
242
|
+
Requires-Dist: tomli; extra == "dev"
|
|
243
|
+
Provides-Extra: docs
|
|
244
|
+
Requires-Dist: nbsphinx; extra == "docs"
|
|
245
|
+
Requires-Dist: pandoc; extra == "docs"
|
|
246
|
+
Requires-Dist: requests; extra == "docs"
|
|
247
|
+
Requires-Dist: sphinx; extra == "docs"
|
|
248
|
+
Requires-Dist: sphinx-argparse; extra == "docs"
|
|
249
|
+
Requires-Dist: sphinx-rtd-theme; extra == "docs"
|
|
250
|
+
Requires-Dist: termcolor; extra == "docs"
|
|
251
|
+
Requires-Dist: tomli; extra == "docs"
|
|
252
|
+
Provides-Extra: grib
|
|
253
|
+
Requires-Dist: requests; extra == "grib"
|
|
254
|
+
Provides-Extra: provenance
|
|
255
|
+
Requires-Dist: gitpython; extra == "provenance"
|
|
256
|
+
Requires-Dist: nvsmi; extra == "provenance"
|
|
257
|
+
Provides-Extra: text
|
|
258
|
+
Requires-Dist: termcolor; extra == "text"
|
|
@@ -1,36 +1,38 @@
|
|
|
1
|
-
tomli
|
|
2
1
|
pyyaml
|
|
2
|
+
tomli
|
|
3
3
|
tqdm
|
|
4
4
|
|
|
5
5
|
[all]
|
|
6
|
-
|
|
7
|
-
GitPython
|
|
6
|
+
gitpython
|
|
8
7
|
nvsmi
|
|
9
|
-
|
|
8
|
+
pyyaml
|
|
10
9
|
requests
|
|
10
|
+
termcolor
|
|
11
|
+
tomli
|
|
12
|
+
tqdm
|
|
11
13
|
|
|
12
14
|
[dev]
|
|
13
|
-
|
|
14
|
-
GitPython
|
|
15
|
+
gitpython
|
|
15
16
|
nvsmi
|
|
16
|
-
termcolor
|
|
17
17
|
requests
|
|
18
|
+
termcolor
|
|
19
|
+
tomli
|
|
18
20
|
|
|
19
21
|
[docs]
|
|
20
|
-
tomli
|
|
21
|
-
termcolor
|
|
22
|
-
requests
|
|
23
|
-
sphinx
|
|
24
|
-
sphinx_rtd_theme
|
|
25
22
|
nbsphinx
|
|
26
23
|
pandoc
|
|
27
|
-
|
|
24
|
+
requests
|
|
25
|
+
sphinx
|
|
26
|
+
sphinx-argparse
|
|
27
|
+
sphinx-rtd-theme
|
|
28
|
+
termcolor
|
|
29
|
+
tomli
|
|
28
30
|
|
|
29
31
|
[grib]
|
|
30
32
|
requests
|
|
31
33
|
|
|
32
34
|
[provenance]
|
|
33
|
-
|
|
35
|
+
gitpython
|
|
34
36
|
nvsmi
|
|
35
37
|
|
|
36
38
|
[text]
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
# (C) Copyright 2024 ECMWF.
|
|
3
|
-
#
|
|
4
|
-
# This software is licensed under the terms of the Apache Licence Version 2.0
|
|
5
|
-
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
-
# In applying this licence, ECMWF does not waive the privileges and immunities
|
|
7
|
-
# granted to it by virtue of its status as an intergovernmental organisation
|
|
8
|
-
# nor does it submit to any jurisdiction.
|
|
9
|
-
|
|
10
|
-
# https://packaging.python.org/en/latest/guides/writing-pyproject-toml/
|
|
11
|
-
|
|
12
|
-
[build-system]
|
|
13
|
-
requires = ["setuptools>=60", "setuptools-scm>=8.0"]
|
|
14
|
-
|
|
15
|
-
[project]
|
|
16
|
-
description = "A package to hold various functions to support training of ML models on ECMWF data."
|
|
17
|
-
name = "anemoi-utils"
|
|
18
|
-
|
|
19
|
-
dynamic = ["version"]
|
|
20
|
-
license = { file = "LICENSE" }
|
|
21
|
-
requires-python = ">=3.9"
|
|
22
|
-
|
|
23
|
-
authors = [
|
|
24
|
-
{ name = "European Centre for Medium-Range Weather Forecasts (ECMWF)", email = "software.support@ecmwf.int" },
|
|
25
|
-
]
|
|
26
|
-
|
|
27
|
-
keywords = ["tools", "ai"]
|
|
28
|
-
|
|
29
|
-
classifiers = [
|
|
30
|
-
"Development Status :: 4 - Beta",
|
|
31
|
-
"Intended Audience :: Developers",
|
|
32
|
-
"License :: OSI Approved :: Apache Software License",
|
|
33
|
-
"Programming Language :: Python :: 3",
|
|
34
|
-
"Programming Language :: Python :: 3.9",
|
|
35
|
-
"Programming Language :: Python :: 3.10",
|
|
36
|
-
"Programming Language :: Python :: 3.11",
|
|
37
|
-
"Programming Language :: Python :: Implementation :: CPython",
|
|
38
|
-
"Programming Language :: Python :: Implementation :: PyPy",
|
|
39
|
-
"Operating System :: OS Independent",
|
|
40
|
-
]
|
|
41
|
-
|
|
42
|
-
dependencies = [
|
|
43
|
-
"tomli", # Only needed before 3.11
|
|
44
|
-
"pyyaml",
|
|
45
|
-
"tqdm",
|
|
46
|
-
]
|
|
47
|
-
|
|
48
|
-
[project.optional-dependencies]
|
|
49
|
-
provenance = ["GitPython", "nvsmi"]
|
|
50
|
-
|
|
51
|
-
text = ["termcolor"]
|
|
52
|
-
|
|
53
|
-
grib = ["requests"]
|
|
54
|
-
|
|
55
|
-
# Loaded by read-the-docs
|
|
56
|
-
# `pip install .[docs]`
|
|
57
|
-
docs = [
|
|
58
|
-
"tomli", # Only needed before 3.11
|
|
59
|
-
"termcolor",
|
|
60
|
-
"requests",
|
|
61
|
-
"sphinx",
|
|
62
|
-
"sphinx_rtd_theme",
|
|
63
|
-
"nbsphinx",
|
|
64
|
-
"pandoc",
|
|
65
|
-
"sphinx_argparse",
|
|
66
|
-
]
|
|
67
|
-
|
|
68
|
-
all = [
|
|
69
|
-
"tomli", # Only needed before 3.11
|
|
70
|
-
"GitPython",
|
|
71
|
-
"nvsmi",
|
|
72
|
-
"termcolor",
|
|
73
|
-
"requests",
|
|
74
|
-
]
|
|
75
|
-
|
|
76
|
-
dev = [
|
|
77
|
-
"tomli", # Only needed before 3.11
|
|
78
|
-
"GitPython",
|
|
79
|
-
"nvsmi",
|
|
80
|
-
"termcolor",
|
|
81
|
-
"requests",
|
|
82
|
-
]
|
|
83
|
-
|
|
84
|
-
[project.urls]
|
|
85
|
-
Homepage = "https://github.com/ecmwf/anemoi-utils/"
|
|
86
|
-
Documentation = "https://anemoi-utils.readthedocs.io/"
|
|
87
|
-
Repository = "https://github.com/ecmwf/anemoi-utils/"
|
|
88
|
-
Issues = "https://github.com/ecmwf/anemoi-utils/issues"
|
|
89
|
-
# Changelog = "https://github.com/ecmwf/anemoi-utils/CHANGELOG.md"
|
|
90
|
-
|
|
91
|
-
[project.scripts]
|
|
92
|
-
anemoi-utils = "anemoi.utils.__main__:main"
|
|
93
|
-
|
|
94
|
-
[tool.setuptools_scm]
|
|
95
|
-
version_file = "src/anemoi/utils/_version.py"
|
|
96
|
-
|
|
97
|
-
[tool.setuptools.package-data]
|
|
98
|
-
"anemoi.utils.mars" = ["*.yaml"]
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
# (C) Copyright 2024 ECMWF.
|
|
3
|
-
#
|
|
4
|
-
# This software is licensed under the terms of the Apache Licence Version 2.0
|
|
5
|
-
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
-
# In applying this licence, ECMWF does not waive the privileges and immunities
|
|
7
|
-
# granted to it by virtue of its status as an intergovernmental organisation
|
|
8
|
-
# nor does it submit to any jurisdiction.
|
|
9
|
-
#
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
import argparse
|
|
13
|
-
import logging
|
|
14
|
-
import sys
|
|
15
|
-
import traceback
|
|
16
|
-
|
|
17
|
-
from . import __version__
|
|
18
|
-
from .commands import COMMANDS
|
|
19
|
-
|
|
20
|
-
LOG = logging.getLogger(__name__)
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
def main():
|
|
24
|
-
parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
|
|
25
|
-
|
|
26
|
-
parser.add_argument(
|
|
27
|
-
"--version",
|
|
28
|
-
"-V",
|
|
29
|
-
action="store_true",
|
|
30
|
-
help="show the version and exit",
|
|
31
|
-
)
|
|
32
|
-
parser.add_argument(
|
|
33
|
-
"--debug",
|
|
34
|
-
"-d",
|
|
35
|
-
action="store_true",
|
|
36
|
-
help="Debug mode",
|
|
37
|
-
)
|
|
38
|
-
|
|
39
|
-
subparsers = parser.add_subparsers(help="commands:", dest="command")
|
|
40
|
-
for name, command in COMMANDS.items():
|
|
41
|
-
command_parser = subparsers.add_parser(name, help=command.__doc__)
|
|
42
|
-
command.add_arguments(command_parser)
|
|
43
|
-
|
|
44
|
-
args = parser.parse_args()
|
|
45
|
-
|
|
46
|
-
if args.version:
|
|
47
|
-
print(__version__)
|
|
48
|
-
return
|
|
49
|
-
|
|
50
|
-
if args.command is None:
|
|
51
|
-
parser.print_help()
|
|
52
|
-
return
|
|
53
|
-
|
|
54
|
-
cmd = COMMANDS[args.command]
|
|
55
|
-
|
|
56
|
-
logging.basicConfig(
|
|
57
|
-
format="%(asctime)s %(levelname)s %(message)s",
|
|
58
|
-
datefmt="%Y-%m-%d %H:%M:%S",
|
|
59
|
-
level=logging.DEBUG if args.debug else logging.INFO,
|
|
60
|
-
)
|
|
61
|
-
|
|
62
|
-
try:
|
|
63
|
-
cmd.run(args)
|
|
64
|
-
except ValueError as e:
|
|
65
|
-
traceback.print_exc()
|
|
66
|
-
LOG.error("\n💣 %s", str(e).lstrip())
|
|
67
|
-
LOG.error("💣 Exiting")
|
|
68
|
-
sys.exit(1)
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if __name__ == "__main__":
|
|
72
|
-
main()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|