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

refactor(lgrutil): coerce numpy types to builtins for np2 compat #2158

Merged
merged 1 commit into from
Apr 19, 2024

Conversation

wpbonelli
Copy link
Member

@wpbonelli wpbonelli commented Apr 18, 2024

@wpbonelli wpbonelli mentioned this pull request Apr 18, 2024
5 tasks
@wpbonelli wpbonelli marked this pull request as ready for review April 18, 2024 21:24
@wpbonelli wpbonelli requested a review from langevin-usgs April 18, 2024 21:30
Copy link
Contributor

@langevin-usgs langevin-usgs left a comment

Choose a reason for hiding this comment

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

This seems a bit surprising to me that we have to explicitly wrap numpy scalars with int and float, but glad you were able to implement a fix.

@wpbonelli
Copy link
Member Author

wpbonelli commented Apr 19, 2024

Numpy migration notes say this is expected for expressions where float32 is combined with the builtin float, this was the only one caught by a test but there are probably more cases where the change in promotion rules leads to slightly different results,. In general it may suffice to relax test comparisons but where we return non-numpy data structures (as here) it seems worth converting any np scalars to builtins for consistency

@wpbonelli wpbonelli merged commit 029a4e1 into modflowpy:develop Apr 19, 2024
24 checks passed
@wpbonelli wpbonelli deleted the numpy2 branch April 19, 2024 12:06
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