From 2edb899351f3a46593025c194641bc9caf7a49e8 Mon Sep 17 00:00:00 2001 From: Knut-Frode Dagestad Date: Tue, 2 Jul 2024 18:07:26 +0200 Subject: [PATCH 1/6] Testing with Numpy>=2.0 and netCDF>=1.7.1. Seems to work locally. --- environment.yml | 4 ++-- tests/models/test_models.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/environment.yml b/environment.yml index fde49ab62..3b8bf7f25 100644 --- a/environment.yml +++ b/environment.yml @@ -3,9 +3,9 @@ channels: - conda-forge dependencies: - matplotlib>=3.5 - - numpy>=1.17 + - numpy>=2.0 - scipy>=1.6 - - netcdf4<=1.6.1 + - netcdf4>=1.7.1 - ffmpeg - pyproj>=2.3 - libgdal>=3.1 diff --git a/tests/models/test_models.py b/tests/models/test_models.py index 9d99c2d7b..44ad6ca2f 100644 --- a/tests/models/test_models.py +++ b/tests/models/test_models.py @@ -168,7 +168,7 @@ def test_openberg(self): arr=[0.16072658,0.16466097,0.17384121,0.17325179,0.1715925,0.15592695] for indx in range(len(arr)): - self.assertAlmostEqual(o.uw_weighting[indx],arr[indx],8) + self.assertAlmostEqual(o.uw_weighting[indx],arr[indx],7) self.assertAlmostEqual(o.history['lon'].data[0][1],3.991, 3) self.assertAlmostEqual(o.history['lat'].data[0][1],62.011, 3) From bab48ab6dc9e463e1284bbfb5fecfdf857d786ca Mon Sep 17 00:00:00 2001 From: Knut-Frode Dagestad Date: Tue, 2 Jul 2024 18:18:31 +0200 Subject: [PATCH 2/6] [run-ex] Triggering examples on CircleCI --- examples/example_openoil.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/example_openoil.py b/examples/example_openoil.py index 6bda4bede..1f2ae1723 100755 --- a/examples/example_openoil.py +++ b/examples/example_openoil.py @@ -8,7 +8,7 @@ from opendrift.readers import reader_netCDF_CF_generic from opendrift.models.openoil import OpenOil -o = OpenOil(loglevel=20, weathering_model='noaa') +o = OpenOil(loglevel=20, location='Norway') print(o.oiltypes) # Print available oil types From 98b1574d0b53356fa015bf4fb570037e8f24f538 Mon Sep 17 00:00:00 2001 From: Knut-Frode Dagestad Date: Tue, 2 Jul 2024 18:38:56 +0200 Subject: [PATCH 3/6] [run-ex] Replacing matplotlib.cm.get_cmap with matplotlib.colormaps[color], ready for matplotlib 3.9 --- opendrift/models/basemodel/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opendrift/models/basemodel/__init__.py b/opendrift/models/basemodel/__init__.py index 647cea911..dd5ea0804 100644 --- a/opendrift/models/basemodel/__init__.py +++ b/opendrift/models/basemodel/__init__.py @@ -3114,7 +3114,7 @@ def plot_timestep(i): if cmap is None: cmap = 'jet' if isinstance(cmap, str): - cmap = matplotlib.cm.get_cmap(cmap) + cmap = matplotlib.colormaps[cmap] if color is not False: if isinstance(color, str): colorarray = self.get_property(color)[0].T @@ -3499,7 +3499,7 @@ def plot(self, lvmax = param.max() lc = LineCollection( segments, - #cmap=plt.get_cmap('Spectral'), + #cmap=plt.colormaps['Spectral'], cmap=cmap, norm=plt.Normalize(lvmin, lvmax), transform=gcrs) From 7cf06d4b727a03ee9bbc7f71752d93bb639d6f44 Mon Sep 17 00:00:00 2001 From: Knut-Frode Dagestad Date: Wed, 3 Jul 2024 07:53:25 +0200 Subject: [PATCH 4/6] Requiring Trajan >= 0.6.3 for Numpy >= 2.0 --- environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/environment.yml b/environment.yml index 3b8bf7f25..d3abebd4a 100644 --- a/environment.yml +++ b/environment.yml @@ -29,7 +29,7 @@ dependencies: - cmocean - utm - roaring-landmask>=0.7 - - trajan>=0.1.3 + - trajan>=0.6.3 - adios_db<1.2 - copernicusmarine - pip From 0f2c26a38e0ab0723f151e947f3c3fec4316f4e7 Mon Sep 17 00:00:00 2001 From: Knut-Frode Dagestad Date: Wed, 3 Jul 2024 12:58:06 +0200 Subject: [PATCH 5/6] Checking if netCDF<1.6.1 is compatible with numpy>2.0 --- environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/environment.yml b/environment.yml index d3abebd4a..0e1ce5683 100644 --- a/environment.yml +++ b/environment.yml @@ -5,7 +5,7 @@ dependencies: - matplotlib>=3.5 - numpy>=2.0 - scipy>=1.6 - - netcdf4>=1.7.1 + - netcdf4<=1.6.1 - ffmpeg - pyproj>=2.3 - libgdal>=3.1 From 8a6ae173ed3d00fc82da05164e5f68cffa631710 Mon Sep 17 00:00:00 2001 From: Knut-Frode Dagestad Date: Wed, 3 Jul 2024 13:02:53 +0200 Subject: [PATCH 6/6] Update environment.yml --- environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/environment.yml b/environment.yml index 0e1ce5683..a9104e0b6 100644 --- a/environment.yml +++ b/environment.yml @@ -3,7 +3,7 @@ channels: - conda-forge dependencies: - matplotlib>=3.5 - - numpy>=2.0 + - numpy<2.0 - scipy>=1.6 - netcdf4<=1.6.1 - ffmpeg