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

numpy._core._exceptions._UFuncOutputCastingError: Cannot cast ufunc 'subtract' output from dtype('float64') to dtype('int64') with casting rule 'same_kind' #300

Open
fish4terrisa-MSDSM opened this issue Nov 15, 2024 · 0 comments

Comments

@fish4terrisa-MSDSM
Copy link

A bug seems happened in the pykrige/core.py, with numpy 2.1.3,
Given the following output:

Traceback (most recent call last):
  File "/usr/src/matrix-tests/./matrix2.py", line 52, in <module>
    values_pred = OK.execute('points', x_266, y_266)[0]
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/pykrige/ok.py", line 880, in execute
    xpts, ypts = _adjust_for_anisotropy(
                 ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/pykrige/core.py", line 145, in _adjust_for_anisotropy
    X -= center
numpy._core._exceptions._UFuncOutputCastingError: Cannot cast ufunc 'subtract' output from dtype('float64') to dtype('int64') with casting rule 'same_kind'

A fast fix would be adding this line

X = X.astype('float64')

before the line

X -= center

in file pykrige/core.py .
(I'm not sure whether that fix will cause any side effects, though. And I'm hoping for official fixes.)

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

No branches or pull requests

1 participant