-
Notifications
You must be signed in to change notification settings - Fork 53
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
3D Kriging Example. #124
Comments
Hey @JorjeousJorje, thanks for the question. Hope this helps! |
Thank you for such a detailed answer. But, unfortunately, I can't interpolate 3D with either Can I share my code with you to figure out where I'm wrong? Of course, if you have the time. Thank you in advance for the answer! |
@JorjeousJorje yeah go ahead and post the code here. However, depending on your hardware (memory allocation is a hardware limitation), the sample size, and the fact that you are interpolating ~1.6M points, 60min doesn't seem too crazy to me. A workaround for skgstat (and possibly also gstools) would be to work in batches. ie. interpolate 100x 127x127 grids and |
Hey there, from gstools import Gaussian, krige
# condtions
cond_pos = ... # your condition position tuple (x,y,z)
cond_val = ... # your condition values
# resulting grid
gridx = ... # your structured output 3d grid tuple given by (x,y,z) axes
# ordinary kriging setup
model = Gaussian(dim=3, var=0.5, len_scale=2)
krig = krige.Ordinary(model, cond_pos=cond_pos, cond_val=cond_val)
krig.structured(grid, chunk_size=10000) # you can play around with "chunk_size" I don't know how many condition points you have, but it could also help to not use the pseudo-inverse to build up the kriging matrix and try the actual inverse if it is possible. This could speed up the kriging setup: krig = krige.Ordinary(model, cond_pos=cond_pos, cond_val=cond_val, pseudo_inv=False) Hope that helps, |
@mmaelicke Here is my code:
as a result of that I have memory error: And talking about @MuellerSeb Thank you, I will try chunking! Thanks for help! |
Thanks, @MuellerSeb your insights are, as always, very welcome. If you want to stick to skgstat, I guess the point here is the sample size. The Variogram has to calculate a distance matrix of about ~ 16129**2 / 2. That takes time. There are two approaches here:
GSTools has that probabilistic approach implemented as well. As performance matters here, I would suggest that you use gstools anyway. While the Variogram is of sufficient speed, the Kriging (in skgstat) is not. GSTools is much faster here. You can also pass down arguments using the interface if you want to stick to skgstat for the variography part: krige = V.to_gs_krige(pseudo_inv=False)
krige.structured(grid, chunk_size=10000) Yeah, the pickle AttributeError is what I came across some time ago myself. I think we re-indroduced this error when @redhog made some substantial changed to the Kriging algorithm. I'll have to check that out, again. |
Got the same error for a 2D grid... maybe an easy way out is using CloudPickle or joblib pickle/dump? |
Hey @srggrs, @JorjeousJorje, The work-in-progress branch can be checked out like: git clone git@github-com:mmaelicke/scikit-gstat
cd scikit-gstat
git checkout use-joblib
pip install -e . Still, the Kriging code needs some rework, especially the multi-processing part. I won't invest too much time, as Best, |
As a short addtition: Something like: vario = skg.Variogram(...)
krige = vario.to_gs_krige() # This is a gstools.Krige instance!
krige.structured(grid, chunk_size=10000) Please note, that gstools is not a dependency of skgstat, thus you need to install that first:
|
Hello! Will examples for 3D Kriging be added in the future? Thanks for the answer!
The text was updated successfully, but these errors were encountered: