Predict Function Issues #3
-
Was using the geokrige module for some spatial geometry interpolation, and tried to use the geopandas package to read a shapefile to a msehgrid.
This was what I used, according to the documentation page. But this error popped up:
I assumed it was some sort of issue with the shapefile, and tried troubleshooting with no success, so I tried the tutorial code:
But the same error still pops up. I think the issue lies with how the numpy package handles the numpy.meshgrid function. The current version (1.7.0) of numpy outputs a tuple, which clashes with the input for the predict function, I am not sure how to change my output to fix the code. Edit:I seemed to have fixed it by changing the source code, around line 387, where it was originally
and it seemed to work as the documentation showed. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hello @Psychodogs, Thank you so much for your valuable feedback! Your observations are greatly appreciated and will undoubtedly help improve the GeoKrige package. I’ve taken some time to investigate the issue, and here are my findings. Notes
You are absolutely correct. The issue arises because GeoKrige expects the
Are you sure you’re using Numpy version 1.7.0? That version was released back in 2013, and according to the documentation,
Your modification would likely make GeoKrige work with the latest version of Numpy, but I’d consider it more of a workaround for the moment than a proper fix. GeoKrige has been tested primarily with Numpy versions below 2.0.0, so making such changes could introduce instability in other areas of the package, as the differences between Numpy 1.x and 2.x seem to be significant. If you'd like to continue using Numpy >=2.0.0, I suggest an alternative workaround: before passing the meshgrid to the My RecommendationFor now, I recommend using Numpy versions >= 1.24.3 and <= 1.26.4.While the Next Steps
Thanks again for bringing this topic to attention! |
Beta Was this translation helpful? Give feedback.
Hello @Psychodogs,
Thank you so much for your valuable feedback! Your observations are greatly appreciated and will undoubtedly help improve the GeoKrige package. I’ve taken some time to investigate the issue, and here are my findings.
Notes
You are absolutely correct. The issue arises because GeoKrige expects the
X
parameter in thepredict
method to be either alist
or anumpy.ndarray
. Historically, thenumpy.meshgrid
function returned a list ofndarray
objects, but starting from version 2.0.0, it returns a tuple ofndarray
objects. This change is what’s causing the …