tonik 0.1.4__py3-none-any.whl → 0.1.6__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 -2
- tonik/xarray2netcdf.py +5 -6
- {tonik-0.1.4.dist-info → tonik-0.1.6.dist-info}/METADATA +1 -1
- {tonik-0.1.4.dist-info → tonik-0.1.6.dist-info}/RECORD +7 -7
- {tonik-0.1.4.dist-info → tonik-0.1.6.dist-info}/WHEEL +0 -0
- {tonik-0.1.4.dist-info → tonik-0.1.6.dist-info}/entry_points.txt +0 -0
- {tonik-0.1.4.dist-info → tonik-0.1.6.dist-info}/licenses/LICENSE +0 -0
tonik/api.py
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
import os
|
|
3
|
+
import sys
|
|
3
4
|
from argparse import ArgumentParser
|
|
4
5
|
from datetime import datetime
|
|
5
|
-
from typing import Annotated
|
|
6
|
+
from typing import Annotated, List, Union
|
|
6
7
|
from urllib.parse import unquote
|
|
7
8
|
|
|
8
9
|
import datashader as dsh
|
|
@@ -19,6 +20,13 @@ from .storage import Storage
|
|
|
19
20
|
|
|
20
21
|
logger = logging.getLogger(__name__)
|
|
21
22
|
|
|
23
|
+
if sys.version_info >= (3, 10):
|
|
24
|
+
# For Python 3.10 and above, use the new union operator '|'
|
|
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()]
|
|
29
|
+
|
|
22
30
|
|
|
23
31
|
class TonikAPI:
|
|
24
32
|
|
|
@@ -62,7 +70,7 @@ class TonikAPI:
|
|
|
62
70
|
verticalres: int = 10,
|
|
63
71
|
log: bool = False,
|
|
64
72
|
normalise: bool = False,
|
|
65
|
-
subdir:
|
|
73
|
+
subdir: SubdirType = None):
|
|
66
74
|
_st = self.preprocess_datetime(starttime)
|
|
67
75
|
_et = self.preprocess_datetime(endtime)
|
|
68
76
|
g = Storage(group, rootdir=self.rootdir,
|
tonik/xarray2netcdf.py
CHANGED
|
@@ -91,7 +91,7 @@ def xarray2netcdf(xArray, fdir, group="original", timedim="datetime",
|
|
|
91
91
|
rootGrp.attrs['resolution'] = resolution
|
|
92
92
|
rootGrp.attrs['resolution_units'] = 'h'
|
|
93
93
|
try:
|
|
94
|
-
_setMetaInfo(featureName,
|
|
94
|
+
_setMetaInfo(featureName, rootGrp, xArray)
|
|
95
95
|
except KeyError as e:
|
|
96
96
|
logging.warning(
|
|
97
97
|
f"Could not set all meta info for {featureName}: {e}")
|
|
@@ -117,8 +117,7 @@ def _create_h5_Structure(defaultGroupName, featureName, h5f, xArray, starttime,
|
|
|
117
117
|
return rootGrp
|
|
118
118
|
|
|
119
119
|
|
|
120
|
-
def _setMetaInfo(featureName,
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
h5f.attrs['datatype'] = featureName
|
|
120
|
+
def _setMetaInfo(featureName, rootGrp, xArray):
|
|
121
|
+
for key, value in xArray.attrs.items():
|
|
122
|
+
rootGrp.attrs[key] = value
|
|
123
|
+
rootGrp.attrs['feature'] = featureName
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: tonik
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.6
|
|
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=MSSh6Cfh-rZeiQvW1DPT0V_ghlfosr97cHZVFuicQws,6768
|
|
3
3
|
tonik/storage.py,sha256=GNJ6w9VHOeTR_ZJMZ-Ipqe3nFK2I91fkHYwg1k9bEuo,9470
|
|
4
4
|
tonik/utils.py,sha256=3nSRU_GnV6arP4e63YHn4oEV8XbqzVAW8FCvQVIwGdg,2757
|
|
5
|
-
tonik/xarray2netcdf.py,sha256=
|
|
5
|
+
tonik/xarray2netcdf.py,sha256=RUsPwPDEOnUIMGt7_9F1VDyg83zu8x-Qs3jmZs3Dq0o,5173
|
|
6
6
|
tonik/xarray2zarr.py,sha256=EhEo5kqzrKyXR37RX2zYtgOAviZdRqstZi_4ZtUmSDc,2342
|
|
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.6.dist-info/METADATA,sha256=DaJTO28K1V3wWBWpKY922odCuB-Z9atSt52fI1bWL0I,1938
|
|
9
|
+
tonik-0.1.6.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
10
|
+
tonik-0.1.6.dist-info/entry_points.txt,sha256=VnGfC5qAzpntEHAb5pooUEpYABSgOfQoNhCEtLDJyf8,45
|
|
11
|
+
tonik-0.1.6.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
12
|
+
tonik-0.1.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|