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.
@@ -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.8
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
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "tonik"
7
- version = "0.1.8"
7
+ version = "0.1.9"
8
8
  authors = [
9
9
  { name="Yannik Behr", email="y.behr@gns.cri.nz" },
10
10
  { name="Christof Mueller", email="c.mueller@gns.cri.nz" }
@@ -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
- 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
- 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 = None,
70
- endtime: str = None,
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
- if subdir is None:
82
- c = g
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