ddsapi 0.6b3__tar.gz → 0.6b5__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.
- {ddsapi-0.6b3 → ddsapi-0.6b5}/PKG-INFO +13 -6
- {ddsapi-0.6b3 → ddsapi-0.6b5}/ddsapi/api.py +24 -12
- {ddsapi-0.6b3 → ddsapi-0.6b5}/ddsapi/cache.py +2 -2
- {ddsapi-0.6b3 → ddsapi-0.6b5}/ddsapi.egg-info/PKG-INFO +13 -6
- ddsapi-0.6b5/ddsapi.egg-info/requires.txt +1 -0
- {ddsapi-0.6b3 → ddsapi-0.6b5}/setup.py +7 -5
- ddsapi-0.6b3/ddsapi.egg-info/requires.txt +0 -4
- {ddsapi-0.6b3 → ddsapi-0.6b5}/LICENSE +0 -0
- {ddsapi-0.6b3 → ddsapi-0.6b5}/README.md +0 -0
- {ddsapi-0.6b3 → ddsapi-0.6b5}/ddsapi/__init__.py +0 -0
- {ddsapi-0.6b3 → ddsapi-0.6b5}/ddsapi.egg-info/SOURCES.txt +0 -0
- {ddsapi-0.6b3 → ddsapi-0.6b5}/ddsapi.egg-info/dependency_links.txt +0 -0
- {ddsapi-0.6b3 → ddsapi-0.6b5}/ddsapi.egg-info/top_level.txt +0 -0
- {ddsapi-0.6b3 → ddsapi-0.6b5}/setup.cfg +0 -0
- {ddsapi-0.6b3 → ddsapi-0.6b5}/tests/__init__.py +0 -0
- {ddsapi-0.6b3 → ddsapi-0.6b5}/tests/test_config.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: ddsapi
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6b5
|
|
4
4
|
Summary: Python Client to access and download data from CMCC Data Delivery System (DDS)
|
|
5
5
|
Home-page: https://github.com/CMCC-Foundation/ddsapi-client/
|
|
6
6
|
Author: CMCC Data Delivery System Team
|
|
@@ -18,10 +18,17 @@ Classifier: Topic :: Scientific/Engineering :: Hydrology
|
|
|
18
18
|
Requires-Python: >=3.7
|
|
19
19
|
Description-Content-Type: text/markdown
|
|
20
20
|
License-File: LICENSE
|
|
21
|
-
Requires-Dist:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
Requires-Dist: geokube==0.2.7.1
|
|
22
|
+
Dynamic: author
|
|
23
|
+
Dynamic: author-email
|
|
24
|
+
Dynamic: classifier
|
|
25
|
+
Dynamic: description
|
|
26
|
+
Dynamic: description-content-type
|
|
27
|
+
Dynamic: home-page
|
|
28
|
+
Dynamic: license
|
|
29
|
+
Dynamic: requires-dist
|
|
30
|
+
Dynamic: requires-python
|
|
31
|
+
Dynamic: summary
|
|
25
32
|
|
|
26
33
|
# DDSAPI-Client
|
|
27
34
|
Python Client to access and download data from [CMCC Data Delivery System (DDS)](https://dds.cmcc.it)
|
|
@@ -30,6 +30,7 @@ import shutil
|
|
|
30
30
|
from typing import Any, Union, Iterable
|
|
31
31
|
import urllib3
|
|
32
32
|
import xarray as xr
|
|
33
|
+
from geokube import open_datacube
|
|
33
34
|
|
|
34
35
|
from .cache import CacheManager
|
|
35
36
|
|
|
@@ -186,13 +187,12 @@ class _Result:
|
|
|
186
187
|
if os.path.isdir(self.target_path):
|
|
187
188
|
ds_list = []
|
|
188
189
|
for f in os.listdir(self.target_path):
|
|
189
|
-
ds = xr.open_dataset(os.path.join(self.target_path, f))
|
|
190
|
+
ds = xr.open_dataset(os.path.join(self.target_path, f), decode_coords='all')
|
|
190
191
|
ds_list.append(ds)
|
|
191
192
|
if len(ds_list) == 1:
|
|
192
193
|
return ds_list[0]
|
|
193
194
|
return ds_list
|
|
194
|
-
|
|
195
|
-
return xr.open_dataset(self.target_path)
|
|
195
|
+
return xr.open_dataset(self.target_path, decode_coords='all')
|
|
196
196
|
|
|
197
197
|
class EnvVarNames:
|
|
198
198
|
RC_FILE: str = "DDSAPI_RC"
|
|
@@ -354,8 +354,14 @@ class Client:
|
|
|
354
354
|
level=level, format="%(asctime)s %(levelname)s %(message)s"
|
|
355
355
|
)
|
|
356
356
|
config = Config()
|
|
357
|
-
|
|
358
|
-
|
|
357
|
+
if url is None:
|
|
358
|
+
self.url = config.url
|
|
359
|
+
else:
|
|
360
|
+
self.url = url
|
|
361
|
+
if key is None:
|
|
362
|
+
self.key = config.key
|
|
363
|
+
else:
|
|
364
|
+
self.key = key
|
|
359
365
|
self.verify = config.verify
|
|
360
366
|
self.cache: CacheManager = CacheManager(
|
|
361
367
|
cache_dir=config.cachedir,
|
|
@@ -637,12 +643,14 @@ class Client:
|
|
|
637
643
|
assert dataset_id, "'dataset_id' cannot be 'None'"
|
|
638
644
|
assert product_id, "'product_id' cannot be 'None'"
|
|
639
645
|
session = self.session
|
|
646
|
+
streaming = False
|
|
640
647
|
if "format" not in request:
|
|
641
648
|
request["temp_file"] = target
|
|
642
649
|
cached_target = self.cache.maybe_get_from_cache(dataset_id=dataset_id, product_id=product_id, request=request)
|
|
643
650
|
if cached_target:
|
|
644
651
|
return cached_target
|
|
645
|
-
|
|
652
|
+
if request["format"] == "zarr":
|
|
653
|
+
streaming = True
|
|
646
654
|
jreply = self._submit(
|
|
647
655
|
f"{self.url}/datasets/{dataset_id}/{product_id}/execute",
|
|
648
656
|
request,
|
|
@@ -703,12 +711,16 @@ class Client:
|
|
|
703
711
|
else:
|
|
704
712
|
_target = target
|
|
705
713
|
try:
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
714
|
+
if not streaming:
|
|
715
|
+
result.download(_target)
|
|
716
|
+
self.cache.add_to_cache(
|
|
717
|
+
dataset_id=dataset_id,
|
|
718
|
+
product_id=product_id,
|
|
719
|
+
request=request,
|
|
720
|
+
target=result.get_files(), overwrite=False)
|
|
721
|
+
else:
|
|
722
|
+
self.info(f"Opening zarr in streaming.... {result._download_url}")
|
|
723
|
+
return xr.open_dataset(result._download_url, decode_coords='all', engine="zarr")
|
|
712
724
|
except RuntimeError as err:
|
|
713
725
|
self.logger.error(str(err))
|
|
714
726
|
return
|
|
@@ -96,12 +96,12 @@ class CacheManager:
|
|
|
96
96
|
if isinstance(target, list):
|
|
97
97
|
ds_list = []
|
|
98
98
|
for f in target:
|
|
99
|
-
ds = xr.open_dataset(os.path.join(self.cache_dir, f))
|
|
99
|
+
ds = xr.open_dataset(os.path.join(self.cache_dir, f), decode_coords='all')
|
|
100
100
|
ds_list.append(ds)
|
|
101
101
|
if len(ds_list) == 1:
|
|
102
102
|
return ds_list[0]
|
|
103
103
|
return ds_list
|
|
104
104
|
elif isinstance(target, str):
|
|
105
|
-
return xr.open_dataset(os.path.join(self.cache_dir, target))
|
|
105
|
+
return xr.open_dataset(os.path.join(self.cache_dir, target), decode_coords='all')
|
|
106
106
|
else:
|
|
107
107
|
raise TypeError
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: ddsapi
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6b5
|
|
4
4
|
Summary: Python Client to access and download data from CMCC Data Delivery System (DDS)
|
|
5
5
|
Home-page: https://github.com/CMCC-Foundation/ddsapi-client/
|
|
6
6
|
Author: CMCC Data Delivery System Team
|
|
@@ -18,10 +18,17 @@ Classifier: Topic :: Scientific/Engineering :: Hydrology
|
|
|
18
18
|
Requires-Python: >=3.7
|
|
19
19
|
Description-Content-Type: text/markdown
|
|
20
20
|
License-File: LICENSE
|
|
21
|
-
Requires-Dist:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
Requires-Dist: geokube==0.2.7.1
|
|
22
|
+
Dynamic: author
|
|
23
|
+
Dynamic: author-email
|
|
24
|
+
Dynamic: classifier
|
|
25
|
+
Dynamic: description
|
|
26
|
+
Dynamic: description-content-type
|
|
27
|
+
Dynamic: home-page
|
|
28
|
+
Dynamic: license
|
|
29
|
+
Dynamic: requires-dist
|
|
30
|
+
Dynamic: requires-python
|
|
31
|
+
Dynamic: summary
|
|
25
32
|
|
|
26
33
|
# DDSAPI-Client
|
|
27
34
|
Python Client to access and download data from [CMCC Data Delivery System (DDS)](https://dds.cmcc.it)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
geokube==0.2.7.1
|
|
@@ -17,7 +17,7 @@ with open("README.md", "r") as f:
|
|
|
17
17
|
|
|
18
18
|
setuptools.setup(
|
|
19
19
|
name="ddsapi",
|
|
20
|
-
version="0.
|
|
20
|
+
version="0.6b5",
|
|
21
21
|
author="CMCC Data Delivery System Team",
|
|
22
22
|
author_email="dds-support@cmcc.it",
|
|
23
23
|
description=(
|
|
@@ -29,10 +29,12 @@ setuptools.setup(
|
|
|
29
29
|
url="https://github.com/CMCC-Foundation/ddsapi-client/",
|
|
30
30
|
packages=setuptools.find_packages(),
|
|
31
31
|
install_requires=[
|
|
32
|
-
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
32
|
+
"geokube==0.2.7.1"
|
|
33
|
+
#"netCDF4>=1.5.3",
|
|
34
|
+
#"scipy>=1.5.2",
|
|
35
|
+
#"requests>=2.23.0",
|
|
36
|
+
#"xarray==2022.10.0",
|
|
37
|
+
#"numpy==1.26.0"
|
|
36
38
|
],
|
|
37
39
|
classifiers=[
|
|
38
40
|
"Development Status :: 4 - Beta",
|
|
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
|