Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get core Dask functionality from cfdm #836

Merged
merged 31 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ version NEXTVERSION
(https://github.com/NCAS-CMS/cf-python/issues/828)
* New dependency: ``h5netcdf>=1.3.0``
* New dependency: ``h5py>=3.10.0``
* New dependency: ``s3fs>=2024.2.0``
* New dependency: ``s3fs>=2024.6.0``
* Changed dependency: ``numpy>=1.15,<2.0``
* Changed dependency: ``1.11.2.0<=cfdm<1.11.3.0``
* Changed dependency: ``cfunits>=3.3.7``
* Changed dependency: ``dask>=2024.6.0,<=2024.7.1``
davidhassell marked this conversation as resolved.
Show resolved Hide resolved

----

Expand Down
35 changes: 27 additions & 8 deletions cf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
raise ImportError(_error0 + str(error1))

try:
import numpy
import numpy as np
except ImportError as error1:
raise ImportError(_error0 + str(error1))

Expand Down Expand Up @@ -191,10 +191,11 @@

# Check the version of numpy
_minimum_vn = "1.22"
if Version(numpy.__version__) < Version(_minimum_vn):
raise RuntimeError(
f"Bad numpy version: cf requires numpy>={_minimum_vn}. "
f"Got {numpy.__version__} at {numpy.__file__}"
_maximum_vn = "2.0"
if not Version(_minimum_vn) <= Version(np.__version__) < Version(_maximum_vn):
raise ValueError(
"Bad numpy version: cf requires _minimum_vn}<=numpy<{_maximum_vn}. "
f"Got {np.__version__} at {np.__file__}"
)

# Check the version of cfunits
Expand All @@ -208,15 +209,31 @@
# Check the version of cfdm
_minimum_vn = "1.11.2.0"
_maximum_vn = "1.11.3.0"
_cfdm_version = Version(cfdm.__version__)
if not Version(_minimum_vn) <= _cfdm_version < Version(_maximum_vn):
if (
not Version(_minimum_vn)
<= Version(cfdm.__version__)
< Version(_maximum_vn)
):
raise RuntimeError(
f"Bad cfdm version: cf requires {_minimum_vn}<=cfdm<{_maximum_vn}. "
f"Got {_cfdm_version} at {cfdm.__file__}"
f"Got {cfdm.__version__} at {cfdm.__file__}"
)

# Check the version of dask

# Check the version of numpy
davidhassell marked this conversation as resolved.
Show resolved Hide resolved
_minimum_vn = "2024.6.1"
_maximum_vn = "2024.7.1"
if (
not Version(_minimum_vn)
<= Version(dask.__version__)
<= Version(_maximum_vn)
):
raise ValueError(
"Bad dask version: cf requires {_minimum_vn}<=dask<={_maximum_vn}. "
f"Got {dask.__version__} at {dask.__file__}"
)

# Check the version of Python
_minimum_vn = "3.8.0"
if Version(platform.python_version()) < Version(_minimum_vn):
Expand All @@ -233,6 +250,8 @@
f"Got {scipy.__version__} at {scipy.__file__}"
)

del _minimum_vn, _maximum_vn

from .constructs import Constructs

from .mixin import Coordinate
Expand Down
8 changes: 5 additions & 3 deletions docs/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,11 @@ Required

* `Python <https://www.python.org/>`_, 3.8.0 or newer.

* `numpy <https://pypi.org/project/numpy/>`_, 1.22.0 or newer.
* `numpy <http://www.numpy.org>`_, versions 1.15 up to, but not
including, 2.0.

* `dask <https://pypi.org/project/dask/>`_, 2022.12.1 or newer.
* `dask <https://pypi.org/project/dask>`_, versions 2024.6.0 to
2024.7.1 inclusive.

* `netCDF4 <https://pypi.org/project/netcdf4/>`_, 1.6.5 or newer.

Expand All @@ -206,7 +208,7 @@ Required

* `h5py <https://pypi.org/project/h5py>`_, version 3.10.0 or newer.

* `s3fs <https://pypi.org/project/s3fs>`_, version 2024.2.0 or newer.
* `s3fs <https://pypi.org/project/s3fs>`_, version 2024.6.0 or newer.

* `scipy <https://pypi.org/project/scipy>`_, version 1.10.0 or newer.

Expand Down
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
netCDF4>=1.6.5
cftime>=1.6.2
numpy>=1.22
numpy>=1.22,<2.0
cfdm>=1.11.2.0, <1.11.3.0
psutil>=0.6.0
cfunits>=3.3.7
dask>=2024.4.0
dask>=2024.6.0,<=2024.7.1
packaging>=20.0
scipy>=1.10.0
h5netcdf>=1.3.0
h5py>=3.10.0
s3fs>=2024.2.0
s3fs>=2024.6.0
Loading