tonik 0.1.4__tar.gz → 0.1.5__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.4 → tonik-0.1.5}/PKG-INFO +1 -1
- {tonik-0.1.4 → tonik-0.1.5}/pyproject.toml +1 -1
- {tonik-0.1.4 → tonik-0.1.5}/src/tonik/xarray2netcdf.py +5 -6
- {tonik-0.1.4 → tonik-0.1.5}/tests/test_save.py +16 -0
- {tonik-0.1.4 → tonik-0.1.5}/.devcontainer/devcontainer.json +0 -0
- {tonik-0.1.4 → tonik-0.1.5}/.gitignore +0 -0
- {tonik-0.1.4 → tonik-0.1.5}/HOW_TO_RELEASE.md +0 -0
- {tonik-0.1.4 → tonik-0.1.5}/LICENSE +0 -0
- {tonik-0.1.4 → tonik-0.1.5}/README.md +0 -0
- {tonik-0.1.4 → tonik-0.1.5}/docs/index.md +0 -0
- {tonik-0.1.4 → tonik-0.1.5}/docs/tonik_example.ipynb +0 -0
- {tonik-0.1.4 → tonik-0.1.5}/mkdocs.yml +0 -0
- {tonik-0.1.4 → tonik-0.1.5}/src/tonik/__init__.py +0 -0
- {tonik-0.1.4 → tonik-0.1.5}/src/tonik/api.py +0 -0
- {tonik-0.1.4 → tonik-0.1.5}/src/tonik/package_data/index.html +0 -0
- {tonik-0.1.4 → tonik-0.1.5}/src/tonik/storage.py +0 -0
- {tonik-0.1.4 → tonik-0.1.5}/src/tonik/utils.py +0 -0
- {tonik-0.1.4 → tonik-0.1.5}/src/tonik/xarray2zarr.py +0 -0
- {tonik-0.1.4 → tonik-0.1.5}/tests/backend_speed_test.py +0 -0
- {tonik-0.1.4 → tonik-0.1.5}/tests/conftest.py +0 -0
- {tonik-0.1.4 → tonik-0.1.5}/tests/test_api.py +0 -0
- {tonik-0.1.4 → tonik-0.1.5}/tests/test_group.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: tonik
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.5
|
|
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
|
|
@@ -91,7 +91,7 @@ def xarray2netcdf(xArray, fdir, group="original", timedim="datetime",
|
|
|
91
91
|
rootGrp.attrs['resolution'] = resolution
|
|
92
92
|
rootGrp.attrs['resolution_units'] = 'h'
|
|
93
93
|
try:
|
|
94
|
-
_setMetaInfo(featureName,
|
|
94
|
+
_setMetaInfo(featureName, rootGrp, xArray)
|
|
95
95
|
except KeyError as e:
|
|
96
96
|
logging.warning(
|
|
97
97
|
f"Could not set all meta info for {featureName}: {e}")
|
|
@@ -117,8 +117,7 @@ def _create_h5_Structure(defaultGroupName, featureName, h5f, xArray, starttime,
|
|
|
117
117
|
return rootGrp
|
|
118
118
|
|
|
119
119
|
|
|
120
|
-
def _setMetaInfo(featureName,
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
h5f.attrs['datatype'] = featureName
|
|
120
|
+
def _setMetaInfo(featureName, rootGrp, xArray):
|
|
121
|
+
for key, value in xArray.attrs.items():
|
|
122
|
+
rootGrp.attrs[key] = value
|
|
123
|
+
rootGrp.attrs['feature'] = featureName
|
|
@@ -89,6 +89,22 @@ def test_xarray2netcdf_resolution(tmp_path_factory):
|
|
|
89
89
|
assert xdf_test.attrs['resolution_units'] == 'h'
|
|
90
90
|
|
|
91
91
|
|
|
92
|
+
def test_xarray2netcdf_attributes(tmp_path_factory):
|
|
93
|
+
starttime = datetime(2022, 7, 18, 0, 0, 0)
|
|
94
|
+
xdf = generate_test_data(dim=1, ndays=1, tstart=starttime,
|
|
95
|
+
add_nans=False)
|
|
96
|
+
temp_dir = tmp_path_factory.mktemp('test_xarray2netcdf')
|
|
97
|
+
g = Storage('test_experiment', rootdir=temp_dir,
|
|
98
|
+
starttime=datetime(2000, 1, 1),
|
|
99
|
+
endtime=datetime.fromisoformat(xdf.attrs['endtime']),
|
|
100
|
+
backend='netcdf')
|
|
101
|
+
c = g.get_substore('MDR', '00', 'HHZ')
|
|
102
|
+
c.save(xdf, archive_starttime=starttime)
|
|
103
|
+
xdf_test = c('rsam')
|
|
104
|
+
assert xdf_test.attrs['station'] == xdf.attrs['station']
|
|
105
|
+
assert xdf_test.attrs['feature'] == 'rsam'
|
|
106
|
+
|
|
107
|
+
|
|
92
108
|
def test_xarray2netcdf_with_gaps(tmp_path_factory):
|
|
93
109
|
"""
|
|
94
110
|
Test writing xarray data to hdf5 with gaps.
|
|
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
|
|
File without changes
|