Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-h5netcdf for openSUSE:Factory
checked in at 2026-11-23 14:54:11
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-h5netcdf (Old)
and /work/SRC/openSUSE:Factory/.python-h5netcdf.new.1340718 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-h5netcdf"
Mon Nov 23 14:54:11 2026 rev:12 rq:1399747 version:1.8.3
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-h5netcdf/python-h5netcdf.changes
2026-03-18 16:51:27.903441157 +0100
+++
/work/SRC/openSUSE:Factory/.python-h5netcdf.new.1340718/python-h5netcdf.changes
2026-11-23 14:54:26.073028485 +0100
@@ -1,0 +2,29 @@
+Sun Nov 22 10:57:06 UTC 2026 - Dirk Müller <[email protected]>
+
+- update to 1.8.3:
+ * Fix HDF 1.10 compatibility CI run, which broke with
+ ubuntu-26.04, use GCC 13 in CI
+ * Fix reading scalar HDF5 object and region reference
+ attributes
+ * MNT: use hashes for actions in CI, change to PyPI trusted
+ publishing
+ * Fix negative indexing of partially written variables to use
+ the full shared dimension, including unwritten fill values
+ * Fix CI issues with xarray nightly tests (add pytz dependency)
+ and h5pyd tests (pin setuptools=81)
+ * FIX CI wrt setup-micromamba v3, update ros3 tests to work
+ with HDF v2
+ * Use netcdf4 instead of netCDF4 for conda-based installations
+ * Add HDF5 V2.2 tests to CI test matrix
+ Mühlbauer
+ * Update h5pyd>=1.0.0, hsds>=1.0.0, fix code and tests, xfail
+ remaining h5pyd/hsds tests with issues reported to h5pyd,
+ update CI
+ * Update pyfive>=1.2.0, pin pyfive>=1.3.0 in CI, remove pyfive
+ from numpy 1 CI runs, use decode_strings=True
+ * Honor the requested byte order in legacy createVariable when
+ the NumPy dtype already specifies a byte order
+ * Update contributors, add AI disclosure, condense project
+ history
+
+-------------------------------------------------------------------
Old:
----
h5netcdf-1.8.1.tar.gz
New:
----
h5netcdf-1.8.3.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-h5netcdf.spec ++++++
--- /var/tmp/diff_new_pack.F7Npbs/_old 2026-11-23 14:54:26.850061530 +0100
+++ /var/tmp/diff_new_pack.F7Npbs/_new 2026-11-23 14:54:26.852061615 +0100
@@ -18,7 +18,7 @@
%{?sle15_python_module_pythons}
Name: python-h5netcdf
-Version: 1.8.1
+Version: 1.8.3
Release: 0
Summary: A Python library to use netCDF4 files via h5py
License: BSD-3-Clause
@@ -32,11 +32,13 @@
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-h5py
+Requires: python-numpy
Requires: python-packaging
BuildArch: noarch
# SECTION test requirements
BuildRequires: %{python_module h5py}
BuildRequires: %{python_module netCDF4}
+BuildRequires: %{python_module numpy}
BuildRequires: %{python_module packaging}
BuildRequires: %{python_module pytest}
# /SECTION
++++++ h5netcdf-1.8.1.tar.gz -> h5netcdf-1.8.3.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/h5netcdf-1.8.1/CHANGELOG.rst
new/h5netcdf-1.8.3/CHANGELOG.rst
--- old/h5netcdf-1.8.1/CHANGELOG.rst 2026-01-23 08:35:17.000000000 +0100
+++ new/h5netcdf-1.8.3/CHANGELOG.rst 2026-11-11 13:31:26.947775400 +0100
@@ -1,6 +1,24 @@
Change Log
----------
+Version 1.8.3 (November 11th, 2026):
+
+- Fix HDF 1.10 compatibility CI run, which broke with ubuntu-26.04, use GCC 13
in CI (:pull:`336`) by `Kai Mühlbauer <https://github.com/kmuehlbauer>`_
+- Fix reading scalar HDF5 object and region reference attributes
(:issue:`203`), (:pull:`327`) by `loaff123 <https://github.com/loaff123>`_
+- MNT: use hashes for actions in CI, change to PyPI trusted publishing
(:pull:`337`) by `Kai Mühlbauer <https://github.com/kmuehlbauer>`_
+
+Version 1.8.2 (October 27th, 2026):
+
+- Fix negative indexing of partially written variables to use the full shared
dimension, including unwritten fill values (:pull:`329`) by `Anton Soloviev
<https://github.com/antonsoo>`_
+- Fix CI issues with xarray nightly tests (add pytz dependency) and h5pyd
tests (pin setuptools=81) (:issue:`312`, :pull:`313`) by `Kai Mühlbauer
<https://github.com/kmuehlbauer>`_
+- FIX CI wrt setup-micromamba v3, update ros3 tests to work with HDF v2
(:pull:`316`) by `Kai Mühlbauer <https://github.com/kmuehlbauer>`_
+- Use netcdf4 instead of netCDF4 for conda-based installations (:pull:`318`)
by `Kai Mühlbauer <https://github.com/kmuehlbauer>`_
+- Add HDF5 V2.2 tests to CI test matrix (:pull:`323`) by `Kai Mühlbauer
<https://github.com/kmuehlbauer>`_
+- Update h5pyd>=1.0.0, hsds>=1.0.0, fix code and tests, xfail remaining
h5pyd/hsds tests with issues reported to h5pyd, update CI (:pull:`328`) by `Kai
Mühlbauer <https://github.com/kmuehlbauer>`_
+- Update pyfive>=1.2.0, pin pyfive>=1.3.0 in CI, remove pyfive from numpy 1 CI
runs, use `decode_strings=True` (:pull:`331`) by `Kai Mühlbauer
<https://github.com/kmuehlbauer>`_
+- Honor the requested byte order in legacy ``createVariable`` when the NumPy
dtype already specifies a byte order (:pull:`330`) by `Anton Soloviev
<https://github.com/antonsoo>`_
+- Update contributors, add AI disclosure, condense project history
(:pull:`332`) by `Kai Mühlbauer <https://github.com/kmuehlbauer>`_
+
Version 1.8.1 (January 23rd, 2026):
- Add numpy to default dependencies, update install section to highlight
backend installation, update error message on missing backend (:issue:`310`,
:pull:`311`) by `Kai Mühlbauer <https://github.com/kmuehlbauer>`_
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/h5netcdf-1.8.1/PKG-INFO new/h5netcdf-1.8.3/PKG-INFO
--- old/h5netcdf-1.8.1/PKG-INFO 2026-01-23 08:35:26.388043400 +0100
+++ new/h5netcdf-1.8.3/PKG-INFO 2026-11-11 13:31:36.695845400 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 2.4
Name: h5netcdf
-Version: 1.8.1
+Version: 1.8.3
Summary: netCDF4 via h5py
Author-email: Stephan Hoyer <[email protected]>, Kai Mühlbauer
<[email protected]>
Maintainer-email: h5netcdf developers <[email protected]>
@@ -58,13 +58,15 @@
Provides-Extra: h5py
Requires-Dist: h5py; extra == "h5py"
Provides-Extra: pyfive
-Requires-Dist: pyfive>=1.0.0; extra == "pyfive"
+Requires-Dist: pyfive>=1.2.0; extra == "pyfive"
Provides-Extra: h5pyd
-Requires-Dist: h5pyd; extra == "h5pyd"
+Requires-Dist: h5pyd>=1.0.0; extra == "h5pyd"
Provides-Extra: test
Requires-Dist: h5py; extra == "test"
+Requires-Dist: h5pyd>=1.0.0; extra == "test"
+Requires-Dist: hsds>=1.0.0; extra == "test"
Requires-Dist: netCDF4; extra == "test"
-Requires-Dist: pyfive>=1.0.0; extra == "test"
+Requires-Dist: pyfive>=1.2.0; extra == "test"
Requires-Dist: pytest; extra == "test"
Dynamic: license-file
@@ -333,6 +335,30 @@
.. _new behavior: https://docs.h5py.org/en/stable/strings.html
+String attributes with incorrect encoding
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Some files contain string attributes whose declared encoding does not match
+their bytes. For example, UTF-8 bytes may be stored in a fixed-length attribute
+marked as ASCII. h5netcdf decodes attributes using the declared encoding and
+``surrogateescape``, preserving undecodable bytes as surrogate characters.
+
+If you know that such an attribute actually contains UTF-8 bytes, recover the
+original bytes before decoding them with the correct encoding:
+
+.. code-block:: python
+
+ import h5netcdf
+
+ with h5netcdf.File("mydata.nc", "r") as f:
+ value = f.attrs["platform_name"]
+ recovered = value.encode("ascii",
errors="surrogateescape").decode("utf-8")
+
+Apply this only when the declared and actual encodings are known; it is not an
+encoding detector or a general conversion for correctly decoded attributes.
+The recovery does not modify the file. Where possible, ask the data provider to
+correct the attribute's encoding metadata.
+
.. _phony dims:
Datasets with missing dimension scales
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/h5netcdf-1.8.1/README.rst
new/h5netcdf-1.8.3/README.rst
--- old/h5netcdf-1.8.1/README.rst 2026-01-23 08:35:17.000000000 +0100
+++ new/h5netcdf-1.8.3/README.rst 2026-11-11 13:31:26.947775400 +0100
@@ -263,6 +263,30 @@
.. _new behavior: https://docs.h5py.org/en/stable/strings.html
+String attributes with incorrect encoding
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Some files contain string attributes whose declared encoding does not match
+their bytes. For example, UTF-8 bytes may be stored in a fixed-length attribute
+marked as ASCII. h5netcdf decodes attributes using the declared encoding and
+``surrogateescape``, preserving undecodable bytes as surrogate characters.
+
+If you know that such an attribute actually contains UTF-8 bytes, recover the
+original bytes before decoding them with the correct encoding:
+
+.. code-block:: python
+
+ import h5netcdf
+
+ with h5netcdf.File("mydata.nc", "r") as f:
+ value = f.attrs["platform_name"]
+ recovered = value.encode("ascii",
errors="surrogateescape").decode("utf-8")
+
+Apply this only when the declared and actual encodings are known; it is not an
+encoding detector or a general conversion for correctly decoded attributes.
+The recovery does not modify the file. Where possible, ask the data provider to
+correct the attribute's encoding metadata.
+
.. _phony dims:
Datasets with missing dimension scales
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/h5netcdf-1.8.1/doc/devguide.rst
new/h5netcdf-1.8.3/doc/devguide.rst
--- old/h5netcdf-1.8.1/doc/devguide.rst 2026-01-23 08:35:17.000000000 +0100
+++ new/h5netcdf-1.8.3/doc/devguide.rst 2026-11-11 13:31:26.948263000 +0100
@@ -11,6 +11,7 @@
------------
- `Aleksandar Jelenak <https://github.com/ajelenak>`_
+- `Anthony Mercer <https://github.com/antonsoo>`_
- `Bas Couwenberg <https://github.com/sebastic>`_.
- `Brett Naul <https://github.com/bnaul>`_
- `Bryan Lawrence <https://github.com/bnlawrence>`_
@@ -29,6 +30,7 @@
- `Martin Raspaud <https://github.com/mraspaud>`_
- `Pierre Augier <https://github.com/paugier>`_
- `Rickard Holmberg <https://github.com/rho-novatron>`_
+- `Ramiz <https://github.com/rmz-oz>`_
- `Ryan Grout <https://github.com/groutr>`_
- `Scott Henderson <https://github.com/scottyhq>`_
- `Thomas Kluyver <https://github.com/takluyver>`_
@@ -41,10 +43,12 @@
-----------------------
- New features and changes should be added via Pull Requests from forks for
contributors as well as maintainers.
+- An issue with details to the feature or bug should be created first.
- Pull Requests should have at least one approval (once the maintainer count
has increased).
- Self merges without approval are allowed for repository maintenance,
hotfixes and if the code changes do not affect functionality.
- Directly pushing to the repository main branch should only be used as a last
resort.
- Releases should be introduced via Pull Request and approved. Exception:
Patch release after hotfix.
+- Any AI usage must be explicitly disclosed in the Issue or Pull Request
description.
Continuous Integration
----------------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/h5netcdf-1.8.1/doc/index.rst
new/h5netcdf-1.8.3/doc/index.rst
--- old/h5netcdf-1.8.1/doc/index.rst 2026-01-23 08:35:17.000000000 +0100
+++ new/h5netcdf-1.8.3/doc/index.rst 2026-11-11 13:31:26.948263000 +0100
@@ -53,9 +53,8 @@
and gained contributions from 25 :ref:`contributors` so far. The library is
widely used,
especially as backend within `xarray`_.
-Early 2020 Kai Mühlbauer started to add contributions and after some time he
volunteered
-to help in maintaining ``h5netcdf``. Two years later in January 2022 Stephan
handed the
-project-lead over to Kai. ``h5netcdf`` version 1.0 was released on 31st of
March 2022.
+In 2020 Kai Mühlbauer started to add contributions and after some time he
volunteered
+to help in maintaining ``h5netcdf``. In January 2022, maintainership
transitioned from Stephan to Kai, followed by the release of h5netcdf 1.0 on
March 31, 2022.
.. _netCDF4 file-format:
https://docs.unidata.ucar.edu/netcdf-c/current/file_format_specifications.html#netcdf_4_spec
.. _h5py: https://www.h5py.org/
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/h5netcdf-1.8.1/h5netcdf/_version.py
new/h5netcdf-1.8.3/h5netcdf/_version.py
--- old/h5netcdf-1.8.1/h5netcdf/_version.py 2026-01-23 08:35:26.000000000
+0100
+++ new/h5netcdf-1.8.3/h5netcdf/_version.py 2026-11-11 13:31:36.646534700
+0100
@@ -1,5 +1,6 @@
-# file generated by setuptools-scm
+# file generated by vcs-versioning
# don't change, don't track in version control
+from __future__ import annotations
__all__ = [
"__version__",
@@ -10,25 +11,14 @@
"commit_id",
]
-TYPE_CHECKING = False
-if TYPE_CHECKING:
- from typing import Tuple
- from typing import Union
-
- VERSION_TUPLE = Tuple[Union[int, str], ...]
- COMMIT_ID = Union[str, None]
-else:
- VERSION_TUPLE = object
- COMMIT_ID = object
-
version: str
__version__: str
-__version_tuple__: VERSION_TUPLE
-version_tuple: VERSION_TUPLE
-commit_id: COMMIT_ID
-__commit_id__: COMMIT_ID
+__version_tuple__: tuple[int | str, ...]
+version_tuple: tuple[int | str, ...]
+commit_id: str | None
+__commit_id__: str | None
-__version__ = version = '1.8.1'
-__version_tuple__ = version_tuple = (1, 8, 1)
+__version__ = version = '1.8.3'
+__version_tuple__ = version_tuple = (1, 8, 3)
-__commit_id__ = commit_id = 'g7a2bdde61'
+__commit_id__ = commit_id = 'g8914c0abc'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/h5netcdf-1.8.1/h5netcdf/attrs.py
new/h5netcdf-1.8.3/h5netcdf/attrs.py
--- old/h5netcdf-1.8.1/h5netcdf/attrs.py 2026-01-23 08:35:17.000000000
+0100
+++ new/h5netcdf-1.8.3/h5netcdf/attrs.py 2026-11-11 13:31:26.948511000
+0100
@@ -37,6 +37,11 @@
# see https://github.com/h5py/h5py/issues/2045
if self._h5py.__name__ == "h5py":
attr = self._h5attrs.get_id(key)
+ # do similar for h5pyd
+ elif self._h5py.__name__ == "h5pyd":
+ attr = self._h5attrs._parent.id.db.getAttributeValue(
+ self._h5attrs._parent.id.uuid, key
+ )
else:
# pyfive backend
attr = self._h5attrs[key]
@@ -88,7 +93,9 @@
# return item if single element list/array see
# https://github.com/h5netcdf/h5netcdf/issues/116
- if not np.isscalar(output) and len(output) == 1:
+ # HDF5 reference scalars are not recognized by np.isscalar,
+ # check for arrays and lists instead.
+ if isinstance(output, (np.ndarray, list)) and len(output) == 1:
return output[0]
return output
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/h5netcdf-1.8.1/h5netcdf/core.py
new/h5netcdf-1.8.3/h5netcdf/core.py
--- old/h5netcdf-1.8.1/h5netcdf/core.py 2026-01-23 08:35:17.000000000 +0100
+++ new/h5netcdf-1.8.3/h5netcdf/core.py 2026-11-11 13:31:26.948511000 +0100
@@ -144,11 +144,6 @@
"'pyfive', 'h5py', 'h5pyd'"
)
- if driver == "h5pyd" and backend not in ["pyfive", "h5py"]:
- msg = "Specifying driver='h5pyd' is deprecated, please use
backend='h5pyd' instead."
- warnings.warn(msg, DeprecationWarning)
- backend, driver = "h5pyd", None
-
if driver is not None:
if backend not in [None, "h5py"]:
msg = f"driver={driver!r} only works with 'h5py' backend, but
given backend={backend}."
@@ -649,12 +644,16 @@
# Return the maximum index for ndarray, list, slice, or int,
# handling empty arrays/lists safely
if isinstance(k, np.ndarray):
- if k.size == 0:
+ if k.size == 0 or k.min() < 0:
return None
return k.max() + 1
elif isinstance(k, list):
- return max(k) + 1 if k else None
+ return max(k) + 1 if k and min(k) >= 0 else None
elif isinstance(k, slice):
+ # Negative bounds refer to the full netCDF dimension, not
+ # the potentially shorter HDF5 dataset or partial padding.
+ if any(v is not None and v < 0 for v in (k.start, k.stop)):
+ return None
return k.stop
elif isinstance(k, int):
return k + 1
@@ -902,7 +901,11 @@
def _netcdf_dimension_but_not_variable(h5py_dataset):
- return NOT_A_VARIABLE in h5py_dataset.attrs.get("NAME", b"")
+ name = h5py_dataset.attrs.get("NAME", b"")
+ # h5pyd returns str instead of bytes
+ if isinstance(name, str):
+ name = name.encode("ascii")
+ return NOT_A_VARIABLE in name
def _unlabeled_dimension_mix(h5py_dataset):
@@ -1214,7 +1217,8 @@
@property
def _track_order(self):
if self._root._backend == "h5pyd":
- return self._h5group.track_order
+ # track_order is True when create_order is set
+ return bool(self._h5group.id.create_order)
# TODO: make a suggestion to upstream to create a property
# for files to get if they track the order
@@ -1749,11 +1753,11 @@
return cmptype
-def _open_pyfive(path, mode):
+def _open_pyfive(path, mode, **kwargs):
import pyfive
try:
- h5file = pyfive.File(path, mode)
+ h5file = pyfive.File(path, mode, **kwargs)
except Exception:
raise
else:
@@ -1761,32 +1765,12 @@
def _open_h5pyd(path, mode, **kwargs):
- original_mode = mode
if mode != "r":
kwargs.setdefault("track_order", _get_track_order("h5pyd"))
if mode == "a":
- mode = "r+" # probe for existing before creating
- try:
- h5file = h5pyd.File(path, mode, **kwargs)
- except OSError:
- if original_mode == "a":
- msg = (
- "Append mode for h5pyd now probes with 'r+' first and "
- "only falls back to 'w' if the file is missing.\n"
- "To silence this warning use 'r+' (open-existing) or 'w' "
- "(create-new) directly."
- )
- warnings.warn(msg, UserWarning, stacklevel=2)
-
- try:
- h5file = h5pyd.File(path, "w", **kwargs)
- except Exception:
- raise
- else:
- return h5file, False
- raise
- else:
- return h5file, (mode != "w")
+ mode = "r+"
+ h5file = h5pyd.File(path, mode, **kwargs)
+ return h5file, (mode != "w")
def _open_h5py(path, mode, **kwargs):
@@ -1896,7 +1880,14 @@
os.environ.get("PYFIVE_UNSUPPORTED_FEATURE", "error"),
)
self._h5py = pyfive
- self.__h5file = _open_pyfive(path, mode)
+ # from version 1.2.0 behaviour switched
+ # set decoding_strings = True explicitly
+ if version.parse(pyfive.__version__) >= version.parse("1.2.0"):
+ self.decode_vlen_strings = (
+ None if "legacy" in self._cls_name else True
+ )
+ kwargs = dict(decode_strings=True)
+ self.__h5file = _open_pyfive(path, mode, **kwargs)
elif self.backend == "h5pyd":
self._h5py = h5pyd
self.__h5file, self._preexisting_file = _open_h5pyd(
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/h5netcdf-1.8.1/h5netcdf/dimensions.py
new/h5netcdf-1.8.3/h5netcdf/dimensions.py
--- old/h5netcdf-1.8.1/h5netcdf/dimensions.py 2026-01-23 08:35:17.000000000
+0100
+++ new/h5netcdf-1.8.3/h5netcdf/dimensions.py 2026-11-11 13:31:26.948511000
+0100
@@ -226,6 +226,9 @@
)
# don't re-create scales if they already exist.
if not self._root._h5py.h5ds.is_scale(self._h5ds.id):
+ # h5pyd expects scale names as strings
+ if self._root._backend == "h5pyd" and isinstance(scale_name,
bytes):
+ scale_name = scale_name.decode("ascii")
self._h5ds.make_scale(scale_name)
def _attach_scale(self, refs):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/h5netcdf-1.8.1/h5netcdf/legacyapi.py
new/h5netcdf-1.8.3/h5netcdf/legacyapi.py
--- old/h5netcdf-1.8.1/h5netcdf/legacyapi.py 2026-01-23 08:35:17.000000000
+0100
+++ new/h5netcdf-1.8.3/h5netcdf/legacyapi.py 2026-11-11 13:31:26.948511000
+0100
@@ -204,6 +204,7 @@
endian : str, optional
Control on-disk storage format.
Can be any of ``little``, ``big`` or ``native`` (default).
+ Overrides the byte order specified in ``datatype``.
Returns
-------
@@ -231,12 +232,9 @@
# control endian-ess
endianess = _check_return_dtype_endianess(endian)
- # needs swapping?
- if endianess != "=":
- # transform to numpy dtype and swap endianess
- dtype = np.dtype(datatype)
- if dtype.byteorder != "|":
- datatype = dtype.newbyteorder("S")
+ dtype = np.dtype(datatype)
+ if dtype.byteorder not in ("|", endianess):
+ datatype = dtype.newbyteorder(endianess)
# closer to netCDF4 chunking behavior
kwds["chunking_heuristic"] = "h5netcdf"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/h5netcdf-1.8.1/h5netcdf/tests/conftest.py
new/h5netcdf-1.8.3/h5netcdf/tests/conftest.py
--- old/h5netcdf-1.8.1/h5netcdf/tests/conftest.py 2026-01-23
08:35:17.000000000 +0100
+++ new/h5netcdf-1.8.3/h5netcdf/tests/conftest.py 2026-11-11
13:31:26.949135300 +0100
@@ -134,6 +134,12 @@
return dict(decode_vlen_strings=request.param)
[email protected](params=["netCDF4", "h5netcdf.legacyapi", "h5netcdf"])
+def netcdf_read_module(request):
+ mod = request.param
+ return pytest.importorskip(mod, reason=f"requires {mod}")
+
+
@pytest.fixture(params=["netCDF4", "h5netcdf.legacyapi"])
def netcdf_write_module(request):
mod = request.param
@@ -242,12 +248,7 @@
ids.append(f"{wmod}->{rmod}::no-backend")
else:
for backend in backends:
- # decode_vlen True/False only for h5netcdf reads, others
False
- decode_values = (
- [True, False]
- if rmod == "h5netcdf" and backend == "h5py"
- else [False]
- )
+ decode_values = [True, False]
for dec in decode_values:
cases.append(
(
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/h5netcdf-1.8.1/h5netcdf/tests/test_h5netcdf.py
new/h5netcdf-1.8.3/h5netcdf/tests/test_h5netcdf.py
--- old/h5netcdf-1.8.1/h5netcdf/tests/test_h5netcdf.py 2026-01-23
08:35:17.000000000 +0100
+++ new/h5netcdf-1.8.3/h5netcdf/tests/test_h5netcdf.py 2026-11-11
13:31:26.949135300 +0100
@@ -95,7 +95,7 @@
raise
-def write_legacy_netcdf(tmp_netcdf, write_module, format="NETCDF4"):
+def write_legacy_netcdf(tmp_netcdf, write_module, format="NETCDF4",
unlimited_size=1):
ds = write_module.Dataset(tmp_netcdf, mode="w", format=format)
intf = np.int64 if ds.data_model == "NETCDF4" else np.int32
@@ -129,7 +129,8 @@
v[...] = 2
v = ds.createVariable("foo_unlimited", float, ("x", "unlimited"))
- v[...] = 1
+ if unlimited_size:
+ v[:, :unlimited_size] = 1
with raises(
(h5netcdf.CompatibilityError, TypeError),
@@ -165,7 +166,7 @@
ds.close()
-def write_h5netcdf(tmp_netcdf, compression="gzip", format="NETCDF4"):
+def write_h5netcdf(tmp_netcdf, compression="gzip", format="NETCDF4",
unlimited_size=0):
ds = h5netcdf.File(tmp_netcdf, mode="w", format=format)
intf = np.int64 if ds.data_model == "NETCDF4" else np.int32
ds.attrs["global"] = intf(42)
@@ -211,7 +212,10 @@
v = ds.create_variable("intscalar", data=intf(2))
v = ds.create_variable("foo_unlimited", ("x", "unlimited"), float)
- v[...] = 1
+ # Leave the empty case intentional; the new API does not resize on write.
+ if unlimited_size:
+ ds.resize_dimension("unlimited", unlimited_size)
+ v[...] = 1
with raises((h5netcdf.CompatibilityError, TypeError)):
ds.create_variable("boolean", data=True)
@@ -246,7 +250,9 @@
ds.close()
-def read_legacy_netcdf(tmp_netcdf, read_module, write_module, backend="h5py"):
+def read_legacy_netcdf(
+ tmp_netcdf, read_module, write_module, backend="h5py", unlimited_size=None
+):
if read_module is legacyapi:
ds = read_module.Dataset(tmp_netcdf, "r", backend=backend)
assert backend == ds.backend
@@ -288,6 +294,14 @@
assert set(ds.dimensions) == dimensions
assert set(ds.variables) == variables
+ if unlimited_size is None:
+ unlimited_size = 0 if write_module is h5netcdf else 1
+ v = ds.variables["foo_unlimited"]
+ assert v.dimensions == ("x", "unlimited")
+ assert v.shape == (4, unlimited_size)
+ assert ds.dimensions["unlimited"].isunlimited()
+ np.testing.assert_array_equal(v[...], np.ones((4, unlimited_size)))
+
if ds.data_model == "NETCDF4":
assert set(ds.enumtypes) == {"enum_t"}
assert set(ds.groups) == {"subgroup"}
@@ -383,7 +397,9 @@
ds.close()
-def read_h5netcdf(tmp_netcdf, write_module, decode_vlen_strings,
backend="h5py"):
+def read_h5netcdf(
+ tmp_netcdf, write_module, decode_vlen_strings, backend="h5py",
unlimited_size=None
+):
remote_file = isinstance(tmp_netcdf, str) and
tmp_netcdf.startswith(remote_h5)
ds = h5netcdf.File(tmp_netcdf, "r", **decode_vlen_strings, backend=backend)
intf = np.int64 if ds.data_model == "NETCDF4" else np.int32
@@ -423,6 +439,14 @@
assert set(ds.variables) == variables
+ if unlimited_size is None:
+ unlimited_size = 0 if write_module is h5netcdf else 1
+ v = ds["foo_unlimited"]
+ assert v.dimensions == ("x", "unlimited")
+ assert v.shape == (4, unlimited_size)
+ assert ds.dimensions["unlimited"].isunlimited()
+ np.testing.assert_array_equal(v[...], np.ones((4, unlimited_size)))
+
assert ds.parent is None
v = ds["foo"]
@@ -515,7 +539,10 @@
ds.close()
-def test_roundtrip_local(tmp_local_netcdf, wmod, rmod, bmod, decode_vlen,
monkeypatch):
[email protected]("unlimited_size", [0, 3], ids=["empty", "populated"])
+def test_roundtrip_local(
+ tmp_local_netcdf, wmod, rmod, bmod, decode_vlen, monkeypatch,
unlimited_size
+):
# test matrix is created in conftest.py from available modules
wmod = pytest.importorskip(wmod, reason=f"requires {wmod}")
rmod = pytest.importorskip(rmod, reason=f"requires {rmod}")
@@ -523,15 +550,23 @@
_ = pytest.importorskip(bmod, reason=f"requires {bmod}")
if wmod.__name__ in ["netCDF4", "h5netcdf.legacyapi"]:
- write_legacy_netcdf(tmp_local_netcdf, wmod)
+ write_legacy_netcdf(tmp_local_netcdf, wmod,
unlimited_size=unlimited_size)
else:
- write_h5netcdf(tmp_local_netcdf)
+ write_h5netcdf(tmp_local_netcdf, unlimited_size=unlimited_size)
if bmod == "pyfive":
monkeypatch.setenv("PYFIVE_UNSUPPORTED_FEATURE", "warn")
if rmod.__name__ in ["netCDF4", "h5netcdf.legacyapi"]:
- read_legacy_netcdf(tmp_local_netcdf, rmod, wmod, backend=bmod)
+ read_legacy_netcdf(
+ tmp_local_netcdf, rmod, wmod, backend=bmod,
unlimited_size=unlimited_size
+ )
else:
- read_h5netcdf(tmp_local_netcdf, wmod, decode_vlen, backend=bmod)
+ read_h5netcdf(
+ tmp_local_netcdf,
+ wmod,
+ decode_vlen,
+ backend=bmod,
+ unlimited_size=unlimited_size,
+ )
@requires_h5pyd
@@ -661,6 +696,118 @@
assert sorted(ds["x"].attrs) == ["foo", "units"]
+@requires_h5py
[email protected]("reference_kind", ["object", "region"])
[email protected]("null", [False, True])
[email protected](
+ "shape, expected_shape",
+ [
+ ((), ()),
+ ((0,), (0,)),
+ ((1,), ()),
+ ((2,), (2,)),
+ ((1, 2), (2,)),
+ ((2, 1), (2, 1)),
+ ],
+)
[email protected]("location", ["/", "target"])
+def test_reference_attributes(
+ tmp_local_netcdf,
+ local_backend,
+ reference_kind,
+ null,
+ shape,
+ expected_shape,
+ location,
+):
+ # Regression test for reading HDF5 object and region reference attributes
+ # checks the returned shape and that references retain their type and
+ # resolve to the expected target.
+ # https://github.com/h5netcdf/h5netcdf/issues/203
+ import h5py
+
+ if local_backend == "pyfive" and reference_kind == "region":
+ pytest.skip("pyfive does not support region references")
+
+ with h5py.File(tmp_local_netcdf, "w") as ds:
+ target = ds.create_dataset("target", data=np.arange(6))
+ if reference_kind == "object":
+ reference = h5py.Reference() if null else target.ref
+ dtype = h5py.ref_dtype
+ else:
+ reference = h5py.RegionReference() if null else
target.regionref[1:4]
+ dtype = h5py.regionref_dtype
+ value = np.full(shape, reference, dtype=dtype) if shape else reference
+ ds[location].attrs["reference"] = value
+
+ backend = get_backend_module(local_backend)
+ with (
+ h5netcdf.File(tmp_local_netcdf, "r", backend=local_backend) as ds,
+ backend.File(tmp_local_netcdf, "r") as raw,
+ ):
+ output = (ds if location == "/" else ds[location]).attrs["reference"]
+ assert np.shape(output) == expected_shape
+ if expected_shape:
+ expected_type = np.ndarray if local_backend == "h5py" else list
+ assert isinstance(output, expected_type)
+ else:
+ assert not isinstance(output, (np.ndarray, list))
+ original = np.asarray(raw[location].attrs["reference"])
+ for reference, expected in zip(np.asarray(output).flat, original.flat):
+ assert type(reference) is type(expected)
+ assert bool(reference) == bool(expected) == (not null)
+ if not null:
+ assert raw[reference].name == "/target"
+ if reference_kind == "region":
+ np.testing.assert_array_equal(
+ raw[reference][reference], np.arange(1, 4)
+ )
+
+
+@requires_h5py
+def test_ragged_vlen_numeric_attributes(tmp_local_netcdf, local_backend):
+ # Regression test for attrs.py: __getitem__ should only unwrap single-item
+ # ndarrays/lists. A ragged vlen attribute with multiple arrays must remain
a
+ # collection, with each array's values preserved.
+ # Related issue: https://github.com/h5netcdf/h5netcdf/issues/203
+ import h5py
+
+ values = [np.arange(2), np.arange(3)]
+ data = np.empty(2, dtype=h5py.vlen_dtype(np.dtype("int64")))
+ data[:] = values
+ with h5py.File(tmp_local_netcdf, "w") as ds:
+ ds.attrs["ragged"] = data
+
+ with h5netcdf.File(tmp_local_netcdf, "r", backend=local_backend) as ds:
+ output = ds.attrs["ragged"]
+ assert len(output) == len(values)
+ for actual, expected in zip(output, values):
+ np.testing.assert_array_equal(actual, expected)
+
+
+@requires_h5py
+def test_hidden_reference_attributes(tmp_local_netcdf, local_backend):
+ # Ensure HDF5 reference attributes used internally by h5netcdf remain
hidden
+ # from the public attrs API, including lookup, iteration, and dict
conversion.
+ # https://github.com/h5netcdf/h5netcdf/issues/203
+ import h5py
+
+ from h5netcdf.attrs import _HIDDEN_ATTRS
+
+ with h5py.File(tmp_local_netcdf, "w") as ds:
+ for name in _HIDDEN_ATTRS:
+ ds.attrs[name] = ds.ref
+ ds.attrs["visible"] = ds.ref
+
+ with h5netcdf.File(tmp_local_netcdf, "r", backend=local_backend) as ds:
+ assert list(ds.attrs) == ["visible"]
+ assert len(ds.attrs) == 1
+ assert list(dict(ds.attrs)) == ["visible"]
+ for name in _HIDDEN_ATTRS:
+ with raises(KeyError, match=name):
+ ds.attrs[name]
+
+
def test_shape_is_tied_to_coordinate(tmp_local_or_remote_netcdf):
with h5netcdf.legacyapi.Dataset(
tmp_local_or_remote_netcdf,
@@ -998,6 +1145,9 @@
def test_create_variable_matching_saved_dimension(
write_backend, read_backend, tmp_backend_netcdf
):
+ if write_backend == "h5pyd":
+ # revisit after https://github.com/HDFGroup/h5pyd/issues/306 is fixed
+ pytest.skip("Known failure with h5pyd")
h5 = get_backend_module(read_backend)
with h5netcdf.File(tmp_backend_netcdf, "w", backend=write_backend) as f:
f.dimensions["x"] = 2
@@ -1217,24 +1367,21 @@
# Writing to a variable with an unlimited dimension raises
if tmp_backend_netcdf.startswith(remote_h5):
- # We don't expect any errors. This is effectively a void context
manager
- expected_errors = memoryview(b"")
+ expected_errors = raises(ValueError, match="cannot reshape")
else:
expected_errors = raises(TypeError, match="Can't broadcast")
with expected_errors as e:
f.variables["dummy3"][:] = np.ones((5, 2))
- if not tmp_backend_netcdf.startswith(remote_h5):
+ if tmp_backend_netcdf.startswith(remote_h5):
+ assert e.value.args[0] == "cannot reshape array of size 10 into
shape (3,2)"
+ else:
assert e.value.args[0] == "Can't broadcast (5, 2) -> (3, 2)"
assert f.variables["dummy3"].shape == (3, 2)
assert f.variables["dummy3"]._h5ds.maxshape == (None, 2)
assert f["x"].shape == (3,)
assert f.dimensions["x"].size == 3
- if tmp_backend_netcdf.startswith(remote_h5):
- # h5pyd writes the data, but does not expand the dimensions
- np.testing.assert_allclose(f.variables["dummy3"], np.ones((3, 2)))
- else:
- # original data is kept for h5py
- np.testing.assert_allclose(f.variables["dummy3"], np.zeros((3, 2)))
+ # original data is kept
+ np.testing.assert_allclose(f.variables["dummy3"], np.zeros((3, 2)))
# Close and read again to also test correct parsing of unlimited
# dimensions.
@@ -1289,9 +1436,7 @@
# broadcast writing
if tmp_local_or_remote_netcdf.startswith(remote_h5):
- expected_errors = raises(
- OSError, match="Got asyncio.IncompleteReadError during binary
read"
- )
+ expected_errors = raises(ValueError, match="cannot reshape")
else:
# We don't expect any errors. This is effectively a void context
manager
expected_errors = memoryview(b"")
@@ -1299,7 +1444,7 @@
f.variables["dummy3"][...] = [[1, 2, 3]]
np.testing.assert_allclose(f.variables["dummy3"], [[1, 2, 3], [1,
2, 3]])
if tmp_local_or_remote_netcdf.startswith(remote_h5):
- assert "Got asyncio.IncompleteReadError" in e.value.args[0]
+ assert "cannot reshape array of size 3 into shape (2,3)" in
e.value.args[0]
@requires_h5py
@@ -1546,6 +1691,20 @@
assert ds._root._h5file[ref].name == name
[email protected](
+ "tmp_local_or_remote_netcdf",
+ [
+ "testfile.nc",
+ pytest.param(
+ "hdf5://testfile",
+ marks=pytest.mark.xfail(
+ reason="Known failure with h5pyd
(https://github.com/HDFGroup/h5pyd/issues/306)",
+ strict=True,
+ ),
+ ),
+ ],
+ indirect=True,
+)
def test_detach_scale(tmp_local_or_remote_netcdf):
with h5netcdf.File(tmp_local_or_remote_netcdf, "w") as ds:
ds.dimensions["x"] = 2
@@ -1566,7 +1725,7 @@
with h5netcdf.File(tmp_local_or_remote_netcdf, "r") as ds:
refs = ds._h5group["x"].attrs.get("REFERENCE_LIST", False)
- assert not refs
+ assert refs is False or len(refs) == 0
def test_is_scale(tmp_local_or_remote_netcdf):
@@ -1872,6 +2031,41 @@
assert f.variables["dummy4"]._h5ds.shape == (0, 3)
+@requires_netCDF4
+@requires_h5py
[email protected]("api", [h5netcdf.File, legacyapi.Dataset])
[email protected](
+ "key",
+ [
+ -1,
+ -2,
+ slice(None, -1),
+ slice(-2, 4),
+ slice(-5, -1),
+ [-2, -1],
+ np.array([-2, -1]),
+ slice(None, 2),
+ ],
+)
+def test_negative_indexing_of_padded_variables(tmp_local_netcdf, api, key):
+ """Negative indices use the shared dimension, including its unwritten
tail."""
+ import netCDF4
+
+ with netCDF4.Dataset(tmp_local_netcdf, "w") as ds:
+ ds.createDimension("time", None)
+ ds.createVariable("time", "i8", ("time",))[:] = np.arange(6)
+ variable = ds.createVariable("sensor", "f8", ("time",),
fill_value=-999)
+ variable[:3] = [11, 12, 13]
+
+ with netCDF4.Dataset(tmp_local_netcdf) as ds:
+ ds.set_auto_mask(False)
+ expected = ds["sensor"][key]
+
+ with api(tmp_local_netcdf, backend="h5py") as ds:
+ assert ds["sensor"].shape == (6,)
+ np.testing.assert_array_equal(ds["sensor"][key], expected)
+
+
# https://github.com/h5netcdf/h5netcdf/issues/136
@requires_h5py_ge_3_7_0
@requires_netCDF4
@@ -1973,6 +2167,47 @@
assert ds[name].name == name
[email protected]("datatype", [">i2", "<i2", ">f4", "<f4", ">f8",
"<f8"])
[email protected]("endian", ["native", "little", "big"])
+def test_legacyapi_explicit_dtype_endian(
+ write_backend, read_backend, tmp_backend_netcdf, datatype, endian
+):
+ values = np.array([1, -2, 3, 4], dtype=datatype)
+ with legacyapi.Dataset(tmp_backend_netcdf, "w", backend=write_backend) as
ds:
+ ds.createDimension("x", len(values))
+ variable = ds.createVariable("values", values.dtype, ("x",),
endian=endian)
+ variable[:] = values
+
+ order = {"native": "=", "little": "<", "big": ">"}[endian]
+ expected_dtype = np.dtype(order + datatype[1:])
+ h5 = get_backend_module(read_backend)
+ with h5.File(tmp_backend_netcdf, "r") as ds:
+ assert ds["values"].dtype == expected_dtype
+ np.testing.assert_array_equal(ds["values"][:], values)
+
+
[email protected]("datatype", [">i2", "<i2", ">f4", "<f4", ">f8",
"<f8"])
[email protected]("endian", ["native", "little", "big"])
+def test_netcdf4_explicit_dtype_endian(
+ tmp_local_netcdf, netcdf_write_module, netcdf_read_module, datatype, endian
+):
+ values = np.array([1, -2, 3, 4], dtype=datatype)
+ with netcdf_write_module.Dataset(tmp_local_netcdf, "w") as ds:
+ ds.createDimension("x", len(values))
+ variable = ds.createVariable("values", values.dtype, ("x",),
endian=endian)
+ variable[:] = values
+
+ order = {"native": "=", "little": "<", "big": ">"}[endian]
+ expected_dtype = np.dtype(order + datatype[1:])
+
+ reader = netcdf_read_module
+ open_dataset = getattr(reader, "Dataset", None) or reader.File
+
+ with open_dataset(tmp_local_netcdf, "r") as ds:
+ assert ds["values"].dtype == expected_dtype
+ np.testing.assert_array_equal(ds["values"][:], values)
+
+
def test_legacyapi_endianess(write_backend, read_backend, tmp_backend_netcdf):
# https://github.com/h5netcdf/h5netcdf/issues/15
big = legacyapi._check_return_dtype_endianess("big")
@@ -2219,10 +2454,13 @@
# unicode needs to be encoded properly for fixed size string type
ds.attrs["unicode_fixed"] = np.array(unicode.encode("utf-8"), dtype=dt)
ds.attrs["unicode_fixed_0dim"] = np.array(unicode.encode("utf-8"),
dtype=dt)
- ds.attrs["unicode_fixed_1dim"] = np.array([unicode.encode("utf-8")],
dtype=dt)
- ds.attrs["unicode_fixed_arrary"] = np.array(
- [unicode.encode("utf-8"), "foobár".encode()], dtype=dt
- )
+ if write_backend != "h5pyd":
+ ds.attrs["unicode_fixed_1dim"] = np.array(
+ [unicode.encode("utf-8")], dtype=dt
+ )
+ ds.attrs["unicode_fixed_arrary"] = np.array(
+ [unicode.encode("utf-8"), "foobár".encode()], dtype=dt
+ )
dt = h5py.string_dtype("ascii", 10)
ascii = "ascii"
@@ -2270,11 +2508,11 @@
assert ds.attrs["bytes_array"] == [ascii, foobar]
assert ds.attrs["bytes_list"] == "ascii"
+ assert ds.attrs["unicode_fixed"] == unicode
+ assert ds.attrs["unicode_fixed_0dim"] == unicode
if read_backend != "h5pyd":
# todo: this breaks for some reason with h5pyd
# it looks like this is already written as ascii
- assert ds.attrs["unicode_fixed"] == unicode
- assert ds.attrs["unicode_fixed_0dim"] == unicode
assert ds.attrs["unicode_fixed_1dim"] == unicode
assert ds.attrs["unicode_fixed_arrary"] == [unicode, "foobár"]
@@ -2319,11 +2557,11 @@
assert ds.bytes_array == [ascii, foobar]
assert ds.bytes_list == ascii
+ assert ds.unicode_fixed == unicode
+ assert ds.unicode_fixed_0dim == unicode
if read_backend != "h5pyd":
# todo: this breaks for some reason with h5pyd
# it looks like this is already written as ascii
- assert ds.unicode_fixed == unicode
- assert ds.unicode_fixed_0dim == unicode
assert ds.unicode_fixed_1dim == unicode
assert ds.unicode_fixed_arrary == [unicode, "foobár"]
@@ -2483,7 +2721,14 @@
@requires_h5py_ros3
def test_ros3():
- fname =
"https://archive.unidata.ucar.edu/software/netcdf/examples/OMI-Aura_L2-example.nc"
+ import h5py
+
+ kwargs = (
+ {}
+ if h5py.version.hdf5_version_tuple < (2, 0, 0)
+ else {"aws_region": b"us-east-2"}
+ )
+ fname = "https://dandiarchive.s3.amazonaws.com/ros3test.hdf5"
try:
req = urllib.request.Request(fname, method="HEAD")
with urllib.request.urlopen(req, timeout=3) as resp:
@@ -2492,8 +2737,8 @@
except Exception as e:
pytest.skip(f"Skipping ros3 test: cannot read remote file ({e})")
else:
- with h5netcdf.File(fname, "r", driver="ros3") as f:
- assert "Temperature" in list(f)
+ with h5netcdf.File(fname, "r", driver="ros3", **kwargs) as f:
+ assert "mydataset" in list(f)
def test_user_type_errors_new_api(tmp_local_or_remote_netcdf):
@@ -2507,7 +2752,7 @@
enum_type = ds.create_enumtype(np.uint8, "enum_t", enum_dict1)
if tmp_local_or_remote_netcdf.startswith(remote_h5):
- testcontext = raises(RuntimeError, match="Conflict")
+ testcontext = raises(OSError, match="name already exists")
else:
testcontext = raises((KeyError, TypeError), match="name
already exists")
with testcontext:
@@ -2555,7 +2800,7 @@
g = ds.createGroup("subgroup")
enum_type = ds.createEnumType(np.uint8, "enum_t", enum_dict1)
if tmp_local_or_remote_netcdf.startswith(remote_h5):
- testcontext = raises(RuntimeError, match="Conflict")
+ testcontext = raises(OSError, match="name already exists")
else:
testcontext = raises((KeyError, TypeError), match="name
already exists")
with testcontext:
@@ -3008,12 +3253,12 @@
pytest.skip("HSDS service not running")
rnd = "".join(random.choice(string.ascii_uppercase) for _ in range(5))
fname = f"hdf5://testfile{rnd}.nc"
- with h5netcdf.File(fname, "w", driver="h5pyd") as ds:
+ with h5netcdf.File(fname, "w", backend="h5pyd") as ds:
assert ds._h5py == h5pyd
assert isinstance(ds._h5file, h5pyd.File)
fname = f"/testfile{rnd}.nc"
- with h5netcdf.File(fname, "w", driver="h5pyd") as ds:
+ with h5netcdf.File(fname, "w", backend="h5pyd") as ds:
assert ds._h5py == h5pyd
assert isinstance(ds._h5file, h5pyd.File)
@@ -3028,20 +3273,18 @@
fname = f"hdf5://testfile{rnd}.nc"
with h5pyd.File(fname, "w") as ds:
ds.create_dataset("foo", data=b"1234")
- with h5netcdf.File(fname, "r", driver="h5pyd") as ds:
- # HSDS stores this as a chunked dataset, but only with a single chunk
- assert ds["foo"]._h5ds.chunks == (1,)
- # However, since it is a scalar dataset, we should not expose the
chunking
+ with h5netcdf.File(fname, "r", backend="h5pyd") as ds:
+ # h5pyd does not expose HSDS's internal chunking for scalar datasets
+ assert ds["foo"]._h5ds.chunks is None
assert ds["foo"].chunks is None
@requires_h5pyd
def test_h5pyd_append(tmp_remote_netcdf):
- with warns(UserWarning, match="Append mode for h5pyd"):
- with h5netcdf.File(tmp_remote_netcdf, "a", driver="h5pyd") as ds:
- assert not ds._preexisting_file
+ with h5netcdf.File(tmp_remote_netcdf, "a", backend="h5pyd") as ds:
+ assert ds._preexisting_file
- with h5netcdf.File(tmp_remote_netcdf, "a", driver="h5pyd") as ds:
+ with h5netcdf.File(tmp_remote_netcdf, "a", backend="h5pyd") as ds:
assert ds._preexisting_file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/h5netcdf-1.8.1/h5netcdf.egg-info/PKG-INFO
new/h5netcdf-1.8.3/h5netcdf.egg-info/PKG-INFO
--- old/h5netcdf-1.8.1/h5netcdf.egg-info/PKG-INFO 2026-01-23
08:35:26.000000000 +0100
+++ new/h5netcdf-1.8.3/h5netcdf.egg-info/PKG-INFO 2026-11-11
13:31:36.677483600 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 2.4
Name: h5netcdf
-Version: 1.8.1
+Version: 1.8.3
Summary: netCDF4 via h5py
Author-email: Stephan Hoyer <[email protected]>, Kai Mühlbauer
<[email protected]>
Maintainer-email: h5netcdf developers <[email protected]>
@@ -58,13 +58,15 @@
Provides-Extra: h5py
Requires-Dist: h5py; extra == "h5py"
Provides-Extra: pyfive
-Requires-Dist: pyfive>=1.0.0; extra == "pyfive"
+Requires-Dist: pyfive>=1.2.0; extra == "pyfive"
Provides-Extra: h5pyd
-Requires-Dist: h5pyd; extra == "h5pyd"
+Requires-Dist: h5pyd>=1.0.0; extra == "h5pyd"
Provides-Extra: test
Requires-Dist: h5py; extra == "test"
+Requires-Dist: h5pyd>=1.0.0; extra == "test"
+Requires-Dist: hsds>=1.0.0; extra == "test"
Requires-Dist: netCDF4; extra == "test"
-Requires-Dist: pyfive>=1.0.0; extra == "test"
+Requires-Dist: pyfive>=1.2.0; extra == "test"
Requires-Dist: pytest; extra == "test"
Dynamic: license-file
@@ -333,6 +335,30 @@
.. _new behavior: https://docs.h5py.org/en/stable/strings.html
+String attributes with incorrect encoding
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Some files contain string attributes whose declared encoding does not match
+their bytes. For example, UTF-8 bytes may be stored in a fixed-length attribute
+marked as ASCII. h5netcdf decodes attributes using the declared encoding and
+``surrogateescape``, preserving undecodable bytes as surrogate characters.
+
+If you know that such an attribute actually contains UTF-8 bytes, recover the
+original bytes before decoding them with the correct encoding:
+
+.. code-block:: python
+
+ import h5netcdf
+
+ with h5netcdf.File("mydata.nc", "r") as f:
+ value = f.attrs["platform_name"]
+ recovered = value.encode("ascii",
errors="surrogateescape").decode("utf-8")
+
+Apply this only when the declared and actual encodings are known; it is not an
+encoding detector or a general conversion for correctly decoded attributes.
+The recovery does not modify the file. Where possible, ask the data provider to
+correct the attribute's encoding metadata.
+
.. _phony dims:
Datasets with missing dimension scales
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/h5netcdf-1.8.1/h5netcdf.egg-info/SOURCES.txt
new/h5netcdf-1.8.3/h5netcdf.egg-info/SOURCES.txt
--- old/h5netcdf-1.8.1/h5netcdf.egg-info/SOURCES.txt 2026-01-23
08:35:26.000000000 +0100
+++ new/h5netcdf-1.8.3/h5netcdf.egg-info/SOURCES.txt 2026-11-11
13:31:36.687038700 +0100
@@ -23,6 +23,8 @@
h5netcdf.egg-info/SOURCES.txt
h5netcdf.egg-info/dependency_links.txt
h5netcdf.egg-info/requires.txt
+h5netcdf.egg-info/scm_file_list.json
+h5netcdf.egg-info/scm_version.json
h5netcdf.egg-info/top_level.txt
h5netcdf/tests/__init__.py
h5netcdf/tests/conftest.py
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/h5netcdf-1.8.1/h5netcdf.egg-info/requires.txt
new/h5netcdf-1.8.3/h5netcdf.egg-info/requires.txt
--- old/h5netcdf-1.8.1/h5netcdf.egg-info/requires.txt 2026-01-23
08:35:26.000000000 +0100
+++ new/h5netcdf-1.8.3/h5netcdf.egg-info/requires.txt 2026-11-11
13:31:36.678264100 +0100
@@ -5,13 +5,15 @@
h5py
[h5pyd]
-h5pyd
+h5pyd>=1.0.0
[pyfive]
-pyfive>=1.0.0
+pyfive>=1.2.0
[test]
h5py
+h5pyd>=1.0.0
+hsds>=1.0.0
netCDF4
-pyfive>=1.0.0
+pyfive>=1.2.0
pytest
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/h5netcdf-1.8.1/h5netcdf.egg-info/scm_file_list.json
new/h5netcdf-1.8.3/h5netcdf.egg-info/scm_file_list.json
--- old/h5netcdf-1.8.1/h5netcdf.egg-info/scm_file_list.json 1970-01-01
01:00:00.000000000 +0100
+++ new/h5netcdf-1.8.3/h5netcdf.egg-info/scm_file_list.json 2026-11-11
13:31:36.675231000 +0100
@@ -0,0 +1,38 @@
+{
+ "files": [
+ ".github/ISSUE_TEMPLATE/bug_report.md",
+ ".github/ISSUE_TEMPLATE/feature_request.md",
+ ".github/PULL_REQUEST_TEMPLATE.md",
+ ".github/dependabot.yml",
+ ".github/workflows/main.yml",
+ ".gitignore",
+ ".pre-commit-config.yaml",
+ "AUTHORS.txt",
+ "CHANGELOG.rst",
+ "LICENSE",
+ "MANIFEST.in",
+ "README.rst",
+ "doc/Makefile",
+ "doc/api.rst",
+ "doc/changelog.rst",
+ "doc/conf.py",
+ "doc/devguide.rst",
+ "doc/feature.rst",
+ "doc/index.rst",
+ "doc/legacyapi.rst",
+ "environment.yml",
+ "h5netcdf/__init__.py",
+ "h5netcdf/attrs.py",
+ "h5netcdf/core.py",
+ "h5netcdf/dimensions.py",
+ "h5netcdf/legacyapi.py",
+ "h5netcdf/tests/__init__.py",
+ "h5netcdf/tests/conftest.py",
+ "h5netcdf/tests/pytest.ini",
+ "h5netcdf/tests/test_h5netcdf.py",
+ "h5netcdf/utils.py",
+ "licenses/H5PY_LICENSE.txt",
+ "licenses/PSF_LICENSE.txt",
+ "pyproject.toml"
+ ]
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/h5netcdf-1.8.1/h5netcdf.egg-info/scm_version.json
new/h5netcdf-1.8.3/h5netcdf.egg-info/scm_version.json
--- old/h5netcdf-1.8.1/h5netcdf.egg-info/scm_version.json 1970-01-01
01:00:00.000000000 +0100
+++ new/h5netcdf-1.8.3/h5netcdf.egg-info/scm_version.json 2026-11-11
13:31:36.669812000 +0100
@@ -0,0 +1,8 @@
+{
+ "tag": "1.8.3",
+ "distance": 0,
+ "node": "g8914c0abcb87b02c27c0e08e8db5f9a036f91820",
+ "dirty": false,
+ "branch": "HEAD",
+ "node_date": "2026-11-11"
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/h5netcdf-1.8.1/pyproject.toml
new/h5netcdf-1.8.3/pyproject.toml
--- old/h5netcdf-1.8.1/pyproject.toml 2026-01-23 08:35:17.000000000 +0100
+++ new/h5netcdf-1.8.3/pyproject.toml 2026-11-11 13:31:26.949736800 +0100
@@ -45,9 +45,9 @@
[project.optional-dependencies]
h5py = ["h5py"]
-pyfive = ["pyfive>=1.0.0"]
-h5pyd = ["h5pyd"]
-test = ["h5py", "netCDF4", "pyfive>=1.0.0", "pytest"]
+pyfive = ["pyfive>=1.2.0"]
+h5pyd = ["h5pyd>=1.0.0"]
+test = ["h5py", "h5pyd>=1.0.0", "hsds>=1.0.0", "netCDF4", "pyfive>=1.2.0",
"pytest"]
[tool.setuptools.dynamic]
readme = { file = ["README.rst"]}