tonik 0.1.8__py3-none-any.whl → 0.1.10__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 +12 -17
- tonik/xarray2zarr.py +1 -1
- {tonik-0.1.8.dist-info → tonik-0.1.10.dist-info}/METADATA +2 -2
- tonik-0.1.10.dist-info/RECORD +12 -0
- tonik-0.1.8.dist-info/RECORD +0 -12
- {tonik-0.1.8.dist-info → tonik-0.1.10.dist-info}/WHEEL +0 -0
- {tonik-0.1.8.dist-info → tonik-0.1.10.dist-info}/entry_points.txt +0 -0
- {tonik-0.1.8.dist-info → tonik-0.1.10.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,14 +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
|
-
InventoryReturnType = list | dict
|
|
27
|
-
else:
|
|
28
|
-
# For Python 3.9 and below, use Union from typing
|
|
29
|
-
SubdirType = Annotated[Union[List[str], None], Query()]
|
|
30
|
-
InventoryReturnType = Union[list, dict]
|
|
23
|
+
SubdirType = Annotated[Union[List[str], None], Query()]
|
|
24
|
+
InventoryReturnType = Union[list, dict]
|
|
31
25
|
|
|
32
26
|
|
|
33
27
|
class TonikAPI:
|
|
@@ -66,21 +60,20 @@ class TonikAPI:
|
|
|
66
60
|
def feature(self,
|
|
67
61
|
group: str,
|
|
68
62
|
name: str,
|
|
69
|
-
starttime: str
|
|
70
|
-
endtime: str
|
|
63
|
+
starttime: Union[str, None],
|
|
64
|
+
endtime: Union[str, None],
|
|
65
|
+
subdir: SubdirType = None,
|
|
71
66
|
resolution: str = 'full',
|
|
72
67
|
verticalres: int = 10,
|
|
73
68
|
log: bool = False,
|
|
74
|
-
normalise: bool = False
|
|
75
|
-
subdir: SubdirType = None):
|
|
69
|
+
normalise: bool = False):
|
|
76
70
|
_st = self.preprocess_datetime(starttime)
|
|
77
71
|
_et = self.preprocess_datetime(endtime)
|
|
78
72
|
g = Storage(group, rootdir=self.rootdir,
|
|
79
73
|
starttime=_st, endtime=_et,
|
|
80
74
|
create=False)
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
else:
|
|
75
|
+
c = g
|
|
76
|
+
if subdir:
|
|
84
77
|
c = g.get_substore(*subdir)
|
|
85
78
|
try:
|
|
86
79
|
feat = c(name)
|
|
@@ -169,9 +162,11 @@ class TonikAPI:
|
|
|
169
162
|
def main(argv=None):
|
|
170
163
|
parser = ArgumentParser()
|
|
171
164
|
parser.add_argument("--rootdir", default='/tmp')
|
|
165
|
+
parser.add_argument("-p", "--port", default=8003, type=int)
|
|
166
|
+
parser.add_argument("--host", default='0.0.0.0')
|
|
172
167
|
args = parser.parse_args(argv)
|
|
173
168
|
ta = TonikAPI(args.rootdir)
|
|
174
|
-
uvicorn.run(ta.app, host=
|
|
169
|
+
uvicorn.run(ta.app, host=args.host, port=args.port)
|
|
175
170
|
|
|
176
171
|
|
|
177
172
|
if __name__ == "__main__":
|
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.10
|
|
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
|
|
@@ -11,7 +11,7 @@ Classifier: Operating System :: OS Independent
|
|
|
11
11
|
Classifier: Programming Language :: Python :: 3
|
|
12
12
|
Requires-Python: >=3.7
|
|
13
13
|
Requires-Dist: datashader>=0.14
|
|
14
|
-
Requires-Dist: fastapi>=0.
|
|
14
|
+
Requires-Dist: fastapi>=0.112
|
|
15
15
|
Requires-Dist: h5netcdf>=1.1
|
|
16
16
|
Requires-Dist: h5py>=3.8
|
|
17
17
|
Requires-Dist: matplotlib
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
tonik/__init__.py,sha256=ZBVGh4dm_l9xwiBGb33O5QV9MfZeNiEd3DBDAm6DiHk,511
|
|
2
|
+
tonik/api.py,sha256=JaKHzavqYDjZo2DypTHgAaM01Y4EOkn6UF3ZVm50F5k,6694
|
|
3
|
+
tonik/storage.py,sha256=GNJ6w9VHOeTR_ZJMZ-Ipqe3nFK2I91fkHYwg1k9bEuo,9470
|
|
4
|
+
tonik/utils.py,sha256=3nSRU_GnV6arP4e63YHn4oEV8XbqzVAW8FCvQVIwGdg,2757
|
|
5
|
+
tonik/xarray2netcdf.py,sha256=RUsPwPDEOnUIMGt7_9F1VDyg83zu8x-Qs3jmZs3Dq0o,5173
|
|
6
|
+
tonik/xarray2zarr.py,sha256=xJjKcFZF0oz6gw47apuCiXFtW5HgWqnZgiIuEVQHhBI,2363
|
|
7
|
+
tonik/package_data/index.html,sha256=GKDClUhIam_fAYbNfzAolORhSCG3ae1wW3VjWCg4PMk,2732
|
|
8
|
+
tonik-0.1.10.dist-info/METADATA,sha256=gDvofXsP2pnRFDcwYzCd67dZ6BC0GGBDtdC_sn71k7o,1940
|
|
9
|
+
tonik-0.1.10.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
10
|
+
tonik-0.1.10.dist-info/entry_points.txt,sha256=VnGfC5qAzpntEHAb5pooUEpYABSgOfQoNhCEtLDJyf8,45
|
|
11
|
+
tonik-0.1.10.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
12
|
+
tonik-0.1.10.dist-info/RECORD,,
|
tonik-0.1.8.dist-info/RECORD
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
tonik/__init__.py,sha256=ZBVGh4dm_l9xwiBGb33O5QV9MfZeNiEd3DBDAm6DiHk,511
|
|
2
|
-
tonik/api.py,sha256=l9_F0ioK9n7UbKpGJKbJts-xwkFC4GBv10R2qLS6Du8,6832
|
|
3
|
-
tonik/storage.py,sha256=GNJ6w9VHOeTR_ZJMZ-Ipqe3nFK2I91fkHYwg1k9bEuo,9470
|
|
4
|
-
tonik/utils.py,sha256=3nSRU_GnV6arP4e63YHn4oEV8XbqzVAW8FCvQVIwGdg,2757
|
|
5
|
-
tonik/xarray2netcdf.py,sha256=RUsPwPDEOnUIMGt7_9F1VDyg83zu8x-Qs3jmZs3Dq0o,5173
|
|
6
|
-
tonik/xarray2zarr.py,sha256=EhEo5kqzrKyXR37RX2zYtgOAviZdRqstZi_4ZtUmSDc,2342
|
|
7
|
-
tonik/package_data/index.html,sha256=GKDClUhIam_fAYbNfzAolORhSCG3ae1wW3VjWCg4PMk,2732
|
|
8
|
-
tonik-0.1.8.dist-info/METADATA,sha256=po93NQ8aYXBg6mGARBTPO1r1qq8_gsl8slfsyaC1rZM,1938
|
|
9
|
-
tonik-0.1.8.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
10
|
-
tonik-0.1.8.dist-info/entry_points.txt,sha256=VnGfC5qAzpntEHAb5pooUEpYABSgOfQoNhCEtLDJyf8,45
|
|
11
|
-
tonik-0.1.8.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
12
|
-
tonik-0.1.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|