Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Numpy 2.0 compatibility #211

Merged
merged 3 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/whatsnew/0.2.1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

Enhancements
~~~~~~~~~~~~
* Compatibility with numpy 2.0. (:pull:``)
kandersolar marked this conversation as resolved.
Show resolved Hide resolved


Bug Fixes
Expand Down
10 changes: 5 additions & 5 deletions pvanalytics/quality/irradiance.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@
'ghi_ratio': {
'low_zenith': {
'zenith_bounds': [0.0, 75],
'ghi_bounds': [50, np.Inf],
'ghi_bounds': [50, np.inf],
'ratio_bounds': [0.92, 1.08]},
'high_zenith': {
'zenith_bounds': [75, 93],
'ghi_bounds': [50, np.Inf],
'ghi_bounds': [50, np.inf],
'ratio_bounds': [0.85, 1.15]}},
'dhi_ratio': {
'low_zenith': {
'zenith_bounds': [0.0, 75],
'ghi_bounds': [50, np.Inf],
'ghi_bounds': [50, np.inf],
'ratio_bounds': [0.0, 1.05]},
'high_zenith': {
'zenith_bounds': [75, 93],
'ghi_bounds': [50, np.Inf],
'ghi_bounds': [50, np.inf],
'ratio_bounds': [0.0, 1.10]}}}


Expand Down Expand Up @@ -392,7 +392,7 @@ def clearsky_limits(measured, clearsky, csi_max=1.1):
csi = pvlib.irradiance.clearsky_index(
measured,
clearsky,
max_clearsky_index=np.Inf
max_clearsky_index=np.inf
)
return quality.util.check_limits(
csi, upper_bound=csi_max, inclusive_upper=True
Expand Down
6 changes: 3 additions & 3 deletions pvanalytics/tests/quality/test_outliers.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,21 @@ def test_tukey_lower_criteria():


def test_zscore_raise_nan_input():
data = pd.Series([1, 0, -1, 0, np.NaN, 1, -1, 10])
data = pd.Series([1, 0, -1, 0, np.nan, 1, -1, 10])

with pytest.raises(ValueError):
outliers.zscore(data, nan_policy='raise')


def test_zscore_invalid_nan_policy():
data = pd.Series([1, 0, -1, 0, np.NaN, 1, -1, 10])
data = pd.Series([1, 0, -1, 0, np.nan, 1, -1, 10])

with pytest.raises(ValueError):
outliers.zscore(data, nan_policy='incorrect_str')


def test_zscore_omit_nan_input():
data = pd.Series([1, 0, -1, 0, np.NaN, 1, -1, 10])
data = pd.Series([1, 0, -1, 0, np.nan, 1, -1, 10])
assert_series_equal(
pd.Series([False, False, False, False, False, False, False, True]),
outliers.zscore(outliers.zscore(data, nan_policy='omit'))
Expand Down
Loading