Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
5 changes: 1 addition & 4 deletions xskillscore/core/np_deterministic.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,10 +362,7 @@ def _pearson_r_p_value(a, b, weights, axis, skipna):
# on 0d arrays is deprecated, as it behaves surprisingly. Use
# `atleast_1d(cond).nonzero()` if the old behavior was intended. If the context
# of this warning is of the form `arr[nonzero(cond)]`, just use `arr[cond]`.
nan_locs = np.where(np.isnan(np.atleast_1d(r)))
if len(nan_locs[0]) > 0:
res[nan_locs] = np.nan
return res
return np.where(np.isnan(r), np.nan, res)
Copy link

Copilot AI Oct 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic appears incorrect. np.where(np.isnan(r), np.nan, res) will return np.nan where r is NaN, but res where r is not NaN. However, if r is NaN, then res (which depends on r) should likely also be NaN. The condition should probably check if res is NaN, not r.

Suggested change
return np.where(np.isnan(r), np.nan, res)
return res

Copilot uses AI. Check for mistakes.


def _pearson_r_eff_p_value(a, b, axis, skipna):
Expand Down
2 changes: 1 addition & 1 deletion xskillscore/core/probabilistic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1006,8 +1006,8 @@ def discrimination(
array([[0.00437637, 0.15536105, 0.66739606, 0.12472648, 0.04814004],
[0.00451467, 0.16704289, 0.66365688, 0.1241535 , 0.04063205]])
Coordinates:
* forecast_probability (forecast_probability) float64 40B 0.1 0.3 0.5 0.7 0.9
* event (event) bool 2B True False
* forecast_probability (forecast_probability) float64 40B 0.1 0.3 0.5 0.7 0.9

References
----------
Expand Down
3 changes: 2 additions & 1 deletion xskillscore/core/stattests.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,12 @@ def multipletests(
[ 0.1 , 0.1 , 0.1 ],
[ 0.1 , 0.1 , 0.1 ]]])
Coordinates:
* result (result) <U15 240B 'reject' ... 'alphacBonf'
* x (x) int64 24B 0 1 2
* y (y) int64 24B 0 1 2
multipletests_method <U6 24B 'fdr_bh'
multipletests_alpha float64 8B 0.1
* result (result) <U15 240B 'reject' ... 'alphacBonf'

"""
MULTIPLE_TESTS = [
"bonferroni",
Expand Down