anemoi-utils 0.3.1__tar.gz → 0.3.2__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.3.1 → anemoi_utils-0.3.2}/PKG-INFO +1 -1
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/src/anemoi/utils/_version.py +2 -2
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/src/anemoi/utils/cli.py +1 -1
- anemoi_utils-0.3.2/src/anemoi/utils/s3.py +57 -0
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/src/anemoi_utils.egg-info/PKG-INFO +1 -1
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/src/anemoi_utils.egg-info/SOURCES.txt +1 -0
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/.github/workflows/python-publish.yml +0 -0
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/.gitignore +0 -0
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/.pre-commit-config.yaml +0 -0
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/.readthedocs.yaml +0 -0
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/LICENSE +0 -0
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/README.md +0 -0
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/docs/Makefile +0 -0
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/docs/_static/logo.png +0 -0
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/docs/_static/style.css +0 -0
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/docs/_templates/.gitkeep +0 -0
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/docs/conf.py +0 -0
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/docs/index.rst +0 -0
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/docs/installing.rst +0 -0
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/docs/modules/checkpoints.rst +0 -0
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/docs/modules/config.rst +0 -0
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/docs/modules/dates.rst +0 -0
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/docs/modules/grib.rst +0 -0
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/docs/modules/humanize.rst +0 -0
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/docs/modules/provenance.rst +0 -0
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/docs/modules/text.rst +0 -0
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/docs/requirements.txt +0 -0
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/pyproject.toml +0 -0
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/setup.cfg +0 -0
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/src/anemoi/utils/__init__.py +0 -0
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/src/anemoi/utils/__main__.py +0 -0
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/src/anemoi/utils/caching.py +0 -0
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/src/anemoi/utils/checkpoints.py +0 -0
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/src/anemoi/utils/commands/__init__.py +0 -0
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/src/anemoi/utils/commands/checkpoint.py +0 -0
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/src/anemoi/utils/config.py +0 -0
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/src/anemoi/utils/dates.py +0 -0
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/src/anemoi/utils/grib.py +0 -0
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/src/anemoi/utils/humanize.py +0 -0
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/src/anemoi/utils/mars/__init__.py +0 -0
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/src/anemoi/utils/mars/mars.yaml +0 -0
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/src/anemoi/utils/provenance.py +0 -0
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/src/anemoi/utils/text.py +0 -0
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/src/anemoi/utils/timer.py +0 -0
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/src/anemoi_utils.egg-info/dependency_links.txt +0 -0
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/src/anemoi_utils.egg-info/entry_points.txt +0 -0
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/src/anemoi_utils.egg-info/requires.txt +0 -0
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/src/anemoi_utils.egg-info/top_level.txt +0 -0
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/tests/test_dates.py +0 -0
- {anemoi_utils-0.3.1 → anemoi_utils-0.3.2}/tests/test_utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: anemoi-utils
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.2
|
|
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
|
|
@@ -41,7 +41,7 @@ def make_parser(description, commands):
|
|
|
41
41
|
|
|
42
42
|
subparsers = parser.add_subparsers(help="commands:", dest="command")
|
|
43
43
|
for name, command in commands.items():
|
|
44
|
-
command_parser = subparsers.add_parser(name, help=command.__doc__)
|
|
44
|
+
command_parser = subparsers.add_parser(name, description=command.__doc__, help=command.__doc__)
|
|
45
45
|
command.add_arguments(command_parser)
|
|
46
46
|
|
|
47
47
|
return parser
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# (C) Copyright 2024 European Centre for Medium-Range Weather Forecasts.
|
|
2
|
+
# This software is licensed under the terms of the Apache Licence Version 2.0
|
|
3
|
+
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
|
4
|
+
# In applying this licence, ECMWF does not waive the privileges and immunities
|
|
5
|
+
# granted to it by virtue of its status as an intergovernmental organisation
|
|
6
|
+
# nor does it submit to any jurisdiction.
|
|
7
|
+
import logging
|
|
8
|
+
import os
|
|
9
|
+
from contextlib import closing
|
|
10
|
+
|
|
11
|
+
import boto3
|
|
12
|
+
import tqdm
|
|
13
|
+
|
|
14
|
+
LOG = logging.getLogger(__name__)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def upload(source, target, overwrite=False, ignore_existing=False):
|
|
18
|
+
# https://boto3.amazonaws.com/v1/documentation/api/latest/guide/s3-uploading-files.html
|
|
19
|
+
assert target.startswith("s3://")
|
|
20
|
+
|
|
21
|
+
_, _, bucket, key = target.split("/", 3)
|
|
22
|
+
|
|
23
|
+
LOG.info(f"Uploading {source} to {target}")
|
|
24
|
+
s3_client = boto3.client("s3")
|
|
25
|
+
|
|
26
|
+
if not overwrite:
|
|
27
|
+
results = s3_client.list_objects(Bucket=bucket, Prefix=key)
|
|
28
|
+
if results.get("Contents"):
|
|
29
|
+
if ignore_existing:
|
|
30
|
+
LOG.info(f"{target} already exists, skipping")
|
|
31
|
+
return
|
|
32
|
+
else:
|
|
33
|
+
raise ValueError(f"{target} already exists, use --overwrite to replace")
|
|
34
|
+
|
|
35
|
+
size = os.path.getsize(source)
|
|
36
|
+
with closing(tqdm.tqdm(total=size, unit="B", unit_scale=True)) as t:
|
|
37
|
+
s3_client.upload_file(source, bucket, key, Callback=lambda x: t.update(x))
|
|
38
|
+
|
|
39
|
+
LOG.info(f"{target} is ready")
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def download(source, target, overwrite=False):
|
|
43
|
+
assert source.startswith("s3://")
|
|
44
|
+
|
|
45
|
+
_, _, bucket, key = source.split("/", 3)
|
|
46
|
+
|
|
47
|
+
s3 = boto3.client("s3")
|
|
48
|
+
response = s3.head_object(Bucket=bucket, Key=key)
|
|
49
|
+
size = response["ContentLength"]
|
|
50
|
+
|
|
51
|
+
if not overwrite:
|
|
52
|
+
if os.path.exists(source) and os.path.getsize(source) == size:
|
|
53
|
+
LOG.info(f"{source} already exists, skipping")
|
|
54
|
+
return
|
|
55
|
+
|
|
56
|
+
with closing(tqdm.tqdm(total=size, unit="B", unit_scale=True)) as t:
|
|
57
|
+
s3.download_file(bucket, key, target, Callback=lambda x: t.update(x))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: anemoi-utils
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.2
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|