From e83d5571de5a08dd74a5bfe2c14b299abceefd0e Mon Sep 17 00:00:00 2001 From: Miguel Jimenez Date: Fri, 18 Oct 2024 15:41:11 -0700 Subject: [PATCH] compatibility with numpy>=2.0 and + (#452) * make numpy >= 2.0 compatible * update environment on sciserver-catalog * remove pin from numpy - it should still match the minimal dependency requirement as xarray --- .github/workflows/ci.yaml | 2 +- binder/environment.yml | 3 ++- ci/environment.yml | 3 ++- oceanspy/utils.py | 4 ++-- pyproject.toml | 6 +++--- sciserver_catalogs/environment.yml | 7 ++++--- 6 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 34ee293a..f827d556 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -26,7 +26,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.9', '3.10', '3.11'] + python-version: ['3.10', '3.11', '3.12'] steps: - uses: actions/checkout@v4 diff --git a/binder/environment.yml b/binder/environment.yml index 0c7739cc..3004ce08 100644 --- a/binder/environment.yml +++ b/binder/environment.yml @@ -15,9 +15,10 @@ dependencies: - xoak - cartopy - esmpy +- intake=0.7 - intake-xarray - geopy -- xesmf > 0.6.3 +- xesmf>0.6.3 - esmf - xgcm - Ipython diff --git a/ci/environment.yml b/ci/environment.yml index faf37c30..b2f6ed4f 100644 --- a/ci/environment.yml +++ b/ci/environment.yml @@ -6,11 +6,12 @@ dependencies: - distributed - bottleneck - netCDF4 +- numpy - xarray - xoak - cartopy - scipy -- intake +- intake=0.7 - intake-xarray - geopy - xesmf > 0.6.3 diff --git a/oceanspy/utils.py b/oceanspy/utils.py index 5c063c26..e8d2550b 100644 --- a/oceanspy/utils.py +++ b/oceanspy/utils.py @@ -520,7 +520,7 @@ def densjmd95(s, t, p): if isinstance(var, _xr.DataArray): var = var.astype("float") else: - var = _np.asfarray(var) + var = _np.asarray(var, _np.float64) # coefficients nonlinear equation of state in pressure coordinates for # 1. density of fresh water at p = 0 @@ -681,7 +681,7 @@ def densmdjwf(s, t, p): if isinstance(var, _xr.DataArray): var = var.astype("float") else: - var = _np.asfarray(var) + var = _np.asarray(var, _np.float64) # coefficients nonlinear equation of state in pressure coordinates for eosMDJWFnum = [ diff --git a/pyproject.toml b/pyproject.toml index 88f8f344..9341b89e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,14 +9,14 @@ classifiers = [ "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Topic :: Scientific/Engineering" ] dependencies = [ "dask", - "xarray >= 0.14.1", + "xarray >= 2024.7.0", "xgcm >= 0.2.0", "shapely" ] @@ -25,7 +25,7 @@ dynamic = ["version"] license = {file = "LICENSE"} name = "oceanspy" readme = "README.rst" -requires-python = ">=3.9" +requires-python = ">=3.10" [tool.coverage.run] branch = true diff --git a/sciserver_catalogs/environment.yml b/sciserver_catalogs/environment.yml index 30c4396c..a4fd2ad8 100644 --- a/sciserver_catalogs/environment.yml +++ b/sciserver_catalogs/environment.yml @@ -2,8 +2,9 @@ name: Oceanography channels: - conda-forge dependencies: -- python=3.10 +- python=3.11 - dask +- numpy - distributed - bottleneck - netCDF4 @@ -12,7 +13,7 @@ dependencies: - cartopy - esmpy - geopy -- xesmf > 0.6.3 +- xesmf>0.6.3 - esmf - xgcm - Ipython @@ -54,7 +55,7 @@ dependencies: - imageio - pre-commit - xmitgcm -- intake +- intake=0.7 - intake-xarray - pip: - black-nb