tonik 0.1.14__tar.gz → 0.1.15__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.
Files changed (33) hide show
  1. {tonik-0.1.14 → tonik-0.1.15}/.pytest_cache/v/cache/nodeids +1 -0
  2. {tonik-0.1.14 → tonik-0.1.15}/PKG-INFO +1 -1
  3. {tonik-0.1.14 → tonik-0.1.15}/pyproject.toml +1 -1
  4. {tonik-0.1.14 → tonik-0.1.15}/src/tonik/storage.py +7 -3
  5. {tonik-0.1.14 → tonik-0.1.15}/tests/test_storage.py +11 -0
  6. {tonik-0.1.14 → tonik-0.1.15}/.devcontainer/devcontainer.json +0 -0
  7. {tonik-0.1.14 → tonik-0.1.15}/.gitignore +0 -0
  8. {tonik-0.1.14 → tonik-0.1.15}/.pytest_cache/CACHEDIR.TAG +0 -0
  9. {tonik-0.1.14 → tonik-0.1.15}/.pytest_cache/README.md +0 -0
  10. {tonik-0.1.14 → tonik-0.1.15}/.pytest_cache/v/cache/lastfailed +0 -0
  11. {tonik-0.1.14 → tonik-0.1.15}/.pytest_cache/v/cache/stepwise +0 -0
  12. {tonik-0.1.14 → tonik-0.1.15}/HOW_TO_RELEASE.md +0 -0
  13. {tonik-0.1.14 → tonik-0.1.15}/LICENSE +0 -0
  14. {tonik-0.1.14 → tonik-0.1.15}/README.md +0 -0
  15. {tonik-0.1.14 → tonik-0.1.15}/grafana_example/Dockerfile_api +0 -0
  16. {tonik-0.1.14 → tonik-0.1.15}/grafana_example/Dockerfile_grafana +0 -0
  17. {tonik-0.1.14 → tonik-0.1.15}/grafana_example/dashboards/demo_dashboard.json +0 -0
  18. {tonik-0.1.14 → tonik-0.1.15}/grafana_example/docker-compose.yml +0 -0
  19. {tonik-0.1.14 → tonik-0.1.15}/grafana_example/grafana.ini +0 -0
  20. {tonik-0.1.14 → tonik-0.1.15}/grafana_example/provisioning/dashboards/default.yaml +0 -0
  21. {tonik-0.1.14 → tonik-0.1.15}/grafana_example/provisioning/datasources/default.yaml +0 -0
  22. {tonik-0.1.14 → tonik-0.1.15}/mkdocs.yml +0 -0
  23. {tonik-0.1.14 → tonik-0.1.15}/src/tonik/__init__.py +0 -0
  24. {tonik-0.1.14 → tonik-0.1.15}/src/tonik/api.py +0 -0
  25. {tonik-0.1.14 → tonik-0.1.15}/src/tonik/package_data/index.html +0 -0
  26. {tonik-0.1.14 → tonik-0.1.15}/src/tonik/utils.py +0 -0
  27. {tonik-0.1.14 → tonik-0.1.15}/src/tonik/xarray2netcdf.py +0 -0
  28. {tonik-0.1.14 → tonik-0.1.15}/src/tonik/xarray2zarr.py +0 -0
  29. {tonik-0.1.14 → tonik-0.1.15}/tests/backend_speed_test.py +0 -0
  30. {tonik-0.1.14 → tonik-0.1.15}/tests/conftest.py +0 -0
  31. {tonik-0.1.14 → tonik-0.1.15}/tests/test_api.py +0 -0
  32. {tonik-0.1.14 → tonik-0.1.15}/tests/test_save.py +0 -0
  33. {tonik-0.1.14 → tonik-0.1.15}/tests/test_utils.py +0 -0
@@ -17719,6 +17719,7 @@
17719
17719
  "tests/test_save.py::test_xarray2zarr_with_overlaps",
17720
17720
  "tests/test_save.py::test_xarray2zarr_with_overlaps_1D",
17721
17721
  "tests/test_save.py::test_xarray2zarr_with_overlaps_2D",
17722
+ "tests/test_storage.py::test_attributes_only",
17722
17723
  "tests/test_storage.py::test_call_multiple_days",
17723
17724
  "tests/test_storage.py::test_call_single_datapoint",
17724
17725
  "tests/test_storage.py::test_call_single_day",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tonik
3
- Version: 0.1.14
3
+ Version: 0.1.15
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
@@ -12,7 +12,7 @@ exclude = [
12
12
 
13
13
  [project]
14
14
  name = "tonik"
15
- version = "0.1.14"
15
+ version = "0.1.15"
16
16
  authors = [
17
17
  { name="Yannik Behr", email="y.behr@gns.cri.nz" },
18
18
  { name="Christof Mueller", email="c.mueller@gns.cri.nz" }
@@ -112,7 +112,7 @@ class Path(object):
112
112
  self.children[feature] = Path(feature + file_ending, self.path)
113
113
  return _feature_path
114
114
 
115
- def __call__(self, feature, group='original'):
115
+ def __call__(self, feature, group='original', attributes_only=False):
116
116
  """
117
117
  Request a particular feature
118
118
 
@@ -120,11 +120,15 @@ class Path(object):
120
120
  :type feature: str
121
121
 
122
122
  """
123
+ filename = self.feature_path(feature)
124
+
125
+ if attributes_only:
126
+ with xr.open_dataset(filename, group=group, engine=self.engine) as ds:
127
+ return ds.attrs
128
+
123
129
  if self.endtime < self.starttime:
124
130
  raise ValueError('Startime has to be smaller than endtime.')
125
131
 
126
- filename = self.feature_path(feature)
127
-
128
132
  logger.debug(
129
133
  f"Reading feature {feature} between {self.starttime} and {self.endtime}")
130
134
 
@@ -181,3 +181,14 @@ def test_labels(tmp_path_factory):
181
181
  assert 'description' in labels['rsam'][0]
182
182
  assert 'tags' in labels['rsam'][0]
183
183
  assert 'id' in labels['rsam'][0]
184
+
185
+
186
+ def test_attributes_only(tmp_path_factory):
187
+ rootdir = tmp_path_factory.mktemp('data')
188
+ g = Storage('volcanoes', rootdir=rootdir)
189
+ tstart = datetime(2016, 1, 1)
190
+ xdf = generate_test_data(dim=1, intervals=20, tstart=tstart)
191
+ g.save(xdf, mode='w', archive_starttime=tstart)
192
+ ret = g('rsam', attributes_only=True)
193
+ assert isinstance(ret, dict)
194
+ assert len(ret.keys()) == 8
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