-
Notifications
You must be signed in to change notification settings - Fork 529
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 #3461
numpy 2.0 compatibility #3461
Conversation
Looks good, maybe also add test cases without turning warnings into errors and network test cases? |
Yea, maybe change it later.. only concern is how that would blow up the size of our test matrix. Working on the numpy stuff rn |
from np.uint8 into 4 digit year
It's looking quite good. Not a lot more to figure out, I think, based on local tests. Let's see CI. Need to fix some bitshift thing in mseed and some precision loss issue in realtime that needs some upcasting in places probably. Most dangerous stuff I've seen is when things like |
The test fail in trace preview creation seems to come from a numpy bug (or at least changed behavior, kind of) in the If numpy doesn't change this we likely want to add something like this replacing all ptp usage across our code: def ptp(x, *args, **kwargs):
if np.ma.is_masked(x):
return np.ma.ptp(x, *args, **kwargs)
return np.ptp(x, *args, **kwargs) EDIT: Problem kind of is that now there's two functions |
otherwise the later bitshifting etc doesn't work as expected
see numpy/numpy#13718 for a deprecation warning shown in |
since we're using a non-interactive backend during tests, plt.show() cant open a window
when running tests, obspy gets imported before warning filter rules specified in pytest.ini take effect, since conftest.py gets loaded, which sits in the root obspy source code directory and then the __init__.py gets loaded which imports the main core classes and functions into our main namespace. so the only way to make "pytest -W error" pass without error is to ignore that warning directly in our obspy root __init__.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks all good to me! Amazing job here!
I think this is ready. Most changes for numpy v2.0 are quite trivial, mostly replacing some removed function with its drop in replacement. The most concern is numpy from v2 not automatically upcasting to higher datatypes wherever needed, which can lead to e.g. This also happens in some bitwise operations. I'm not really used to using bitwise operations a lot, so if somebody could double check these, would be great. In any case tests still pass.. Network test fails are unrelated, something broke with EarthScope FDSN WS That one failing test on windows is unrelated too, looks like an issue with removing read permission from a test file (so we can check it is skipped by our Scanner utility) |
What does this PR do?
Tries to get ourselves ready for upcoming numpy 2.0 in June 2024
Why was it initiated? Any relevant Issues?
fixes #3460
PR Checklist
master
for new features,maintenance_...
for bug fixesno_ci
label can be added to skip CI buildsJust add the
build_docs
tag to this PR.Docs will be served at docs.obspy.org/pr/{branch_name} (do not use master branch).
Please post a link to the relevant piece of documentation.
clients.fdsn
) should be tested for the PR,just add the
test_network
tag to this PR.CHANGELOG.txt
.CONTRIBUTORS.txt
.from all the CI builds look correct. Add the "upload_plots" tag so that plotting
outputs are attached as artifacts.
CODEOWNERS
with your github handleready for review
label when you are ready for the PR to be reviewed.