tonik 0.1.20__py3-none-any.whl → 0.1.21__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/storage.py +1 -1
- tonik/xarray2zarr.py +9 -3
- {tonik-0.1.20.dist-info → tonik-0.1.21.dist-info}/METADATA +1 -1
- {tonik-0.1.20.dist-info → tonik-0.1.21.dist-info}/RECORD +7 -7
- {tonik-0.1.20.dist-info → tonik-0.1.21.dist-info}/WHEEL +0 -0
- {tonik-0.1.20.dist-info → tonik-0.1.21.dist-info}/entry_points.txt +0 -0
- {tonik-0.1.20.dist-info → tonik-0.1.21.dist-info}/licenses/LICENSE +0 -0
tonik/storage.py
CHANGED
|
@@ -18,7 +18,7 @@ LOGGING_CONFIG = {
|
|
|
18
18
|
"datefmt": "%Y-%m-%d %H:%M:%S", # How to display dates
|
|
19
19
|
},
|
|
20
20
|
"json": { # The formatter name
|
|
21
|
-
"()": "pythonjsonlogger.
|
|
21
|
+
"()": "pythonjsonlogger.json.JsonFormatter", # The class to instantiate!
|
|
22
22
|
# Json is more complex, but easier to read, display all attributes!
|
|
23
23
|
"format": """
|
|
24
24
|
asctime: %(asctime)s
|
tonik/xarray2zarr.py
CHANGED
|
@@ -267,7 +267,7 @@ def xarray2zarr(xds: xr.Dataset, path: str, mode: str = 'a', group='original',
|
|
|
267
267
|
continue
|
|
268
268
|
|
|
269
269
|
if xds_existing[timedim][0] > xds[timedim][-1]:
|
|
270
|
-
|
|
270
|
+
logger.debug("Prepending data to existing zarr store.")
|
|
271
271
|
xda_new = fill_time_gaps_between_datasets(xds_existing[feature].isel({timedim: 0}),
|
|
272
272
|
xds[feature], mode='p')
|
|
273
273
|
xda_new = _build_append_payload_full_chunks(
|
|
@@ -277,7 +277,7 @@ def xarray2zarr(xds: xr.Dataset, path: str, mode: str = 'a', group='original',
|
|
|
277
277
|
write_empty_chunks=True)
|
|
278
278
|
|
|
279
279
|
elif xds_existing[timedim][-1] < xds[timedim][0]:
|
|
280
|
-
|
|
280
|
+
logger.debug("Appending data to existing zarr store.")
|
|
281
281
|
xda_new = fill_time_gaps_between_datasets(xds_existing[feature].isel({timedim: -1}),
|
|
282
282
|
xds[feature], mode='a')
|
|
283
283
|
xda_new = _build_append_payload_full_chunks(
|
|
@@ -286,13 +286,19 @@ def xarray2zarr(xds: xr.Dataset, path: str, mode: str = 'a', group='original',
|
|
|
286
286
|
append_dim=timedim)
|
|
287
287
|
|
|
288
288
|
elif xds_existing[timedim][0] > xds[timedim][0] and xds_existing[timedim][-1] < xds[timedim][-1]:
|
|
289
|
-
|
|
289
|
+
logger.debug(
|
|
290
|
+
"Data in zarr store contained in new data. Rewriting zarr store.")
|
|
290
291
|
xda_new = _build_append_payload_full_chunks(
|
|
291
292
|
xds[feature], 'a', nchunks)
|
|
292
293
|
xda_new.to_zarr(fout, group=group, mode='w',
|
|
293
294
|
write_empty_chunks=True)
|
|
294
295
|
|
|
295
296
|
else:
|
|
297
|
+
logger.debug("Data in zarr store overlaps with new data.")
|
|
298
|
+
logger.debug(
|
|
299
|
+
f"Endtime of existing data: {xds_existing[timedim][-1].values}")
|
|
300
|
+
logger.debug(f"Starttime of new data: {xds[timedim][0].values}")
|
|
301
|
+
xds_existing = xds_existing.drop_duplicates(timedim, keep='last')
|
|
296
302
|
overlap = xds_existing[timedim].where(
|
|
297
303
|
xds_existing[timedim] == xds[timedim])
|
|
298
304
|
xds[feature].loc[{timedim: overlap}].to_zarr(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tonik
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.21
|
|
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,14 +1,14 @@
|
|
|
1
1
|
tonik/__init__.py,sha256=dov-nMeGFBzLspmj4rWKjC4r736vmaPDgMEkHSUfP98,523
|
|
2
2
|
tonik/api.py,sha256=vW0ykOo5iGAV0_WuOepdrnUyFp83F7KyJTd43ksLmUk,7985
|
|
3
3
|
tonik/grafana_annotations.py,sha256=ZU9Cy-HT4vvMfYIQzD9WboaDVOCBDv__NmXbk1qKWJo,5838
|
|
4
|
-
tonik/storage.py,sha256=
|
|
4
|
+
tonik/storage.py,sha256=bYBl3JPpH8D3iIFOj5AZQXc4M8txAbwFKt4xTfdotgg,10583
|
|
5
5
|
tonik/utils.py,sha256=GwAXfGFQWhlsLThQvSux1SooRkW-iIkJP99JMH72t5Y,11791
|
|
6
6
|
tonik/xarray2netcdf.py,sha256=nq6RHk5ciaAg1bxNDiyHPRdAts1C7fj7jtDbaLaSTWM,6497
|
|
7
|
-
tonik/xarray2zarr.py,sha256=
|
|
7
|
+
tonik/xarray2zarr.py,sha256=kRhgDdo8CDT1ceszwQEQNfXdgbnmL5nNejUzaMnyFXM,11707
|
|
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.
|
|
11
|
-
tonik-0.1.
|
|
12
|
-
tonik-0.1.
|
|
13
|
-
tonik-0.1.
|
|
14
|
-
tonik-0.1.
|
|
10
|
+
tonik-0.1.21.dist-info/METADATA,sha256=rEp5KTN5xDizNLajJkP3i6lvGI02hrR-sqqfIRfn4M0,2207
|
|
11
|
+
tonik-0.1.21.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
12
|
+
tonik-0.1.21.dist-info/entry_points.txt,sha256=y82XyTeQddM87gCTzgSQaTlKF3VFicO4hhClHUv6j1A,127
|
|
13
|
+
tonik-0.1.21.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
14
|
+
tonik-0.1.21.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|