Skip to content

Commit 02409f1

Browse files
Pin numpy version (#58)
1 parent 3c99967 commit 02409f1

7 files changed

Lines changed: 26 additions & 25 deletions

File tree

.github/pull_request_template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
### This PR is related to user story DST-
2+
### This PR is related to user story [ESS-XXXX](url_to_jira_task)
33

44
## Description
55
Provide a short description about the work that has been done.

.github/workflows/ci.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
matrix:
1515
os: [ubuntu-latest, windows-latest]
16-
python-version: ["3.8", "3.9", "3.10"]
16+
python-version: ["3.9", "3.10", "3.11"]
1717

1818
steps:
1919
- uses: actions/checkout@v2
@@ -36,4 +36,4 @@ jobs:
3636

3737
- name: Test doc build with tox
3838
run: tox -e docs
39-
if: ${{ (matrix.python-version == '3.9') && (matrix.os == 'ubuntu-latest')}}
39+
if: ${{ (matrix.python-version == '3.10') && (matrix.os == 'ubuntu-latest')}}

.github/workflows/deploy_public.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ jobs:
3535
steps:
3636
- uses: actions/checkout@v3
3737

38-
- name: Set up Python 3.9
38+
- name: Set up Python 3.10
3939
uses: actions/setup-python@v4
4040
with:
41-
python-version: "3.9"
41+
python-version: "3.10"
4242

4343
- name: Install dependencies
4444
run: |

pyproject.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,20 @@ dynamic = ["version"]
1111
description = "Vessel motion and wave utilities"
1212
readme = "README.md"
1313
license = { file="LICENSE" }
14-
requires-python = ">=3.8"
14+
requires-python = ">=3.9"
1515
classifiers = [
16-
"Programming Language :: Python :: 3.8",
1716
"Programming Language :: Python :: 3.9",
1817
"Programming Language :: Python :: 3.10",
18+
"Programming Language :: Python :: 3.11",
1919
"License :: OSI Approved :: MIT License",
2020
"Operating System :: Unix",
2121
"Operating System :: Microsoft :: Windows",
2222
]
2323
dependencies = [
24-
"numpy",
24+
"numpy<2.0.0",
2525
"pandas",
2626
"scipy",
27+
"pyarrow"
2728
]
2829

2930
[project.urls]
@@ -53,7 +54,7 @@ deps =
5354
pytest-cov
5455
5556
[testenv:docs]
56-
basepython = python3.9
57+
basepython = python3.10
5758
commands = sphinx-build -W -b html -d {toxworkdir}/docs_doctree docs {toxworkdir}/docs_out
5859
deps =
5960
sphinx==5.3.0

src/waveresponse/_core.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from numbers import Number
44

55
import numpy as np
6-
from scipy.integrate import trapz
6+
from scipy.integrate import trapezoid
77
from scipy.interpolate import interp2d
88
from scipy.special import gamma
99

@@ -1392,7 +1392,7 @@ def var(self):
13921392
x = self._full_range_dir(self._dirs)
13931393
y = self._freq
13941394
zz = self.interpolate(y, x, freq_hz=False, degrees=False)
1395-
return trapz([trapz(zz_x, x) for zz_x in zz], y)
1395+
return trapezoid([trapezoid(zz_x, x) for zz_x in zz], y)
13961396

13971397
def std(self):
13981398
"""
@@ -1452,7 +1452,7 @@ def spectrum1d(self, axis=1, freq_hz=None, degrees=None):
14521452
else:
14531453
raise ValueError("'axis' must be 0 or 1.")
14541454

1455-
spectrum = np.array([trapz(zz_y, y) for zz_y in zz])
1455+
spectrum = np.array([trapezoid(zz_y, y) for zz_y in zz])
14561456
return x, spectrum
14571457

14581458
def moment(self, n, freq_hz=None):
@@ -1484,7 +1484,7 @@ def moment(self, n, freq_hz=None):
14841484
14851485
"""
14861486
f, spectrum = self.spectrum1d(axis=1, freq_hz=freq_hz)
1487-
m_n = trapz((f**n) * spectrum, f)
1487+
m_n = trapezoid((f**n) * spectrum, f)
14881488
return m_n
14891489

14901490
@property
@@ -1618,8 +1618,8 @@ def _mean_direction(dirs, spectrum):
16181618
spectrum : array-like
16191619
1-D spectrum directional distribution.
16201620
"""
1621-
sin = trapz(np.sin(dirs) * spectrum, dirs)
1622-
cos = trapz(np.cos(dirs) * spectrum, dirs)
1621+
sin = trapezoid(np.sin(dirs) * spectrum, dirs)
1622+
cos = trapezoid(np.cos(dirs) * spectrum, dirs)
16231623
return _robust_modulus(np.arctan2(sin, cos), 2.0 * np.pi)
16241624

16251625
def dirp(self, degrees=None):

tests/test_core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3346,7 +3346,7 @@ def test_moment_m2_hz(self):
33463346

33473347
m_expect = (1.0 / 3.0) * (0.0 - 360.0) * (f0**3 - f1**3)
33483348

3349-
# not exactly same due to error in trapz for higher order functions
3349+
# not exactly same due to error in trapezoid for higher order functions
33503350
assert m_out == pytest.approx(m_expect, rel=0.1)
33513351

33523352
def test_moment_m2_rads(self):
@@ -3364,7 +3364,7 @@ def test_moment_m2_rads(self):
33643364
(1.0 / 3.0) * (0.0 - 360.0) * (f0**3 - f1**3) * (2.0 * np.pi) ** 2
33653365
)
33663366

3367-
# not exactly same due to error in trapz for higher order functions
3367+
# not exactly same due to error in trapezoid for higher order functions
33683368
assert m_out == pytest.approx(m_expect, rel=0.1)
33693369

33703370
def test_tz(self):

tests/test_standardized1d.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,10 @@ def test__call__var(self):
182182
spectrum = wr.ModifiedPiersonMoskowitz(freq)
183183

184184
freq_rad, ps_rad = spectrum(3.5, 10.0, freq_hz=False)
185-
var_rad = integrate.trapz(ps_rad, freq_rad)
185+
var_rad = integrate.trapezoid(ps_rad, freq_rad)
186186

187187
freq_hz, ps_hz = spectrum(3.5, 10.0, freq_hz=True)
188-
var_hz = integrate.trapz(ps_hz, freq_hz)
188+
var_hz = integrate.trapezoid(ps_hz, freq_hz)
189189

190190
assert var_rad == pytest.approx(var_hz)
191191

@@ -212,10 +212,10 @@ def test__call__var(self):
212212
spectrum = wr.JONSWAP(freq)
213213

214214
freq_rad, ps_rad = spectrum(3.5, 10.0, freq_hz=False)
215-
var_rad = integrate.trapz(ps_rad, freq_rad)
215+
var_rad = integrate.trapezoid(ps_rad, freq_rad)
216216

217217
freq_hz, ps_hz = spectrum(3.5, 10.0, freq_hz=True)
218-
var_hz = integrate.trapz(ps_hz, freq_hz)
218+
var_hz = integrate.trapezoid(ps_hz, freq_hz)
219219

220220
assert var_rad == pytest.approx(var_hz)
221221

@@ -385,10 +385,10 @@ def test__call__var(self):
385385
spectrum = wr.OchiHubble(freq)
386386

387387
freq_rad, ps_rad = spectrum(3.5, 10.0, freq_hz=False)
388-
var_rad = integrate.trapz(ps_rad, freq_rad)
388+
var_rad = integrate.trapezoid(ps_rad, freq_rad)
389389

390390
freq_hz, ps_hz = spectrum(3.5, 10.0, freq_hz=True)
391-
var_hz = integrate.trapz(ps_hz, freq_hz)
391+
var_hz = integrate.trapezoid(ps_hz, freq_hz)
392392

393393
assert var_rad == pytest.approx(var_hz)
394394

@@ -598,10 +598,10 @@ def test__call__var(self):
598598
spectrum = wr.Torsethaugen(freq)
599599

600600
freq_rad, ps_rad = spectrum(3.5, 10.0, freq_hz=False)
601-
var_rad = integrate.trapz(ps_rad, freq_rad)
601+
var_rad = integrate.trapezoid(ps_rad, freq_rad)
602602

603603
freq_hz, ps_hz = spectrum(3.5, 10.0, freq_hz=True)
604-
var_hz = integrate.trapz(ps_hz, freq_hz)
604+
var_hz = integrate.trapezoid(ps_hz, freq_hz)
605605

606606
assert var_rad == pytest.approx(var_hz)
607607

0 commit comments

Comments
 (0)