tonik 0.1.16__py3-none-any.whl → 0.1.17__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 CHANGED
@@ -26,8 +26,9 @@ InventoryReturnType = Union[list, dict]
26
26
 
27
27
  class TonikAPI:
28
28
 
29
- def __init__(self, rootdir) -> None:
29
+ def __init__(self, rootdir, backend='netcdf') -> None:
30
30
  self.rootdir = rootdir
31
+ self.backend = backend
31
32
  self.app = FastAPI()
32
33
 
33
34
  # -- allow any origin to query API
@@ -72,7 +73,7 @@ class TonikAPI:
72
73
  _et = self.preprocess_datetime(endtime)
73
74
  g = Storage(group, rootdir=self.rootdir,
74
75
  starttime=_st, endtime=_et,
75
- create=False)
76
+ create=False, backend=self.backend)
76
77
  c = g
77
78
  if subdir:
78
79
  c = g.get_substore(*subdir)
@@ -147,7 +148,8 @@ class TonikAPI:
147
148
  return freq, dates, spec
148
149
 
149
150
  async def inventory(self, group: str, subdir: SubdirType = None, tree: bool = True) -> InventoryReturnType:
150
- sg = Storage(group, rootdir=self.rootdir, create=False)
151
+ sg = Storage(group, rootdir=self.rootdir,
152
+ create=False, backend=self.backend)
151
153
  try:
152
154
  c = sg.get_substore(*subdir)
153
155
  except TypeError:
@@ -168,7 +170,8 @@ class TonikAPI:
168
170
  _st = self.preprocess_datetime(starttime)
169
171
  _et = self.preprocess_datetime(endtime)
170
172
  sg = Storage(group, rootdir=self.rootdir,
171
- starttime=_st, endtime=_et, create=False)
173
+ starttime=_st, endtime=_et, create=False,
174
+ backend=self.backend)
172
175
  try:
173
176
  c = sg.get_substore(*subdir)
174
177
  except TypeError:
@@ -183,10 +186,11 @@ class TonikAPI:
183
186
  def main(argv=None):
184
187
  parser = ArgumentParser()
185
188
  parser.add_argument("--rootdir", default='/tmp')
189
+ parser.add_argument("--backend", default='netcdf')
186
190
  parser.add_argument("-p", "--port", default=8003, type=int)
187
191
  parser.add_argument("--host", default='0.0.0.0')
188
192
  args = parser.parse_args(argv)
189
- ta = TonikAPI(args.rootdir)
193
+ ta = TonikAPI(args.rootdir, backend=args.backend)
190
194
  uvicorn.run(ta.app, host=args.host, port=args.port)
191
195
 
192
196
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tonik
3
- Version: 0.1.16
3
+ Version: 0.1.17
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,5 +1,5 @@
1
1
  tonik/__init__.py,sha256=dov-nMeGFBzLspmj4rWKjC4r736vmaPDgMEkHSUfP98,523
2
- tonik/api.py,sha256=XDKiz1AzYNBOwYfaRxpMgqGRDAPJEE6wWJyBxuYPRLc,7751
2
+ tonik/api.py,sha256=vW0ykOo5iGAV0_WuOepdrnUyFp83F7KyJTd43ksLmUk,7985
3
3
  tonik/grafana_annotations.py,sha256=ZU9Cy-HT4vvMfYIQzD9WboaDVOCBDv__NmXbk1qKWJo,5838
4
4
  tonik/storage.py,sha256=vFxIrY92cSYOYOpNXHxCAjdXgkrRytaRDpudtK0glmg,10608
5
5
  tonik/utils.py,sha256=vRFMoCU7dbfnnm5RALBR-XrpPGDFtQoeTDzxFiYf3bo,7522
@@ -7,8 +7,8 @@ tonik/xarray2netcdf.py,sha256=gDNT6nxnRbXPeRqZ3URW5oXY3Nfh3TCrfueE-eUrIoY,5181
7
7
  tonik/xarray2zarr.py,sha256=SSchDqy5oyYrIG4smV8fslsUg2UPSyyQjUA5ZlP1P4I,8630
8
8
  tonik/package_data/index.html,sha256=ZCZ-BtGRERsL-6c_dfY43qd2WAaggH7xereennGL6ww,4372
9
9
  tonik/package_data/whakaari_labels.json,sha256=96UZSq41yXgAJxuKivLBKlRTw-33jkjh7AGKTsDQ9Yg,3993
10
- tonik-0.1.16.dist-info/METADATA,sha256=EOwmXNC5b6IJsnTLMelBZ3vL1ljkfZwhM8Hoz6iHiZQ,2191
11
- tonik-0.1.16.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
12
- tonik-0.1.16.dist-info/entry_points.txt,sha256=y82XyTeQddM87gCTzgSQaTlKF3VFicO4hhClHUv6j1A,127
13
- tonik-0.1.16.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
14
- tonik-0.1.16.dist-info/RECORD,,
10
+ tonik-0.1.17.dist-info/METADATA,sha256=60njnchH8FlSErynrCQRngfglFVTMh_uOKhoaX6aNNg,2191
11
+ tonik-0.1.17.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
12
+ tonik-0.1.17.dist-info/entry_points.txt,sha256=y82XyTeQddM87gCTzgSQaTlKF3VFicO4hhClHUv6j1A,127
13
+ tonik-0.1.17.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
14
+ tonik-0.1.17.dist-info/RECORD,,
File without changes