Skip to content

Commit 6c81c85

Browse files
committed
Allow numpy>=2. The application of the polynomial for the pressure wind relation always returns a numpy array with for 2.x, but returns the same type as the input for 1.x. I added the metpy wrapper to this part of the function so it will return xarray if xarray is passed and made sure the result is always a numpy array inside the function so it is consistent across 1.x and 2.x
1 parent ede1af3 commit 6c81c85

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

huracanpy/tc/_ace.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Module containing functions to compute ACE
33
"""
44

5+
import numpy as np
56
from numpy.polynomial.polynomial import Polynomial
67
import xarray as xr
78
import pint
@@ -275,11 +276,16 @@ def get_pressure_wind_relation(pressure, wind=None, model=None, **kwargs):
275276
"Need to specify either wind or model to calculate pressure-wind relation"
276277
)
277278

278-
wind_from_fit = model(pressure)
279+
wind_from_fit = _get_wind_from_model(pressure, model)
279280

280281
return wind_from_fit, model
281282

282283

284+
@preprocess_and_wrap(wrap_like="pressure")
285+
def _get_wind_from_model(pressure, model):
286+
return np.array(model(pressure))
287+
288+
283289
# Pre-determined pressure-wind relationships
284290
_z2021 = Polynomial([1.43290190e01, 5.68356519e-01, -1.05371378e-03])
285291

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ authors = [
99
description = "A python package for working with various forms of feature tracking data"
1010
requires-python = ">=3.8, <3.13"
1111
dependencies = [
12-
"numpy<2",
12+
"numpy",
1313
"xarray",
1414
"cftime",
1515
"parse",

0 commit comments

Comments
 (0)