h5netcdf 1.7.0__tar.gz → 1.7.2__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.
Potentially problematic release.
This version of h5netcdf might be problematic. Click here for more details.
- {h5netcdf-1.7.0 → h5netcdf-1.7.2}/CHANGELOG.rst +11 -0
- {h5netcdf-1.7.0 → h5netcdf-1.7.2}/PKG-INFO +1 -1
- {h5netcdf-1.7.0 → h5netcdf-1.7.2}/h5netcdf/_version.py +3 -3
- {h5netcdf-1.7.0 → h5netcdf-1.7.2}/h5netcdf/attrs.py +4 -3
- {h5netcdf-1.7.0 → h5netcdf-1.7.2}/h5netcdf/core.py +3 -7
- {h5netcdf-1.7.0 → h5netcdf-1.7.2}/h5netcdf/dimensions.py +15 -9
- {h5netcdf-1.7.0 → h5netcdf-1.7.2}/h5netcdf/tests/test_h5netcdf.py +43 -2
- {h5netcdf-1.7.0 → h5netcdf-1.7.2}/h5netcdf.egg-info/PKG-INFO +1 -1
- {h5netcdf-1.7.0 → h5netcdf-1.7.2}/.pre-commit-config.yaml +0 -0
- {h5netcdf-1.7.0 → h5netcdf-1.7.2}/AUTHORS.txt +0 -0
- {h5netcdf-1.7.0 → h5netcdf-1.7.2}/LICENSE +0 -0
- {h5netcdf-1.7.0 → h5netcdf-1.7.2}/README.rst +0 -0
- {h5netcdf-1.7.0 → h5netcdf-1.7.2}/doc/Makefile +0 -0
- {h5netcdf-1.7.0 → h5netcdf-1.7.2}/doc/api.rst +0 -0
- {h5netcdf-1.7.0 → h5netcdf-1.7.2}/doc/changelog.rst +0 -0
- {h5netcdf-1.7.0 → h5netcdf-1.7.2}/doc/conf.py +0 -0
- {h5netcdf-1.7.0 → h5netcdf-1.7.2}/doc/devguide.rst +0 -0
- {h5netcdf-1.7.0 → h5netcdf-1.7.2}/doc/feature.rst +0 -0
- {h5netcdf-1.7.0 → h5netcdf-1.7.2}/doc/index.rst +0 -0
- {h5netcdf-1.7.0 → h5netcdf-1.7.2}/doc/legacyapi.rst +0 -0
- {h5netcdf-1.7.0 → h5netcdf-1.7.2}/h5netcdf/__init__.py +0 -0
- {h5netcdf-1.7.0 → h5netcdf-1.7.2}/h5netcdf/legacyapi.py +0 -0
- {h5netcdf-1.7.0 → h5netcdf-1.7.2}/h5netcdf/tests/conftest.py +0 -0
- {h5netcdf-1.7.0 → h5netcdf-1.7.2}/h5netcdf/tests/pytest.ini +0 -0
- {h5netcdf-1.7.0 → h5netcdf-1.7.2}/h5netcdf/utils.py +0 -0
- {h5netcdf-1.7.0 → h5netcdf-1.7.2}/h5netcdf.egg-info/SOURCES.txt +0 -0
- {h5netcdf-1.7.0 → h5netcdf-1.7.2}/h5netcdf.egg-info/dependency_links.txt +0 -0
- {h5netcdf-1.7.0 → h5netcdf-1.7.2}/h5netcdf.egg-info/requires.txt +0 -0
- {h5netcdf-1.7.0 → h5netcdf-1.7.2}/h5netcdf.egg-info/top_level.txt +0 -0
- {h5netcdf-1.7.0 → h5netcdf-1.7.2}/licenses/H5PY_LICENSE.txt +0 -0
- {h5netcdf-1.7.0 → h5netcdf-1.7.2}/licenses/PSF_LICENSE.txt +0 -0
- {h5netcdf-1.7.0 → h5netcdf-1.7.2}/pyproject.toml +0 -0
- {h5netcdf-1.7.0 → h5netcdf-1.7.2}/setup.cfg +0 -0
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
Change Log
|
|
2
2
|
----------
|
|
3
3
|
|
|
4
|
+
Version 1.7.2 (October 17th, 2025):
|
|
5
|
+
|
|
6
|
+
- Fix regression where format was requested from group instance instead of _root. Simplify logic to check and raise ``CompatibilityError``. (:issue:`293`, :pull:`294`).
|
|
7
|
+
By `Kai Mühlbauer <https://github.com/kmuehlbauer>`_
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
Version 1.7.1 (October 16th, 2025):
|
|
11
|
+
|
|
12
|
+
- Fix regression where attributes with list of strings were written with h5py low-level API instead of high-level API (:issue:`291`, :pull:`292`).
|
|
13
|
+
By `Kai Mühlbauer <https://github.com/kmuehlbauer>`_
|
|
14
|
+
|
|
4
15
|
Version 1.7.0 (October 15th, 2025):
|
|
5
16
|
|
|
6
17
|
- Fix unintentional changes in test suite (:pull:`277`).
|
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
|
28
28
|
commit_id: COMMIT_ID
|
|
29
29
|
__commit_id__: COMMIT_ID
|
|
30
30
|
|
|
31
|
-
__version__ = version = '1.7.
|
|
32
|
-
__version_tuple__ = version_tuple = (1, 7,
|
|
31
|
+
__version__ = version = '1.7.2'
|
|
32
|
+
__version_tuple__ = version_tuple = (1, 7, 2)
|
|
33
33
|
|
|
34
|
-
__commit_id__ = commit_id = '
|
|
34
|
+
__commit_id__ = commit_id = 'g0a7fc48ba'
|
|
@@ -87,10 +87,11 @@ class Attributes(MutableMapping):
|
|
|
87
87
|
|
|
88
88
|
self._check_dtype(dtype)
|
|
89
89
|
|
|
90
|
+
is_plain_string = dtype.kind in {"S", "U"} and dtype.metadata is None
|
|
90
91
|
if (
|
|
91
|
-
|
|
92
|
-
and
|
|
93
|
-
and not isinstance(value,
|
|
92
|
+
is_plain_string # for simple strings
|
|
93
|
+
and (not isinstance(value, list) and self._format == "NETCDF4_CLASSIC")
|
|
94
|
+
and not isinstance(value, self._h5py.Empty)
|
|
94
95
|
and self._h5py.__name__ == "h5py"
|
|
95
96
|
):
|
|
96
97
|
# create with low level API to get fixed length strings
|
|
@@ -12,7 +12,7 @@ from packaging import version
|
|
|
12
12
|
|
|
13
13
|
from . import __version__
|
|
14
14
|
from .attrs import Attributes
|
|
15
|
-
from .dimensions import Dimension, Dimensions
|
|
15
|
+
from .dimensions import Dimension, Dimensions, _check_classic_unlimited
|
|
16
16
|
from .utils import (
|
|
17
17
|
CompatibilityError,
|
|
18
18
|
Frozen,
|
|
@@ -1030,12 +1030,8 @@ class Group(Mapping):
|
|
|
1030
1030
|
|
|
1031
1031
|
@dimensions.setter
|
|
1032
1032
|
def dimensions(self, value):
|
|
1033
|
-
if self._format == "NETCDF4_CLASSIC":
|
|
1034
|
-
|
|
1035
|
-
if len(unlimited_dims) > 1:
|
|
1036
|
-
raise CompatibilityError(
|
|
1037
|
-
"NETCDF4_CLASSIC format only allows one unlimited dimension."
|
|
1038
|
-
)
|
|
1033
|
+
if self._root._format == "NETCDF4_CLASSIC":
|
|
1034
|
+
_check_classic_unlimited(value)
|
|
1039
1035
|
|
|
1040
1036
|
for k, v in self._all_dimensions.maps[0].items():
|
|
1041
1037
|
if k in value:
|
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
import weakref
|
|
2
2
|
from collections import OrderedDict
|
|
3
|
-
from collections.abc import MutableMapping
|
|
3
|
+
from collections.abc import Mapping, MutableMapping
|
|
4
4
|
|
|
5
5
|
import numpy as np
|
|
6
6
|
|
|
7
7
|
from .utils import CompatibilityError
|
|
8
8
|
|
|
9
9
|
|
|
10
|
+
def _check_classic_unlimited(value, unlimited=None):
|
|
11
|
+
if isinstance(value, Mapping):
|
|
12
|
+
multiple_unlimited_dimensions = sum(v in (None, 0) for v in value.values()) > 1
|
|
13
|
+
else:
|
|
14
|
+
multiple_unlimited_dimensions = unlimited and value in (None, 0)
|
|
15
|
+
|
|
16
|
+
if multiple_unlimited_dimensions:
|
|
17
|
+
raise CompatibilityError(
|
|
18
|
+
"Only one unlimited dimension allowed in the NETCDF4_CLASSIC format."
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
|
|
10
22
|
class Dimensions(MutableMapping):
|
|
11
23
|
def __init__(self, group):
|
|
12
24
|
self._group_ref = weakref.ref(group)
|
|
@@ -25,14 +37,8 @@ class Dimensions(MutableMapping):
|
|
|
25
37
|
raise RuntimeError("H5NetCDF: Write to read only")
|
|
26
38
|
if name in self._objects:
|
|
27
39
|
raise ValueError(f"dimension {name!r} already exists")
|
|
28
|
-
if
|
|
29
|
-
size
|
|
30
|
-
and self._unlimited()
|
|
31
|
-
and self._group._format == "NETCDF4_CLASSIC"
|
|
32
|
-
):
|
|
33
|
-
raise CompatibilityError(
|
|
34
|
-
"Only one unlimited dimension allowed in the NETCDF4_CLASSIC format."
|
|
35
|
-
)
|
|
40
|
+
if self._group._root._format == "NETCDF4_CLASSIC":
|
|
41
|
+
_check_classic_unlimited(size, self._unlimited())
|
|
36
42
|
|
|
37
43
|
self._objects[name] = Dimension(self._group, name, size, create_h5ds=True)
|
|
38
44
|
|
|
@@ -211,7 +211,7 @@ def write_h5netcdf(tmp_netcdf, compression="gzip", format="NETCDF4"):
|
|
|
211
211
|
if ds.data_model == "NETCDF4_CLASSIC":
|
|
212
212
|
with raises(
|
|
213
213
|
CompatibilityError,
|
|
214
|
-
match="
|
|
214
|
+
match="Only one unlimited dimension allowed",
|
|
215
215
|
):
|
|
216
216
|
ds.dimensions = {"x": 4, "y": 5, "z": 6, "unlimited": None, "empty": 0}
|
|
217
217
|
|
|
@@ -2903,7 +2903,7 @@ def test_raise_on_closed_file(tmp_local_netcdf):
|
|
|
2903
2903
|
v = f.create_variable("hello", ("x",), float)
|
|
2904
2904
|
v[:] = np.ones(5)
|
|
2905
2905
|
f.close()
|
|
2906
|
-
with
|
|
2906
|
+
with raises(
|
|
2907
2907
|
ValueError,
|
|
2908
2908
|
match=f"I/O operation on <Closed h5netcdf.File>: '{tmp_local_netcdf}'",
|
|
2909
2909
|
):
|
|
@@ -2999,3 +2999,44 @@ def test_is_classic(tmp_local_netcdf):
|
|
|
2999
2999
|
|
|
3000
3000
|
out = subprocess.run(["ncdump", "-k", tmp_local_netcdf], capture_output=True)
|
|
3001
3001
|
assert out.stdout.decode().strip() == "netCDF-4 classic model"
|
|
3002
|
+
|
|
3003
|
+
|
|
3004
|
+
@pytest.mark.parametrize(
|
|
3005
|
+
"attr", [("un", "deux"), ["un", "deux"], ("one", "two"), ["one", "two"]]
|
|
3006
|
+
)
|
|
3007
|
+
def test_attributes_list(tmp_local_netcdf, attr):
|
|
3008
|
+
# regression test for https://github.com/h5netcdf/h5netcdf/issues/291
|
|
3009
|
+
with h5netcdf.File(tmp_local_netcdf, mode="w") as hf:
|
|
3010
|
+
hf.attrs["foo"] = attr
|
|
3011
|
+
|
|
3012
|
+
with h5netcdf.File(tmp_local_netcdf, mode="r") as hf:
|
|
3013
|
+
assert hf.attrs["foo"][0] == attr[0]
|
|
3014
|
+
assert hf.attrs["foo"][1] == attr[1]
|
|
3015
|
+
assert isinstance(hf.attrs["foo"], list)
|
|
3016
|
+
|
|
3017
|
+
|
|
3018
|
+
def test_group_dimensions(tmp_local_netcdf):
|
|
3019
|
+
# regression test for https://github.com/h5netcdf/h5netcdf/issues/293
|
|
3020
|
+
with h5netcdf.File(tmp_local_netcdf, mode="w") as f:
|
|
3021
|
+
group = f.create_group("data")
|
|
3022
|
+
dims = {"y": 3, "x": 3, "z": None, "z1": None}
|
|
3023
|
+
group.dimensions = dims
|
|
3024
|
+
assert list(group.dimensions) == ["y", "x", "z", "z1"]
|
|
3025
|
+
group.dimensions["z2"] = None
|
|
3026
|
+
assert list(group.dimensions) == ["y", "x", "z", "z1", "z2"]
|
|
3027
|
+
|
|
3028
|
+
|
|
3029
|
+
def test_group_dimensions_classic(tmp_local_netcdf):
|
|
3030
|
+
# regression test for https://github.com/h5netcdf/h5netcdf/issues/293
|
|
3031
|
+
with h5netcdf.File(tmp_local_netcdf, mode="w", format="NETCDF4_CLASSIC") as f:
|
|
3032
|
+
group = f.create_group("data")
|
|
3033
|
+
dims = {"y": 3, "x": 3, "z": None, "z1": None}
|
|
3034
|
+
with raises(CompatibilityError, match=r"Only one unlimited dimension allowed"):
|
|
3035
|
+
group.dimensions = dims
|
|
3036
|
+
assert list(group.dimensions) == []
|
|
3037
|
+
dims = {"y": 3, "x": 3, "z": None}
|
|
3038
|
+
group.dimensions = dims
|
|
3039
|
+
assert list(group.dimensions) == ["y", "x", "z"]
|
|
3040
|
+
with raises(CompatibilityError, match=r"Only one unlimited dimension allowed"):
|
|
3041
|
+
group.dimensions["z1"] = None
|
|
3042
|
+
assert list(group.dimensions) == ["y", "x", "z"]
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|