Fix crash in oblique_proj on NumPy 2 - #5
Open
HugoFara wants to merge 1 commit into
Open
Conversation
RectBivariateSpline.ev returns a shape-(1,) ndarray, not a scalar.
Assigning it to a scalar element of out_var was tolerated by NumPy 1.x
(DeprecationWarning since 1.25) but is an error on NumPy 2:
ValueError: setting an array element with a sequence
This makes oblique_proj unusable for both the 3D and 2D paths on any
current installation. setup.py requires numpy>=1.26.4 with no upper
bound, so a fresh install picks up NumPy 2 and the function raises.
Reproduced with Python 3.14.6, NumPy 2.4.6, SciPy 1.18.0.
Meso-NH already carries this fix in its in-tree copy of the module
(src/LIB/Python/misc_functions.py); this ports it back so the two
copies match byte for byte again.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
RectBivariateSpline.evreturns a shape-(1,)array, assigned into a scalar element ofout_var. NumPy 1.x warned; NumPy 2 raises, andsetup.pyallowsnumpy>=1.26.4uncapped:Both the 3D and 2D branches fail, so
oblique_projis unusable on a fresh install. Fixed with.item().Verified on NumPy 2.5.2 — reproduced on
main, both paths pass after.Meso-NH already carries this fix in its copy at
src/LIB/Python/misc_functions.py; this makes the two files identical again.