Skip to content

Conversation

@aaronspring
Copy link
Collaborator

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Closes #(issue)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Performance (if you touched existing code run asv to detect performance changes)
  • refactoring

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. This could point to a cell in the updated notebooks. Or a snippet of code with accompanying figures here.

Checklist (while developing)

  • I have added docstrings to all new functions.
  • I have commented my code, particularly in hard-to-understand areas
  • Tests added for pytest, if necessary.

Pre-Merge Checklist (final steps)

  • I have rebased onto main or develop (wherever I am merging) and dealt with any conflicts.
  • I have squashed commits to a reasonable amount, and force-pushed the squashed commits.

References

Please add any references to manuscripts, textbooks, etc.

aaronspring and others added 8 commits October 15, 2025 17:41
This PR completes the fixes started in PR #435 by removing all remaining
np.atleast_1d() calls that were causing numerical differences in p-value
calculations with NumPy 2.x.

Changes:
- Remove np.atleast_1d() from _effective_sample_size (line 146)
- Remove np.atleast_1d() from _pearson_r_p_value (line 350)
- Simplify NaN handling in _pearson_r_p_value using np.where()
- Simplify NaN handling in _pearson_r_eff_p_value using np.where()
- Remove np.atleast_1d() from _spearman_r_p_value (line 483)

These changes ensure that p-value calculations return the same numerical
results with NumPy 2.x as they did with NumPy 1.x, fixing doctest failures
in downstream packages like climpred.

Fixes numerical regression introduced in v0.0.27.
Completes #435
Related to pangeo-data/climpred#870

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Fix discrimination doctest coordinate order by enforcing consistent ordering
- Suppress NumPy scalar conversion warnings in multipletests
- Update pearson_r_eff_p_value doctest to reflect behavior change from #437

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Remove duplicate result coordinate definition in stattests.py
The PR incorrectly changed two doctest expectations:

1. In pearson_r_eff_p_value, the expected value at [2,2] was changed from 'nan' to '1.', but the actual output is still 'nan' after removing np.atleast_1d() calls.

2. In multipletests, the coordinate order was changed, but the actual output has 'result' coordinate last, not first.

This commit fixes both doctest expectations to match the actual output, resolving CI test failures.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants