tonik 0.1.8__tar.gz → 0.1.9__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.
- {tonik-0.1.8 → tonik-0.1.9}/.devcontainer/devcontainer.json +2 -0
- {tonik-0.1.8 → tonik-0.1.9}/PKG-INFO +1 -1
- {tonik-0.1.8 → tonik-0.1.9}/pyproject.toml +1 -1
- {tonik-0.1.8 → tonik-0.1.9}/src/tonik/api.py +9 -16
- {tonik-0.1.8 → tonik-0.1.9}/src/tonik/xarray2zarr.py +1 -1
- {tonik-0.1.8 → tonik-0.1.9}/.gitignore +0 -0
- {tonik-0.1.8 → tonik-0.1.9}/HOW_TO_RELEASE.md +0 -0
- {tonik-0.1.8 → tonik-0.1.9}/LICENSE +0 -0
- {tonik-0.1.8 → tonik-0.1.9}/README.md +0 -0
- {tonik-0.1.8 → tonik-0.1.9}/docs/index.md +0 -0
- {tonik-0.1.8 → tonik-0.1.9}/docs/tonik_example.ipynb +0 -0
- {tonik-0.1.8 → tonik-0.1.9}/mkdocs.yml +0 -0
- {tonik-0.1.8 → tonik-0.1.9}/src/tonik/__init__.py +0 -0
- {tonik-0.1.8 → tonik-0.1.9}/src/tonik/package_data/index.html +0 -0
- {tonik-0.1.8 → tonik-0.1.9}/src/tonik/storage.py +0 -0
- {tonik-0.1.8 → tonik-0.1.9}/src/tonik/utils.py +0 -0
- {tonik-0.1.8 → tonik-0.1.9}/src/tonik/xarray2netcdf.py +0 -0
- {tonik-0.1.8 → tonik-0.1.9}/tests/backend_speed_test.py +0 -0
- {tonik-0.1.8 → tonik-0.1.9}/tests/conftest.py +0 -0
- {tonik-0.1.8 → tonik-0.1.9}/tests/test_api.py +0 -0
- {tonik-0.1.8 → tonik-0.1.9}/tests/test_group.py +0 -0
- {tonik-0.1.8 → tonik-0.1.9}/tests/test_save.py +0 -0
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
"name": "Python 3",
|
|
5
5
|
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
|
|
6
6
|
"image": "mcr.microsoft.com/devcontainers/python:1-3.10-bullseye",
|
|
7
|
+
//"image": "mcr.microsoft.com/devcontainers/python:1-3.9-bullseye",
|
|
8
|
+
|
|
7
9
|
|
|
8
10
|
// Features to add to the dev container. More info: https://containers.dev/features.
|
|
9
11
|
// "features": {},
|
|
@@ -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
|
|
@@ -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)
|
|
@@ -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]:
|
|
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
|