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

Fix scipy 1.14 compatibility and trapz usage #228

Merged
merged 8 commits into from
Jun 28, 2024

Conversation

djhoese
Copy link
Member

@djhoese djhoese commented Jun 27, 2024

CC @arcanerr

The scipy.integrate.trapz function is deprecated. This adds a try/except around importing trapezoid versus trapz. I'm not sure how long we want to keep this workaround as trapezoid has been around since at least January of 2023 from what I can tell in git.

@djhoese djhoese added the bug label Jun 27, 2024
@djhoese djhoese requested a review from adybbroe June 27, 2024 14:36
@djhoese djhoese self-assigned this Jun 27, 2024
Copy link

codecov bot commented Jun 27, 2024

Codecov Report

Attention: Patch coverage is 93.10345% with 2 lines in your changes missing coverage. Please review.

Project coverage is 89.82%. Comparing base (5853de5) to head (239c410).
Report is 43 commits behind head on main.

Files with missing lines Patch % Lines
pyspectral/radiance_tb_conversion.py 66.66% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #228      +/-   ##
==========================================
- Coverage   90.00%   89.82%   -0.19%     
==========================================
  Files          23       23              
  Lines        2571     2535      -36     
==========================================
- Hits         2314     2277      -37     
- Misses        257      258       +1     
Flag Coverage Δ
unittests 89.82% <93.10%> (-0.19%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@djhoese
Copy link
Member Author

djhoese commented Jun 27, 2024

FYI for you @adybbroe when you find time to review this: A lot of the test changes are because numpy 2's np.testing.assert_allclose now checks dtype and asserts that dtypes are the same (or at least as far as I can tell). So a lot of the numpy-based tests would use 64-bit float input arrays and then compare against a 32-bit float expected result array. This used to work fine, but now numpy 2 compares about comparing 32-bit with 64-bit. Otherwise, there are just a few spots where numpy 2 now upcasts things where it didn't before.

Copy link
Collaborator

@adybbroe adybbroe left a comment

Choose a reason for hiding this comment

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

LGTM. Nice with the more compact tests!
I was actually not aware that trapz was deprecated. I think we keep the try-except for now.

@djhoese djhoese merged commit 277628f into pytroll:main Jun 28, 2024
16 of 17 checks passed
@djhoese djhoese deleted the bugfix-scipy114-compat branch June 28, 2024 01:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pyspectral 0.13.1 not compatible with SciPy 1.14.x -> update dependencies
2 participants