h5netcdf 1.2.0__tar.gz → 1.4.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.2.0 → h5netcdf-1.4.0}/.pre-commit-config.yaml +13 -4
  2. {h5netcdf-1.2.0 → h5netcdf-1.4.0}/CHANGELOG.rst +26 -0
  3. {h5netcdf-1.2.0 → h5netcdf-1.4.0}/PKG-INFO +29 -26
  4. {h5netcdf-1.2.0 → h5netcdf-1.4.0}/README.rst +22 -24
  5. {h5netcdf-1.2.0 → h5netcdf-1.4.0}/doc/api.rst +3 -0
  6. {h5netcdf-1.2.0 → h5netcdf-1.4.0}/doc/conf.py +1 -1
  7. {h5netcdf-1.2.0 → h5netcdf-1.4.0}/doc/devguide.rst +2 -0
  8. {h5netcdf-1.2.0 → h5netcdf-1.4.0}/doc/index.rst +1 -1
  9. {h5netcdf-1.2.0 → h5netcdf-1.4.0}/doc/legacyapi.rst +3 -0
  10. {h5netcdf-1.2.0 → h5netcdf-1.4.0}/h5netcdf/__init__.py +1 -0
  11. h5netcdf-1.4.0/h5netcdf/_version.py +16 -0
  12. {h5netcdf-1.2.0 → h5netcdf-1.4.0}/h5netcdf/attrs.py +2 -2
  13. {h5netcdf-1.2.0 → h5netcdf-1.4.0}/h5netcdf/core.py +565 -95
  14. {h5netcdf-1.2.0 → h5netcdf-1.4.0}/h5netcdf/dimensions.py +6 -9
  15. {h5netcdf-1.2.0 → h5netcdf-1.4.0}/h5netcdf/legacyapi.py +26 -5
  16. {h5netcdf-1.2.0 → h5netcdf-1.4.0}/h5netcdf/tests/test_h5netcdf.py +619 -63
  17. {h5netcdf-1.2.0 → h5netcdf-1.4.0}/h5netcdf.egg-info/PKG-INFO +29 -26
  18. {h5netcdf-1.2.0 → h5netcdf-1.4.0}/pyproject.toml +4 -3
  19. h5netcdf-1.2.0/h5netcdf/_version.py +0 -4
  20. {h5netcdf-1.2.0 → h5netcdf-1.4.0}/AUTHORS.txt +0 -0
  21. {h5netcdf-1.2.0 → h5netcdf-1.4.0}/LICENSE +0 -0
  22. {h5netcdf-1.2.0 → h5netcdf-1.4.0}/doc/Makefile +0 -0
  23. {h5netcdf-1.2.0 → h5netcdf-1.4.0}/doc/changelog.rst +0 -0
  24. {h5netcdf-1.2.0 → h5netcdf-1.4.0}/doc/feature.rst +0 -0
  25. {h5netcdf-1.2.0 → h5netcdf-1.4.0}/h5netcdf/tests/conftest.py +0 -0
  26. {h5netcdf-1.2.0 → h5netcdf-1.4.0}/h5netcdf/tests/pytest.ini +0 -0
  27. {h5netcdf-1.2.0 → h5netcdf-1.4.0}/h5netcdf/utils.py +0 -0
  28. {h5netcdf-1.2.0 → h5netcdf-1.4.0}/h5netcdf.egg-info/SOURCES.txt +0 -0
  29. {h5netcdf-1.2.0 → h5netcdf-1.4.0}/h5netcdf.egg-info/dependency_links.txt +0 -0
  30. {h5netcdf-1.2.0 → h5netcdf-1.4.0}/h5netcdf.egg-info/requires.txt +0 -0
  31. {h5netcdf-1.2.0 → h5netcdf-1.4.0}/h5netcdf.egg-info/top_level.txt +0 -0
  32. {h5netcdf-1.2.0 → h5netcdf-1.4.0}/licenses/H5PY_LICENSE.txt +0 -0
  33. {h5netcdf-1.2.0 → h5netcdf-1.4.0}/licenses/PSF_LICENSE.txt +0 -0
  34. {h5netcdf-1.2.0 → h5netcdf-1.4.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.4.0
3
+ rev: v4.6.0
4
4
  hooks:
5
5
  - id: trailing-whitespace
6
6
  - id: end-of-file-fixer
@@ -9,12 +9,21 @@ repos:
9
9
  - id: check-yaml
10
10
  - id: debug-statements
11
11
  - id: mixed-line-ending
12
- - repo: https://github.com/charliermarsh/ruff-pre-commit
13
- rev: 'v0.0.254'
12
+ - repo: https://github.com/astral-sh/ruff-pre-commit
13
+ rev: 'v0.5.0'
14
14
  hooks:
15
15
  - id: ruff
16
16
  args: [ "--fix" ]
17
17
  - repo: https://github.com/psf/black
18
- rev: 23.1.0
18
+ rev: 24.4.2
19
19
  hooks:
20
20
  - id: black
21
+ - repo: https://github.com/adamchainz/blacken-docs
22
+ rev: "1.18.0"
23
+ hooks:
24
+ - id: blacken-docs
25
+ additional_dependencies:
26
+ - black==23.9.1
27
+
28
+ ci:
29
+ autoupdate_commit_msg: 'MNT: update pre-commit hooks'
@@ -1,6 +1,32 @@
1
1
  Change Log
2
2
  ----------
3
3
 
4
+ Version 1.4.0 (October 7th, 2024):
5
+
6
+ - Add UserType class, add EnumType ({pull}`229`).
7
+ By `Kai Mühlbauer <https://github.com/kmuehlbauer>`_
8
+ - Refactor fillvalue and dtype handling for user types, enhance sanity checks and tests ({pull}`230`).
9
+ By `Kai Mühlbauer <https://github.com/kmuehlbauer>`_
10
+ - Add VLType and CompoundType, commit complex compound type to file. Align with nc-complex ({pull}`227`).
11
+ By `Kai Mühlbauer <https://github.com/kmuehlbauer>`_
12
+ - Update h5pyd testing.
13
+ By `Kai Mühlbauer <https://github.com/kmuehlbauer>`_
14
+ - CI and lint maintenance ({pull}`235`).
15
+ By `Kai Mühlbauer <https://github.com/kmuehlbauer>`_
16
+ - Support wrapping an h5py ``File`` object. Closing the h5netcdf file object
17
+ does not close the h5py file ({pull}`238`).
18
+ By `Thomas Kluyver <https://github.com/takluyver>`_
19
+ - CI and lint maintenance (format README.rst, use more f-strings, change Python 3.9 to 3.10 in CI) ({pull}`239`).
20
+ By `Kai Mühlbauer <https://github.com/kmuehlbauer>`_
21
+
22
+ Version 1.3.0 (November 7th, 2023):
23
+
24
+ - Add ros3 support by checking `driver`-kwarg.
25
+ By `Ezequiel Cimadevilla Alvarez <https://github.com/zequihg50>`_
26
+ - Code and CI maintenance.
27
+ By `Mark Harfouche <https://github.com/hmaarrfk>`_ and
28
+ `Kai Mühlbauer <https://github.com/kmuehlbauer>`_.
29
+
4
30
  Version 1.2.0 (June 2nd, 2023):
5
31
 
6
32
  - Remove h5py2 compatibility code, remove h5py2 CI runs, mention NEP29 as
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: h5netcdf
3
- Version: 1.2.0
3
+ Version: 1.4.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>
@@ -45,12 +45,17 @@ Classifier: Programming Language :: Python :: 3
45
45
  Classifier: Programming Language :: Python :: 3.9
46
46
  Classifier: Programming Language :: Python :: 3.10
47
47
  Classifier: Programming Language :: Python :: 3.11
48
+ Classifier: Programming Language :: Python :: 3.12
48
49
  Classifier: Topic :: Scientific/Engineering
49
50
  Requires-Python: >=3.9
50
51
  Description-Content-Type: text/x-rst
51
- Provides-Extra: test
52
52
  License-File: LICENSE
53
53
  License-File: AUTHORS.txt
54
+ Requires-Dist: h5py
55
+ Requires-Dist: packaging
56
+ Provides-Extra: test
57
+ Requires-Dist: netCDF4; extra == "test"
58
+ Requires-Dist: pytest; extra == "test"
54
59
 
55
60
  h5netcdf
56
61
  ========
@@ -134,32 +139,32 @@ design is an adaptation of h5py to the netCDF data model. For example:
134
139
  import h5netcdf
135
140
  import numpy as np
136
141
 
137
- with h5netcdf.File('mydata.nc', 'w') as f:
142
+ with h5netcdf.File("mydata.nc", "w") as f:
138
143
  # set dimensions with a dictionary
139
- f.dimensions = {'x': 5}
144
+ f.dimensions = {"x": 5}
140
145
  # and update them with a dict-like interface
141
146
  # f.dimensions['x'] = 5
142
147
  # f.dimensions.update({'x': 5})
143
148
 
144
- v = f.create_variable('hello', ('x',), float)
149
+ v = f.create_variable("hello", ("x",), float)
145
150
  v[:] = np.ones(5)
146
151
 
147
152
  # you don't need to create groups first
148
153
  # you also don't need to create dimensions first if you supply data
149
154
  # with the new variable
150
- v = f.create_variable('/grouped/data', ('y',), data=np.arange(10))
155
+ v = f.create_variable("/grouped/data", ("y",), data=np.arange(10))
151
156
 
152
157
  # access and modify attributes with a dict-like interface
153
- v.attrs['foo'] = 'bar'
158
+ v.attrs["foo"] = "bar"
154
159
 
155
160
  # you can access variables and groups directly using a hierarchical
156
161
  # keys like h5py
157
- print(f['/grouped/data'])
162
+ print(f["/grouped/data"])
158
163
 
159
164
  # add an unlimited dimension
160
- f.dimensions['z'] = None
165
+ f.dimensions["z"] = None
161
166
  # explicitly resize a dimension and all variables using it
162
- f.resize_dimension('z', 3)
167
+ f.resize_dimension("z", 3)
163
168
 
164
169
  Notes:
165
170
 
@@ -180,22 +185,23 @@ The legacy API is designed for compatibility with `netCDF4-python`_. To use it,
180
185
  .. code-block:: python
181
186
 
182
187
  import h5netcdf.legacyapi as netCDF4
188
+
183
189
  # everything here would also work with this instead:
184
190
  # import netCDF4
185
191
  import numpy as np
186
192
 
187
- with netCDF4.Dataset('mydata.nc', 'w') as ds:
188
- ds.createDimension('x', 5)
189
- v = ds.createVariable('hello', float, ('x',))
193
+ with netCDF4.Dataset("mydata.nc", "w") as ds:
194
+ ds.createDimension("x", 5)
195
+ v = ds.createVariable("hello", float, ("x",))
190
196
  v[:] = np.ones(5)
191
197
 
192
- g = ds.createGroup('grouped')
193
- g.createDimension('y', 10)
194
- g.createVariable('data', 'i8', ('y',))
195
- v = g['data']
198
+ g = ds.createGroup("grouped")
199
+ g.createDimension("y", 10)
200
+ g.createVariable("data", "i8", ("y",))
201
+ v = g["data"]
196
202
  v[:] = np.arange(10)
197
- v.foo = 'bar'
198
- print(ds.groups['grouped'].variables['data'])
203
+ v.foo = "bar"
204
+ print(ds.groups["grouped"].variables["data"])
199
205
 
200
206
  The legacy API is designed to be easy to try-out for netCDF4-python users, but it is not an
201
207
  exact match. Here is an incomplete list of functionality we don't include:
@@ -218,9 +224,6 @@ h5py implements some features that do not (yet) result in valid netCDF files:
218
224
 
219
225
  - Data types:
220
226
  - Booleans
221
- - Complex values
222
- - Non-string variable length types
223
- - Enum types
224
227
  - Reference types
225
228
  - Arbitrary filters:
226
229
  - Scale-offset filters
@@ -235,11 +238,11 @@ when creating a file:
235
238
  .. code-block:: python
236
239
 
237
240
  # avoid the .nc extension for non-netcdf files
238
- f = h5netcdf.File('mydata.h5', invalid_netcdf=True)
241
+ f = h5netcdf.File("mydata.h5", invalid_netcdf=True)
239
242
  ...
240
243
 
241
244
  # works with the legacy API, too, though compression options are not exposed
242
- ds = h5netcdf.legacyapi.Dataset('mydata.h5', invalid_netcdf=True)
245
+ ds = h5netcdf.legacyapi.Dataset("mydata.h5", invalid_netcdf=True)
243
246
  ...
244
247
 
245
248
  In such cases the `_NCProperties` attribute will not be saved to the file or be removed
@@ -277,7 +280,7 @@ phony dimensions according to `netCDF`_ behaviour.
277
280
  .. code-block:: python
278
281
 
279
282
  # mimic netCDF-behaviour for non-netcdf files
280
- f = h5netcdf.File('mydata.h5', mode='r', phony_dims='sort')
283
+ f = h5netcdf.File("mydata.h5", mode="r", phony_dims="sort")
281
284
  ...
282
285
 
283
286
  Note, that this iterates once over the whole group-hierarchy. This has affects
@@ -288,7 +291,7 @@ to group access time. The created phony dimension naming will differ from
288
291
 
289
292
  .. code-block:: python
290
293
 
291
- f = h5netcdf.File('mydata.h5', mode='r', phony_dims='access')
294
+ f = h5netcdf.File("mydata.h5", mode="r", phony_dims="access")
292
295
  ...
293
296
 
294
297
  .. rubric:: Footnotes
@@ -80,32 +80,32 @@ design is an adaptation of h5py to the netCDF data model. For example:
80
80
  import h5netcdf
81
81
  import numpy as np
82
82
 
83
- with h5netcdf.File('mydata.nc', 'w') as f:
83
+ with h5netcdf.File("mydata.nc", "w") as f:
84
84
  # set dimensions with a dictionary
85
- f.dimensions = {'x': 5}
85
+ f.dimensions = {"x": 5}
86
86
  # and update them with a dict-like interface
87
87
  # f.dimensions['x'] = 5
88
88
  # f.dimensions.update({'x': 5})
89
89
 
90
- v = f.create_variable('hello', ('x',), float)
90
+ v = f.create_variable("hello", ("x",), float)
91
91
  v[:] = np.ones(5)
92
92
 
93
93
  # you don't need to create groups first
94
94
  # you also don't need to create dimensions first if you supply data
95
95
  # with the new variable
96
- v = f.create_variable('/grouped/data', ('y',), data=np.arange(10))
96
+ v = f.create_variable("/grouped/data", ("y",), data=np.arange(10))
97
97
 
98
98
  # access and modify attributes with a dict-like interface
99
- v.attrs['foo'] = 'bar'
99
+ v.attrs["foo"] = "bar"
100
100
 
101
101
  # you can access variables and groups directly using a hierarchical
102
102
  # keys like h5py
103
- print(f['/grouped/data'])
103
+ print(f["/grouped/data"])
104
104
 
105
105
  # add an unlimited dimension
106
- f.dimensions['z'] = None
106
+ f.dimensions["z"] = None
107
107
  # explicitly resize a dimension and all variables using it
108
- f.resize_dimension('z', 3)
108
+ f.resize_dimension("z", 3)
109
109
 
110
110
  Notes:
111
111
 
@@ -126,22 +126,23 @@ The legacy API is designed for compatibility with `netCDF4-python`_. To use it,
126
126
  .. code-block:: python
127
127
 
128
128
  import h5netcdf.legacyapi as netCDF4
129
+
129
130
  # everything here would also work with this instead:
130
131
  # import netCDF4
131
132
  import numpy as np
132
133
 
133
- with netCDF4.Dataset('mydata.nc', 'w') as ds:
134
- ds.createDimension('x', 5)
135
- v = ds.createVariable('hello', float, ('x',))
134
+ with netCDF4.Dataset("mydata.nc", "w") as ds:
135
+ ds.createDimension("x", 5)
136
+ v = ds.createVariable("hello", float, ("x",))
136
137
  v[:] = np.ones(5)
137
138
 
138
- g = ds.createGroup('grouped')
139
- g.createDimension('y', 10)
140
- g.createVariable('data', 'i8', ('y',))
141
- v = g['data']
139
+ g = ds.createGroup("grouped")
140
+ g.createDimension("y", 10)
141
+ g.createVariable("data", "i8", ("y",))
142
+ v = g["data"]
142
143
  v[:] = np.arange(10)
143
- v.foo = 'bar'
144
- print(ds.groups['grouped'].variables['data'])
144
+ v.foo = "bar"
145
+ print(ds.groups["grouped"].variables["data"])
145
146
 
146
147
  The legacy API is designed to be easy to try-out for netCDF4-python users, but it is not an
147
148
  exact match. Here is an incomplete list of functionality we don't include:
@@ -164,9 +165,6 @@ h5py implements some features that do not (yet) result in valid netCDF files:
164
165
 
165
166
  - Data types:
166
167
  - Booleans
167
- - Complex values
168
- - Non-string variable length types
169
- - Enum types
170
168
  - Reference types
171
169
  - Arbitrary filters:
172
170
  - Scale-offset filters
@@ -181,11 +179,11 @@ when creating a file:
181
179
  .. code-block:: python
182
180
 
183
181
  # avoid the .nc extension for non-netcdf files
184
- f = h5netcdf.File('mydata.h5', invalid_netcdf=True)
182
+ f = h5netcdf.File("mydata.h5", invalid_netcdf=True)
185
183
  ...
186
184
 
187
185
  # works with the legacy API, too, though compression options are not exposed
188
- ds = h5netcdf.legacyapi.Dataset('mydata.h5', invalid_netcdf=True)
186
+ ds = h5netcdf.legacyapi.Dataset("mydata.h5", invalid_netcdf=True)
189
187
  ...
190
188
 
191
189
  In such cases the `_NCProperties` attribute will not be saved to the file or be removed
@@ -223,7 +221,7 @@ phony dimensions according to `netCDF`_ behaviour.
223
221
  .. code-block:: python
224
222
 
225
223
  # mimic netCDF-behaviour for non-netcdf files
226
- f = h5netcdf.File('mydata.h5', mode='r', phony_dims='sort')
224
+ f = h5netcdf.File("mydata.h5", mode="r", phony_dims="sort")
227
225
  ...
228
226
 
229
227
  Note, that this iterates once over the whole group-hierarchy. This has affects
@@ -234,7 +232,7 @@ to group access time. The created phony dimension naming will differ from
234
232
 
235
233
  .. code-block:: python
236
234
 
237
- f = h5netcdf.File('mydata.h5', mode='r', phony_dims='access')
235
+ f = h5netcdf.File("mydata.h5", mode="r", phony_dims="access")
238
236
  ...
239
237
 
240
238
  .. rubric:: Footnotes
@@ -18,3 +18,6 @@ This page provides an auto-generated summary of h5netcdf's new API.
18
18
  Group
19
19
  Dimension
20
20
  Variable
21
+ CompoundType
22
+ EnumType
23
+ VLType
@@ -130,7 +130,7 @@ else:
130
130
  # extract git revision
131
131
  gh_tree_name = version_tuple[-1].split(".")[0][1:]
132
132
 
133
- rel = "`{0} <{1}/h5netcdf/tree/{2}>`__".format(release, url, gh_tree_name)
133
+ rel = f"`{release} <{url}/h5netcdf/tree/{gh_tree_name}>`__"
134
134
 
135
135
  rst_epilog = ""
136
136
  rst_epilog += f"""
@@ -15,6 +15,7 @@ Contributors
15
15
  - `Brett Naul <https://github.com/bnaul>`_
16
16
  - `Dion Häfner <https://github.com/dionhaefner>`_
17
17
  - `Drew Parsons <https://github.com/drew-parsons>`_
18
+ - `Ezequiel Cimadevilla Alvarez <https://github.com/zequihg50>`_
18
19
  - `Frédéric Laliberté <https://github.com/laliberte>`_
19
20
  - `Ghislain Vaillant <https://github.com/ghisvail>`_
20
21
  - `Lion Krischer <https://github.com/krischer>`_
@@ -23,6 +24,7 @@ Contributors
23
24
  - `Pierre Augier <https://github.com/paugier>`_
24
25
  - `Ryan Grout <https://github.com/groutr>`_
25
26
  - `Scott Henderson <https://github.com/scottyhq>`_
27
+ - `Thomas Kluyver <https://github.com/takluyver>`_
26
28
  - `Tom Augspurger <https://github.com/TomAugspurger>`_
27
29
 
28
30
  If you are interested to contribute, just let us know by creating an issue or pull request on github.
@@ -50,7 +50,7 @@ by Stephan Hoyer. The first `official` ``h5netcdf`` announcement was made by Ste
50
50
  `xarray issue tracker`_ only one day later.
51
51
 
52
52
  The library evolved constantly over the years (fixing bugs and adding enhancements)
53
- and gained contributions from 15 other :ref:`contributors` so far. The library is widely used,
53
+ and gained contributions from 17 other :ref:`contributors` so far. The library is widely used,
54
54
  especially as backend within `xarray`_.
55
55
 
56
56
  Early 2020 Kai Mühlbauer started to add contributions and after some time he volunteered
@@ -18,3 +18,6 @@ This page provides an auto-generated summary of h5netcdf's legacy API.
18
18
  Group
19
19
  Dimension
20
20
  Variable
21
+ CompoundType
22
+ EnumType
23
+ VLType
@@ -5,6 +5,7 @@ h5netcdf
5
5
  A Python library for the netCDF4 file-format that directly reads and writes
6
6
  HDF5 files via h5py, without using the Unidata netCDF library.
7
7
  """
8
+
8
9
  try:
9
10
  from ._version import version as __version__
10
11
  except Exception:
@@ -0,0 +1,16 @@
1
+ # file generated by setuptools_scm
2
+ # don't change, don't track in version control
3
+ TYPE_CHECKING = False
4
+ if TYPE_CHECKING:
5
+ from typing import Tuple, Union
6
+ VERSION_TUPLE = Tuple[Union[int, str], ...]
7
+ else:
8
+ VERSION_TUPLE = object
9
+
10
+ version: str
11
+ __version__: str
12
+ __version_tuple__: VERSION_TUPLE
13
+ version_tuple: VERSION_TUPLE
14
+
15
+ __version__ = version = '1.4.0'
16
+ __version_tuple__ = version_tuple = (1, 4, 0)
@@ -76,7 +76,7 @@ class Attributes(MutableMapping):
76
76
 
77
77
  def __setitem__(self, key, value):
78
78
  if key in _HIDDEN_ATTRS:
79
- raise AttributeError("cannot write attribute with reserved name %r" % key)
79
+ raise AttributeError(f"cannot write attribute with reserved name {key!r}")
80
80
  if hasattr(value, "dtype"):
81
81
  dtype = value.dtype
82
82
  else:
@@ -98,4 +98,4 @@ class Attributes(MutableMapping):
98
98
  return len(self._h5attrs) - hidden_count
99
99
 
100
100
  def __repr__(self):
101
- return "\n".join(["%r" % type(self)] + [f"{k}: {v!r}" for k, v in self.items()])
101
+ return "\n".join([f"{type(self)!r}"] + [f"{k}: {v!r}" for k, v in self.items()])