Skip to content

Commit c333b62

Browse files
committed
tidy
2 parents 0975457 + 3d3d8d0 commit c333b62

37 files changed

+1921
-1787
lines changed

Changelog.rst

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
1-
version NEXTVERSION
2-
-------------------
1+
version 3.17.0
2+
--------------
3+
4+
**2025-??-??**
5+
6+
* Replace dataset aggregation functionality (CFA) with that imported
7+
from `cfdm` (https://github.com/NCAS-CMS/cf-python/issues/841)
8+
* Changed dependency: ``1.12.0.0<=cfdm<1.12.1.0``
9+
10+
----
11+
12+
version 3.16.3
13+
--------------
314

4-
**2024-12-??**
15+
**2025-01-28**
516

617
* Allow ``'nearest_dtos'`` 2-d regridding to work with discrete
718
sampling geometry source grids
@@ -24,7 +35,7 @@ version NEXTVERSION
2435
* New class `cf.CFAH5netcdfArray`
2536
* New class `cf.CFANetCDF4Array`
2637
* Replace core `dask` functionality with that imported from `cfdm`
27-
(https://github.com/NCAS-CMS/cf-python/pull/836)
38+
(https://github.com/NCAS-CMS/cf-python/issues/839)
2839
* Fix bug that sometimes puts an incorrect ``radian-1`` or
2940
``radian-2`` in the returned units of the differential operator
3041
methods and functions
@@ -43,9 +54,11 @@ version NEXTVERSION
4354
(https://github.com/NCAS-CMS/cf-python/issues/828)
4455
* New dependency: ``h5netcdf>=1.3.0``
4556
* New dependency: ``h5py>=3.10.0``
46-
* New dependency: ``s3fs>=2024.2.0``
57+
* New dependency: ``s3fs>=2024.6.0``
58+
* Changed dependency: ``numpy>=1.15,<2.0``
4759
* Changed dependency: ``1.11.2.0<=cfdm<1.11.3.0``
4860
* Changed dependency: ``cfunits>=3.3.7``
61+
* Changed dependency: ``dask>=2024.6.0,<=2024.7.1``
4962

5063
----
5164

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ The `cf` package uses
8484
[Dask](https://ncas-cms.github.io/cf-python/performance.html) for all
8585
of its array manipulation and can:
8686

87-
* read field constructs from netCDF, CDL, PP and UM datasets,
87+
* read field constructs from netCDF, CDL, PP and UM datasets with a
88+
choice of netCDF backends,and in local, http, and s3 locations,
8889
* create new field constructs in memory,
8990
* write and append field and domain constructs to netCDF datasets on disk,
9091
* read, create, and manipulate UGRID mesh topologies,

cf/__init__.py

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@
8181
"""
8282

8383
__Conventions__ = "CF-1.11"
84-
__date__ = "2024-??-??"
85-
__version__ = "3.17.0"
84+
__date__ = "2025-01-28"
85+
__version__ = "3.16.3"
8686

8787
_requires = (
8888
"numpy",
@@ -122,7 +122,7 @@
122122
raise ImportError(_error0 + str(error1))
123123

124124
try:
125-
import numpy
125+
import numpy as np
126126
except ImportError as error1:
127127
raise ImportError(_error0 + str(error1))
128128

@@ -190,10 +190,11 @@
190190

191191
# Check the version of numpy
192192
_minimum_vn = "1.22"
193-
if Version(numpy.__version__) < Version(_minimum_vn):
194-
raise RuntimeError(
195-
f"Bad numpy version: cf requires numpy>={_minimum_vn}. "
196-
f"Got {numpy.__version__} at {numpy.__file__}"
193+
_maximum_vn = "2.0"
194+
if not Version(_minimum_vn) <= Version(np.__version__) < Version(_maximum_vn):
195+
raise ValueError(
196+
"Bad numpy version: cf requires _minimum_vn}<=numpy<{_maximum_vn}. "
197+
f"Got {np.__version__} at {np.__file__}"
197198
)
198199

199200
# Check the version of cfunits
@@ -211,11 +212,23 @@
211212
if not Version(_minimum_vn) <= _cfdm_version < Version(_maximum_vn):
212213
raise RuntimeError(
213214
f"Bad cfdm version: cf requires {_minimum_vn}<=cfdm<{_maximum_vn}. "
214-
f"Got {_cfdm_version} at {cfdm.__file__}"
215+
f"Got {cfdm.__version__} at {cfdm.__file__}"
215216
)
216217

217218
# Check the version of dask
218219

220+
_minimum_vn = "2024.6.1"
221+
_maximum_vn = "2024.7.1"
222+
if (
223+
not Version(_minimum_vn)
224+
<= Version(dask.__version__)
225+
<= Version(_maximum_vn)
226+
):
227+
raise ValueError(
228+
"Bad dask version: cf requires {_minimum_vn}<=dask<={_maximum_vn}. "
229+
f"Got {dask.__version__} at {dask.__file__}"
230+
)
231+
219232
# Check the version of Python
220233
_minimum_vn = "3.8.0"
221234
if Version(platform.python_version()) < Version(_minimum_vn):
@@ -232,6 +245,8 @@
232245
f"Got {scipy.__version__} at {scipy.__file__}"
233246
)
234247

248+
del _minimum_vn, _maximum_vn
249+
235250
from .constructs import Constructs
236251

237252
from .mixin import Coordinate

cf/aggregate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3038,7 +3038,7 @@ def aggregate(
30383038

30393039
unaggregatable = False
30403040

3041-
# Record the names of theaxes thatr are actually aggregated
3041+
# Record the names of the axes that are actually aggregated
30423042
axes_aggregated = []
30433043

30443044
for axis in aggregating_axes:

cf/data/array/aggregatedarray.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class AggregatedArray(Container, cfdm.AggregatedArray):
1414
def __new__(cls, *args, **kwargs):
1515
"""Store fragment array classes.
1616
17-
.. versionadded:: (cfdm) NEXTVERSION
17+
.. versionadded:: NEXTVERSION
1818
1919
"""
2020
# Override the inherited FragmentFileArray class

cf/data/array/cfah5netcdfarray.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from .h5netcdfarray import H5netcdfArray
2+
from .mixin import CFAMixin
3+
4+
5+
class CFAH5netcdfArray(CFAMixin, H5netcdfArray):
6+
"""A CFA-netCDF array accessed with `h5netcdf`
7+
8+
.. versionadded:: 1.11.2.0
9+
10+
"""

cf/data/array/cfanetcdf4array.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from .mixin import CFAMixin
2+
from .netcdf4array import NetCDF4Array
3+
4+
5+
class CFANetCDF4Array(CFAMixin, NetCDF4Array):
6+
"""A CFA-netCDF array accessed with `netCDF4`.
7+
8+
.. versionadded:: 1.11.2.0
9+
10+
"""

cf/data/array/h5netcdfarray.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ class H5netcdfArray(
1616
An active storage reduction may be enabled with the `actify`
1717
method. See `cf.data.collapse.Collapse` for details.
1818
19-
.. versionadded:: NEXTVERSION
19+
.. versionadded:: 1.11.2.0
2020
2121
"""

cf/data/array/mixin/activestoragemixin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
class ActiveStorageMixin:
22
"""Mixin class for enabling active storage operations.
33
4-
.. versionadded:: NEXTVERSION
4+
.. versionadded:: 1.11.2.0
55
66
"""
77

@@ -12,7 +12,7 @@ def active_storage(self):
1212
Currently, active storage operations are allowed unless the
1313
data are numerically packed.
1414
15-
.. versionadded:: NEXTVERSION
15+
.. versionadded:: 1.11.2.0
1616
1717
:Returns:
1818

cf/data/array/mixin/arraymixin.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import numpy as np
2+
3+
from ....units import Units
4+
5+
6+
class ArrayMixin:
7+
"""Mixin class for a container of an array.
8+
9+
.. versionadded:: 3.14.0
10+
11+
"""
12+
13+
def __array_function__(self, func, types, args, kwargs):
14+
"""Implement the `numpy` ``__array_function__`` protocol.
15+
16+
.. versionadded:: 3.14.0
17+
18+
"""
19+
return NotImplemented
20+
21+
@property
22+
def _meta(self):
23+
"""Normalise the array to an appropriate Dask meta object.
24+
25+
The Dask meta can be thought of as a suggestion to Dask. Dask
26+
uses this meta to generate the task graph until it can infer
27+
the actual metadata from the values. It does not force the
28+
output to have the structure or dtype of the specified meta.
29+
30+
.. versionadded:: 1.11.2.0
31+
32+
.. seealso:: `dask.utils.meta_from_array`
33+
34+
"""
35+
return np.array((), dtype=self.dtype)
36+
37+
@property
38+
def Units(self):
39+
"""The `cf.Units` object containing the units of the array.
40+
41+
.. versionadded:: 3.14.0
42+
43+
"""
44+
return Units(self.get_units(None), self.get_calendar(None))

0 commit comments

Comments
 (0)