From 220b8bee94b5860f4349900cf12e9b942a26ee3d Mon Sep 17 00:00:00 2001 From: Julian Quick Date: Wed, 18 Feb 2026 18:08:47 -0800 Subject: [PATCH 1/6] numpy 2: trapz -- trapazoid --- pyproject.toml | 1 + wifa/wayve_api.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index ee5be33..de6ac2e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,6 +44,7 @@ dependencies = [ "wayve @ git+https://gitlab.kuleuven.be/TFSO-software/wayve@dev_foxes", "xarray>=2022.0.0,<2025", "mpmath", + "numpy>=2.0.0", ] [project.optional-dependencies] diff --git a/wifa/wayve_api.py b/wifa/wayve_api.py index 768df92..1aeb0e6 100644 --- a/wifa/wayve_api.py +++ b/wifa/wayve_api.py @@ -824,8 +824,8 @@ def flow_io_abl(wind_resource_dat, time_index, zh, h1, dh_max=None, serz=True): ) # Geostrophic wind speed z = np.linspace(h, 15.0e3, 1000) - U3 = np.trapz(np.interp(z, zs, us), z) / (15.0e3 - h) - V3 = np.trapz(np.interp(z, zs, vs), z) / (15.0e3 - h) + U3 = np.trapezoid(np.interp(z, zs, us), z) / (15.0e3 - h) + V3 = np.trapezoid(np.interp(z, zs, vs), z) / (15.0e3 - h) # Upper layer thickness h2 = h - h1 if ( From 2cd833f8495e7f957c4838aa3357caa4b9c5e154 Mon Sep 17 00:00:00 2001 From: Julian Quick Date: Fri, 20 Feb 2026 10:07:55 -0800 Subject: [PATCH 2/6] patch from https://github.com/EUFLOW/WIFA/pull/47 --- wifa/wayve_api.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/wifa/wayve_api.py b/wifa/wayve_api.py index 1aeb0e6..09af766 100644 --- a/wifa/wayve_api.py +++ b/wifa/wayve_api.py @@ -824,8 +824,9 @@ def flow_io_abl(wind_resource_dat, time_index, zh, h1, dh_max=None, serz=True): ) # Geostrophic wind speed z = np.linspace(h, 15.0e3, 1000) - U3 = np.trapezoid(np.interp(z, zs, us), z) / (15.0e3 - h) - V3 = np.trapezoid(np.interp(z, zs, vs), z) / (15.0e3 - h) + _trapezoid = np.trapezoid if hasattr(np, "trapezoid") else np.trapz + U3 = _trapezoid(np.interp(z, zs, us), z) / (15.0e3 - h) + V3 = _trapezoid(np.interp(z, zs, vs), z) / (15.0e3 - h) # Upper layer thickness h2 = h - h1 if ( From b0d5cea0fe4702bea7103b12a0093b74148d5e0f Mon Sep 17 00:00:00 2001 From: Julian Quick Date: Fri, 20 Feb 2026 10:10:07 -0800 Subject: [PATCH 3/6] no need to specify numpy version now --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index de6ac2e..ee5be33 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,7 +44,6 @@ dependencies = [ "wayve @ git+https://gitlab.kuleuven.be/TFSO-software/wayve@dev_foxes", "xarray>=2022.0.0,<2025", "mpmath", - "numpy>=2.0.0", ] [project.optional-dependencies] From 26dba9f3ef90d38dfb3038caa2902e6b71caf4bd Mon Sep 17 00:00:00 2001 From: Jonas Schulte Date: Mon, 23 Feb 2026 08:29:47 +0100 Subject: [PATCH 4/6] replace np.trapz call by identical getattr --- wifa/wayve_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wifa/wayve_api.py b/wifa/wayve_api.py index 09af766..b1794b5 100644 --- a/wifa/wayve_api.py +++ b/wifa/wayve_api.py @@ -824,7 +824,7 @@ def flow_io_abl(wind_resource_dat, time_index, zh, h1, dh_max=None, serz=True): ) # Geostrophic wind speed z = np.linspace(h, 15.0e3, 1000) - _trapezoid = np.trapezoid if hasattr(np, "trapezoid") else np.trapz + _trapezoid = getattr(np, "trapezoid") if hasattr(np, "trapezoid") else getattr(np, "trapz") U3 = _trapezoid(np.interp(z, zs, us), z) / (15.0e3 - h) V3 = _trapezoid(np.interp(z, zs, vs), z) / (15.0e3 - h) # Upper layer thickness From 4db6149ae67cc7c3614d9418798898b50bbce940 Mon Sep 17 00:00:00 2001 From: Jonas Schulte Date: Mon, 23 Feb 2026 08:36:36 +0100 Subject: [PATCH 5/6] formatting --- wifa/wayve_api.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/wifa/wayve_api.py b/wifa/wayve_api.py index b1794b5..5a7e725 100644 --- a/wifa/wayve_api.py +++ b/wifa/wayve_api.py @@ -824,7 +824,11 @@ def flow_io_abl(wind_resource_dat, time_index, zh, h1, dh_max=None, serz=True): ) # Geostrophic wind speed z = np.linspace(h, 15.0e3, 1000) - _trapezoid = getattr(np, "trapezoid") if hasattr(np, "trapezoid") else getattr(np, "trapz") + _trapezoid = ( + getattr(np, "trapezoid") + if hasattr(np, "trapezoid") + else getattr(np, "trapz") + ) U3 = _trapezoid(np.interp(z, zs, us), z) / (15.0e3 - h) V3 = _trapezoid(np.interp(z, zs, vs), z) / (15.0e3 - h) # Upper layer thickness From 29770206b81c58052a49848152897dc6bb347870 Mon Sep 17 00:00:00 2001 From: Jonas Schulte Date: Mon, 23 Feb 2026 08:40:00 +0100 Subject: [PATCH 6/6] formatting --- wifa/wayve_api.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wifa/wayve_api.py b/wifa/wayve_api.py index 5a7e725..7d113db 100644 --- a/wifa/wayve_api.py +++ b/wifa/wayve_api.py @@ -825,8 +825,8 @@ def flow_io_abl(wind_resource_dat, time_index, zh, h1, dh_max=None, serz=True): # Geostrophic wind speed z = np.linspace(h, 15.0e3, 1000) _trapezoid = ( - getattr(np, "trapezoid") - if hasattr(np, "trapezoid") + getattr(np, "trapezoid") + if hasattr(np, "trapezoid") else getattr(np, "trapz") ) U3 = _trapezoid(np.interp(z, zs, us), z) / (15.0e3 - h)