h5netcdf 1.7.2__py3-none-any.whl → 1.7.3__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.
Potentially problematic release.
This version of h5netcdf might be problematic. Click here for more details.
- h5netcdf/_version.py +2 -2
- h5netcdf/core.py +26 -19
- h5netcdf/tests/test_h5netcdf.py +7 -0
- {h5netcdf-1.7.2.dist-info → h5netcdf-1.7.3.dist-info}/METADATA +1 -1
- {h5netcdf-1.7.2.dist-info → h5netcdf-1.7.3.dist-info}/RECORD +9 -9
- {h5netcdf-1.7.2.dist-info → h5netcdf-1.7.3.dist-info}/WHEEL +0 -0
- {h5netcdf-1.7.2.dist-info → h5netcdf-1.7.3.dist-info}/licenses/AUTHORS.txt +0 -0
- {h5netcdf-1.7.2.dist-info → h5netcdf-1.7.3.dist-info}/licenses/LICENSE +0 -0
- {h5netcdf-1.7.2.dist-info → h5netcdf-1.7.3.dist-info}/top_level.txt +0 -0
h5netcdf/_version.py
CHANGED
|
@@ -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.3'
|
|
32
|
+
__version_tuple__ = version_tuple = (1, 7, 3)
|
|
33
33
|
|
|
34
34
|
__commit_id__ = commit_id = None
|
h5netcdf/core.py
CHANGED
|
@@ -55,20 +55,13 @@ def _invalid_netcdf_feature(feature, allow):
|
|
|
55
55
|
|
|
56
56
|
def _transform_1d_boolean_indexers(key):
|
|
57
57
|
"""Find and transform 1D boolean indexers to int"""
|
|
58
|
-
#
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
)
|
|
66
|
-
for k in key
|
|
67
|
-
]
|
|
68
|
-
except TypeError:
|
|
69
|
-
return key
|
|
70
|
-
|
|
71
|
-
return tuple(key)
|
|
58
|
+
# Convert 1D boolean arrays/lists to integer indices,
|
|
59
|
+
# leaving all other types unchanged
|
|
60
|
+
return tuple(
|
|
61
|
+
np.flatnonzero(arr) if arr.dtype == bool else k
|
|
62
|
+
for k in key
|
|
63
|
+
for arr in [np.asanyarray(k)]
|
|
64
|
+
)
|
|
72
65
|
|
|
73
66
|
|
|
74
67
|
def _expanded_indexer(key, ndim):
|
|
@@ -526,13 +519,27 @@ class BaseVariable(BaseObject):
|
|
|
526
519
|
h5ds_shape = self._h5ds.shape
|
|
527
520
|
shape = self.shape
|
|
528
521
|
|
|
529
|
-
# check for ndarray and list
|
|
530
522
|
# see https://github.com/pydata/xarray/issues/7154
|
|
523
|
+
# see https://github.com/pydata/xarray/issues/10867
|
|
531
524
|
# first get maximum index
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
525
|
+
def _get_max_index(k):
|
|
526
|
+
# Return the maximum index for ndarray, list, slice, or int,
|
|
527
|
+
# handling empty arrays/lists safely
|
|
528
|
+
if isinstance(k, np.ndarray):
|
|
529
|
+
if k.size == 0:
|
|
530
|
+
return None
|
|
531
|
+
return k.max() + 1
|
|
532
|
+
elif isinstance(k, list):
|
|
533
|
+
return max(k) + 1 if k else None
|
|
534
|
+
elif isinstance(k, slice):
|
|
535
|
+
return k.stop
|
|
536
|
+
elif isinstance(k, int):
|
|
537
|
+
return k + 1
|
|
538
|
+
else:
|
|
539
|
+
return None
|
|
540
|
+
|
|
541
|
+
max_index = [_get_max_index(k) for k in key0]
|
|
542
|
+
|
|
536
543
|
# second convert to max shape
|
|
537
544
|
# we take the minimum of shape vs max_index to not return
|
|
538
545
|
# slices larger than expected data
|
h5netcdf/tests/test_h5netcdf.py
CHANGED
|
@@ -1973,6 +1973,13 @@ def test_fancy_indexing(tmp_local_or_remote_netcdf):
|
|
|
1973
1973
|
np.testing.assert_array_equal(ds["hello"][[4, 5, 6], 1], [41, 0, 0])
|
|
1974
1974
|
np.testing.assert_array_equal(ds["hello"][slice(4, 7), 1], [41, 0, 0])
|
|
1975
1975
|
|
|
1976
|
+
# test empty slices
|
|
1977
|
+
# regression test for https://github.com/pydata/xarray/pull/10870
|
|
1978
|
+
empty = np.empty(0, dtype="int64")
|
|
1979
|
+
np.testing.assert_array_equal(ds["hello"][1, []], empty)
|
|
1980
|
+
np.testing.assert_array_equal(ds["hello"][1, np.array([], dtype="int")], empty)
|
|
1981
|
+
np.testing.assert_array_equal(ds["hello"][1, slice(0, 0)], empty)
|
|
1982
|
+
|
|
1976
1983
|
|
|
1977
1984
|
def test_h5py_chunking(tmp_local_netcdf):
|
|
1978
1985
|
with h5netcdf.File(tmp_local_netcdf, "w") as ds:
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
h5netcdf/__init__.py,sha256=Y0EBCcmlJctwl1kCmj7yLijTVy9AioBTr2091vInAtw,456
|
|
2
|
-
h5netcdf/_version.py,sha256=
|
|
2
|
+
h5netcdf/_version.py,sha256=7eQx5zuwit_DANpeuU5CY0KHuDtyAFB3ZgRhOo7lx8Y,704
|
|
3
3
|
h5netcdf/attrs.py,sha256=GSq2lzv9q0tEkJBqr2Hyrwo0YJnWZHxtLRhhG9NVf4w,4575
|
|
4
|
-
h5netcdf/core.py,sha256=
|
|
4
|
+
h5netcdf/core.py,sha256=jElZOQqCNE27hZytIGBzqkwZryc6rfhEJglu5N2jXsw,69961
|
|
5
5
|
h5netcdf/dimensions.py,sha256=BO126-7r9B0sF_bbcCSzTMnQY5wH7e_DSkbUO4F9q_o,8609
|
|
6
6
|
h5netcdf/legacyapi.py,sha256=MIZlht5Ad4hDFF1Slz2vXmKkgbv7Fhhf2YwNIe16Lfk,7682
|
|
7
7
|
h5netcdf/utils.py,sha256=btxKI-VZP-Wn0Rk_wmnhnUls-mrxO42w0s_uX_su4FI,6528
|
|
8
8
|
h5netcdf/tests/conftest.py,sha256=qS7XTZxos0NIRFtMCJwVEyx0paZw8Le1loPK1MtoQ_0,2350
|
|
9
9
|
h5netcdf/tests/pytest.ini,sha256=ruJxrLdCIA4bCPVuPQjxsLSlvVxuIsIakK6iQOmz-ak,107
|
|
10
|
-
h5netcdf/tests/test_h5netcdf.py,sha256=
|
|
11
|
-
h5netcdf-1.7.
|
|
12
|
-
h5netcdf-1.7.
|
|
13
|
-
h5netcdf-1.7.
|
|
14
|
-
h5netcdf-1.7.
|
|
15
|
-
h5netcdf-1.7.
|
|
16
|
-
h5netcdf-1.7.
|
|
10
|
+
h5netcdf/tests/test_h5netcdf.py,sha256=TriQc5J4oSCTIijgwhTf6bkVzzvwub6s-6eHfYn1IyI,118780
|
|
11
|
+
h5netcdf-1.7.3.dist-info/licenses/AUTHORS.txt,sha256=LTKzUh9o4Wc_oT3aFC48cyDCCP6tdm6VEV_6RrNy4uo,272
|
|
12
|
+
h5netcdf-1.7.3.dist-info/licenses/LICENSE,sha256=Xer1Jg8iL_n9Da0xt0S99blk6tsg9tee_JdgH1rWTjs,1505
|
|
13
|
+
h5netcdf-1.7.3.dist-info/METADATA,sha256=H1kMZigWMuWwgy_Np2u9u_Pp-7i6BHhMBk1N0JY1lDY,13396
|
|
14
|
+
h5netcdf-1.7.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
15
|
+
h5netcdf-1.7.3.dist-info/top_level.txt,sha256=Fb_KIpOE6MBqjSvxV1Ay7oYce1mdmQ1pO9JQJPDeGqg,9
|
|
16
|
+
h5netcdf-1.7.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|