tonik 0.1.7__py3-none-any.whl → 0.1.9__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.
- tonik/api.py +10 -15
- tonik/xarray2zarr.py +1 -1
- {tonik-0.1.7.dist-info → tonik-0.1.9.dist-info}/METADATA +1 -1
- {tonik-0.1.7.dist-info → tonik-0.1.9.dist-info}/RECORD +7 -7
- {tonik-0.1.7.dist-info → tonik-0.1.9.dist-info}/WHEEL +0 -0
- {tonik-0.1.7.dist-info → tonik-0.1.9.dist-info}/entry_points.txt +0 -0
- {tonik-0.1.7.dist-info → tonik-0.1.9.dist-info}/licenses/LICENSE +0 -0
tonik/api.py
CHANGED
|
@@ -3,7 +3,7 @@ import os
|
|
|
3
3
|
import sys
|
|
4
4
|
from argparse import ArgumentParser
|
|
5
5
|
from datetime import datetime
|
|
6
|
-
from typing import Annotated, List, Union
|
|
6
|
+
from typing import Annotated, List, Union, Optional
|
|
7
7
|
from urllib.parse import unquote
|
|
8
8
|
|
|
9
9
|
import datashader as dsh
|
|
@@ -20,12 +20,8 @@ from .storage import Storage
|
|
|
20
20
|
|
|
21
21
|
logger = logging.getLogger(__name__)
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
SubdirType = Annotated[list[str] | None, Query()]
|
|
26
|
-
else:
|
|
27
|
-
# For Python 3.9 and below, use Union from typing
|
|
28
|
-
SubdirType = Annotated[Union[List[str], None], Query()]
|
|
23
|
+
SubdirType = Annotated[Union[List[str], None], Query()]
|
|
24
|
+
InventoryReturnType = Union[list, dict]
|
|
29
25
|
|
|
30
26
|
|
|
31
27
|
class TonikAPI:
|
|
@@ -64,21 +60,20 @@ class TonikAPI:
|
|
|
64
60
|
def feature(self,
|
|
65
61
|
group: str,
|
|
66
62
|
name: str,
|
|
67
|
-
starttime: str
|
|
68
|
-
endtime: str
|
|
63
|
+
starttime: Union[str, None],
|
|
64
|
+
endtime: Union[str, None],
|
|
65
|
+
subdir: SubdirType = None,
|
|
69
66
|
resolution: str = 'full',
|
|
70
67
|
verticalres: int = 10,
|
|
71
68
|
log: bool = False,
|
|
72
|
-
normalise: bool = False
|
|
73
|
-
subdir: SubdirType = None):
|
|
69
|
+
normalise: bool = False):
|
|
74
70
|
_st = self.preprocess_datetime(starttime)
|
|
75
71
|
_et = self.preprocess_datetime(endtime)
|
|
76
72
|
g = Storage(group, rootdir=self.rootdir,
|
|
77
73
|
starttime=_st, endtime=_et,
|
|
78
74
|
create=False)
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
else:
|
|
75
|
+
c = g
|
|
76
|
+
if subdir:
|
|
82
77
|
c = g.get_substore(*subdir)
|
|
83
78
|
try:
|
|
84
79
|
feat = c(name)
|
|
@@ -147,7 +142,7 @@ class TonikAPI:
|
|
|
147
142
|
d, units='hours since 1970-01-01 00:00:00.0', calendar='gregorian')
|
|
148
143
|
return freq, dates, spec
|
|
149
144
|
|
|
150
|
-
def inventory(self, group: str, subdir: SubdirType = None, tree: bool = True) ->
|
|
145
|
+
def inventory(self, group: str, subdir: SubdirType = None, tree: bool = True) -> InventoryReturnType:
|
|
151
146
|
sg = Storage(group, rootdir=self.rootdir, create=False)
|
|
152
147
|
try:
|
|
153
148
|
c = sg.get_substore(*subdir)
|
tonik/xarray2zarr.py
CHANGED
|
@@ -36,7 +36,7 @@ def xarray2zarr(xds: xr.Dataset, path: str, mode: str = 'a', group='original'):
|
|
|
36
36
|
else:
|
|
37
37
|
try:
|
|
38
38
|
xds_existing = xr.open_zarr(fout, group=group)
|
|
39
|
-
except PathNotFoundError:
|
|
39
|
+
except (PathNotFoundError, FileNotFoundError):
|
|
40
40
|
xds[feature].to_zarr(fout, group=group, mode='a')
|
|
41
41
|
continue
|
|
42
42
|
if xds_existing.datetime[0] > xds.datetime[0] or xds_existing.datetime[-1] > xds.datetime[-1]:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: tonik
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.9
|
|
4
4
|
Summary: Store time series data as HDF5 files and access them through an API.
|
|
5
5
|
Project-URL: Homepage, https://tsc-tools.github.io/tonik
|
|
6
6
|
Project-URL: Issues, https://github.com/tsc-tools/tonik/issues
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
tonik/__init__.py,sha256=ZBVGh4dm_l9xwiBGb33O5QV9MfZeNiEd3DBDAm6DiHk,511
|
|
2
|
-
tonik/api.py,sha256=
|
|
2
|
+
tonik/api.py,sha256=RhESsP5JI6GTdz_XwoVok-mprWUtkPxtTfW8suEak3Y,6572
|
|
3
3
|
tonik/storage.py,sha256=GNJ6w9VHOeTR_ZJMZ-Ipqe3nFK2I91fkHYwg1k9bEuo,9470
|
|
4
4
|
tonik/utils.py,sha256=3nSRU_GnV6arP4e63YHn4oEV8XbqzVAW8FCvQVIwGdg,2757
|
|
5
5
|
tonik/xarray2netcdf.py,sha256=RUsPwPDEOnUIMGt7_9F1VDyg83zu8x-Qs3jmZs3Dq0o,5173
|
|
6
|
-
tonik/xarray2zarr.py,sha256=
|
|
6
|
+
tonik/xarray2zarr.py,sha256=xJjKcFZF0oz6gw47apuCiXFtW5HgWqnZgiIuEVQHhBI,2363
|
|
7
7
|
tonik/package_data/index.html,sha256=GKDClUhIam_fAYbNfzAolORhSCG3ae1wW3VjWCg4PMk,2732
|
|
8
|
-
tonik-0.1.
|
|
9
|
-
tonik-0.1.
|
|
10
|
-
tonik-0.1.
|
|
11
|
-
tonik-0.1.
|
|
12
|
-
tonik-0.1.
|
|
8
|
+
tonik-0.1.9.dist-info/METADATA,sha256=vzVUzQ3ZGqEJiIUd3MGZnFnDJE_7dQxcbHTwi3NLEDc,1938
|
|
9
|
+
tonik-0.1.9.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
10
|
+
tonik-0.1.9.dist-info/entry_points.txt,sha256=VnGfC5qAzpntEHAb5pooUEpYABSgOfQoNhCEtLDJyf8,45
|
|
11
|
+
tonik-0.1.9.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
12
|
+
tonik-0.1.9.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|