Skip to content

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

Merged
wpbonelli merged 1 commit into
modflowpy:developfrom
wpbonelli:numpy2
Apr 19, 2024
Merged

refactor(lgrutil): coerce numpy types to builtins for np2 compat#2158
wpbonelli merged 1 commit into
modflowpy:developfrom
wpbonelli:numpy2

Conversation

@wpbonelli
Copy link
Copy Markdown
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
Copy link
Copy Markdown

@christianlangevin christianlangevin 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
Copy Markdown
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
@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