h5netcdf 1.6.3__tar.gz → 1.7.0__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.

Files changed (34) hide show
  1. {h5netcdf-1.6.3 → h5netcdf-1.7.0}/.pre-commit-config.yaml +4 -4
  2. {h5netcdf-1.6.3 → h5netcdf-1.7.0}/CHANGELOG.rst +21 -0
  3. {h5netcdf-1.6.3 → h5netcdf-1.7.0}/PKG-INFO +5 -5
  4. {h5netcdf-1.6.3 → h5netcdf-1.7.0}/README.rst +4 -4
  5. {h5netcdf-1.6.3 → h5netcdf-1.7.0}/doc/devguide.rst +2 -1
  6. {h5netcdf-1.6.3 → h5netcdf-1.7.0}/h5netcdf/_version.py +16 -3
  7. {h5netcdf-1.6.3 → h5netcdf-1.7.0}/h5netcdf/attrs.py +23 -2
  8. {h5netcdf-1.6.3 → h5netcdf-1.7.0}/h5netcdf/core.py +193 -53
  9. {h5netcdf-1.6.3 → h5netcdf-1.7.0}/h5netcdf/dimensions.py +21 -5
  10. {h5netcdf-1.6.3 → h5netcdf-1.7.0}/h5netcdf/tests/conftest.py +12 -0
  11. {h5netcdf-1.6.3 → h5netcdf-1.7.0}/h5netcdf/tests/test_h5netcdf.py +345 -163
  12. h5netcdf-1.7.0/h5netcdf/utils.py +231 -0
  13. {h5netcdf-1.6.3 → h5netcdf-1.7.0}/h5netcdf.egg-info/PKG-INFO +5 -5
  14. h5netcdf-1.6.3/h5netcdf/utils.py +0 -26
  15. {h5netcdf-1.6.3 → h5netcdf-1.7.0}/AUTHORS.txt +0 -0
  16. {h5netcdf-1.6.3 → h5netcdf-1.7.0}/LICENSE +0 -0
  17. {h5netcdf-1.6.3 → h5netcdf-1.7.0}/doc/Makefile +0 -0
  18. {h5netcdf-1.6.3 → h5netcdf-1.7.0}/doc/api.rst +0 -0
  19. {h5netcdf-1.6.3 → h5netcdf-1.7.0}/doc/changelog.rst +0 -0
  20. {h5netcdf-1.6.3 → h5netcdf-1.7.0}/doc/conf.py +0 -0
  21. {h5netcdf-1.6.3 → h5netcdf-1.7.0}/doc/feature.rst +0 -0
  22. {h5netcdf-1.6.3 → h5netcdf-1.7.0}/doc/index.rst +0 -0
  23. {h5netcdf-1.6.3 → h5netcdf-1.7.0}/doc/legacyapi.rst +0 -0
  24. {h5netcdf-1.6.3 → h5netcdf-1.7.0}/h5netcdf/__init__.py +0 -0
  25. {h5netcdf-1.6.3 → h5netcdf-1.7.0}/h5netcdf/legacyapi.py +0 -0
  26. {h5netcdf-1.6.3 → h5netcdf-1.7.0}/h5netcdf/tests/pytest.ini +0 -0
  27. {h5netcdf-1.6.3 → h5netcdf-1.7.0}/h5netcdf.egg-info/SOURCES.txt +0 -0
  28. {h5netcdf-1.6.3 → h5netcdf-1.7.0}/h5netcdf.egg-info/dependency_links.txt +0 -0
  29. {h5netcdf-1.6.3 → h5netcdf-1.7.0}/h5netcdf.egg-info/requires.txt +0 -0
  30. {h5netcdf-1.6.3 → h5netcdf-1.7.0}/h5netcdf.egg-info/top_level.txt +0 -0
  31. {h5netcdf-1.6.3 → h5netcdf-1.7.0}/licenses/H5PY_LICENSE.txt +0 -0
  32. {h5netcdf-1.6.3 → h5netcdf-1.7.0}/licenses/PSF_LICENSE.txt +0 -0
  33. {h5netcdf-1.6.3 → h5netcdf-1.7.0}/pyproject.toml +0 -0
  34. {h5netcdf-1.6.3 → h5netcdf-1.7.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  repos:
2
2
  - repo: https://github.com/pre-commit/pre-commit-hooks
3
- rev: v4.6.0
3
+ rev: v6.0.0
4
4
  hooks:
5
5
  - id: trailing-whitespace
6
6
  - id: end-of-file-fixer
@@ -10,16 +10,16 @@ repos:
10
10
  - id: debug-statements
11
11
  - id: mixed-line-ending
12
12
  - repo: https://github.com/astral-sh/ruff-pre-commit
13
- rev: 'v0.5.0'
13
+ rev: 'v0.12.12'
14
14
  hooks:
15
15
  - id: ruff
16
16
  args: [ "--fix" ]
17
17
  - repo: https://github.com/psf/black
18
- rev: 24.4.2
18
+ rev: 25.1.0
19
19
  hooks:
20
20
  - id: black
21
21
  - repo: https://github.com/adamchainz/blacken-docs
22
- rev: "1.18.0"
22
+ rev: "1.20.0"
23
23
  hooks:
24
24
  - id: blacken-docs
25
25
  additional_dependencies:
@@ -1,6 +1,27 @@
1
1
  Change Log
2
2
  ----------
3
3
 
4
+ Version 1.7.0 (October 15th, 2025):
5
+
6
+ - Fix unintentional changes in test suite (:pull:`277`).
7
+ By `Kai Mühlbauer <https://github.com/kmuehlbauer>`_
8
+ - Create ENUM with low level API to keep order-by-value, add h5dump based tests (:pull:`285`).
9
+ By `Kai Mühlbauer <https://github.com/kmuehlbauer>`_ and `David Huard <https://github.com/huard>`_
10
+ - Fix interoperability issues between netcdf4/h5netcdf, namely resizing variables using partial slices,
11
+ creating string attributes with NULLTERM, proper attachment of _Netcdf4Coordinates and _Netcdf4Dimid as well as special string type fillvalues (:pull:`286`).
12
+ By `Kai Mühlbauer <https://github.com/kmuehlbauer>`_ and `David Huard <https://github.com/huard>`_
13
+ - Add the `format` argument to `h5netcdf.File` and support for the `NETCDF4_CLASSIC` format (:issue:`280`, :pull:`283`).
14
+ By `David Huard <https://github.com/huard>`_
15
+ - Do not return padded arrays for slices larger than variable shape (:issue:`287`, :pull:`288`).
16
+ By `Kai Mühlbauer <https://github.com/kmuehlbauer>`_
17
+
18
+ Version 1.6.4 (August 5th, 2025):
19
+
20
+ - Cleanup: pyupgrade --py39-plus (:pull:`272`).
21
+ By `Kurt Schwehr <https://github.com/schwehr>`_
22
+ - Add better error messages when operating on a closed file (:issue:`274`, :pull:`275`).
23
+ By `Kai Mühlbauer <https://github.com/kmuehlbauer>`_
24
+
4
25
  Version 1.6.3 (June 30th, 2025):
5
26
 
6
27
  - fix invalid string format specifier, match raises/warns with messages in test suite,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: h5netcdf
3
- Version: 1.6.3
3
+ Version: 1.7.0
4
4
  Summary: netCDF4 via h5py
5
5
  Author-email: Stephan Hoyer <shoyer@gmail.com>, Kai Mühlbauer <kmuehlbauer@wradlib.org>
6
6
  Maintainer-email: h5netcdf developers <devteam@h5netcdf.org>
@@ -124,10 +124,10 @@ Usage
124
124
  -----
125
125
 
126
126
  h5netcdf has two APIs, a new API and a legacy API. Both interfaces currently
127
- reproduce most of the features of the netCDF interface, with the notable
128
- exception of support for operations that rename or delete existing objects.
129
- We simply haven't gotten around to implementing this yet. Patches
130
- would be very welcome.
127
+ reproduce most of the features of the netCDF interface, including the ability
128
+ to write NETCDF4 and NETCDF4_CLASSIC formatted files. Support for operations
129
+ that rename or delete existing objects is still missing, and patches would be
130
+ very welcome.
131
131
 
132
132
  New API
133
133
  ~~~~~~~
@@ -64,10 +64,10 @@ Usage
64
64
  -----
65
65
 
66
66
  h5netcdf has two APIs, a new API and a legacy API. Both interfaces currently
67
- reproduce most of the features of the netCDF interface, with the notable
68
- exception of support for operations that rename or delete existing objects.
69
- We simply haven't gotten around to implementing this yet. Patches
70
- would be very welcome.
67
+ reproduce most of the features of the netCDF interface, including the ability
68
+ to write NETCDF4 and NETCDF4_CLASSIC formatted files. Support for operations
69
+ that rename or delete existing objects is still missing, and patches would be
70
+ very welcome.
71
71
 
72
72
  New API
73
73
  ~~~~~~~
@@ -13,6 +13,7 @@ Contributors
13
13
  - `Aleksandar Jelenak <https://github.com/ajelenak>`_
14
14
  - `Bas Couwenberg <https://github.com/sebastic>`_.
15
15
  - `Brett Naul <https://github.com/bnaul>`_
16
+ - `David Huard <https://github.com/huard>`_
16
17
  - `Dion Häfner <https://github.com/dionhaefner>`_
17
18
  - `Drew Parsons <https://github.com/drew-parsons>`_
18
19
  - `Ezequiel Cimadevilla Alvarez <https://github.com/zequihg50>`_
@@ -49,7 +50,7 @@ Continuous Integration
49
50
  or a PullRequest branch several checks are performed:
50
51
 
51
52
  - Lint and style checks (``ruff``, ``black``)
52
- - Unit tests with latest ``h5py3`` (Python 3.9, 3.10, 3.11) facilitating GitHub Ubuntu worker
53
+ - Unit tests with latest ``h5py3`` (and Python versions) facilitating GitHub Ubuntu worker
53
54
  - Documentation build, artifacts are made available to download
54
55
  - On release, source-tarball and universal wheel is uploaded to PyPI and documentation is made available
55
56
  on `h5netcdf GitHub Pages`_
@@ -1,7 +1,14 @@
1
1
  # file generated by setuptools-scm
2
2
  # don't change, don't track in version control
3
3
 
4
- __all__ = ["__version__", "__version_tuple__", "version", "version_tuple"]
4
+ __all__ = [
5
+ "__version__",
6
+ "__version_tuple__",
7
+ "version",
8
+ "version_tuple",
9
+ "__commit_id__",
10
+ "commit_id",
11
+ ]
5
12
 
6
13
  TYPE_CHECKING = False
7
14
  if TYPE_CHECKING:
@@ -9,13 +16,19 @@ if TYPE_CHECKING:
9
16
  from typing import Union
10
17
 
11
18
  VERSION_TUPLE = Tuple[Union[int, str], ...]
19
+ COMMIT_ID = Union[str, None]
12
20
  else:
13
21
  VERSION_TUPLE = object
22
+ COMMIT_ID = object
14
23
 
15
24
  version: str
16
25
  __version__: str
17
26
  __version_tuple__: VERSION_TUPLE
18
27
  version_tuple: VERSION_TUPLE
28
+ commit_id: COMMIT_ID
29
+ __commit_id__: COMMIT_ID
19
30
 
20
- __version__ = version = '1.6.3'
21
- __version_tuple__ = version_tuple = (1, 6, 3)
31
+ __version__ = version = '1.7.0'
32
+ __version_tuple__ = version_tuple = (1, 7, 0)
33
+
34
+ __commit_id__ = commit_id = 'g9cb422fb6'
@@ -2,6 +2,8 @@ from collections.abc import MutableMapping
2
2
 
3
3
  import numpy as np
4
4
 
5
+ from .utils import _create_string_attribute
6
+
5
7
  _HIDDEN_ATTRS = frozenset(
6
8
  [
7
9
  "REFERENCE_LIST",
@@ -17,10 +19,11 @@ _HIDDEN_ATTRS = frozenset(
17
19
 
18
20
 
19
21
  class Attributes(MutableMapping):
20
- def __init__(self, h5attrs, check_dtype, h5py_pckg):
22
+ def __init__(self, h5attrs, check_dtype, h5py_pckg, format="NETCDF4"):
21
23
  self._h5attrs = h5attrs
22
24
  self._check_dtype = check_dtype
23
25
  self._h5py = h5py_pckg
26
+ self._format = format
24
27
 
25
28
  def __getitem__(self, key):
26
29
  if key in _HIDDEN_ATTRS:
@@ -83,7 +86,25 @@ class Attributes(MutableMapping):
83
86
  dtype = np.asarray(value).dtype
84
87
 
85
88
  self._check_dtype(dtype)
86
- self._h5attrs[key] = value
89
+
90
+ if (
91
+ dtype.kind in {"S", "U"} # for strings
92
+ and dtype.metadata is None # but not special h5py strings
93
+ and not isinstance(value, (list, self._h5py.Empty))
94
+ and self._h5py.__name__ == "h5py"
95
+ ):
96
+ # create with low level API to get fixed length strings
97
+ # as netcdf4-python/netcdf-c does
98
+ _create_string_attribute(self._h5attrs._id, key, value)
99
+ # always for CLASSIC mode
100
+ elif self._format == "NETCDF4_CLASSIC":
101
+ self._h5attrs[key] = np.atleast_1d(value)
102
+ else:
103
+ # netcdf4-python/netcdf-c writes non-string scalars as simple dataset
104
+ # converting to 1D
105
+ if np.isscalar(value) and dtype.kind not in {"S", "U"}:
106
+ value = np.atleast_1d(value)
107
+ self._h5attrs[key] = value
87
108
 
88
109
  def __delitem__(self, key):
89
110
  del self._h5attrs[key]