-
Notifications
You must be signed in to change notification settings - Fork 74
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 Error when Ordinary Kriging #31
Comments
Hey there, So all you have to change is:
Cheers, |
Added a readable exception message for such an input with commit efe78a7. |
Thanks for the feedback! Is using the first axis as the x,y,z axes consistent across the API? I didn't have an error when experimenting with Simple Kriging (however my results weren't great so maybe that's why) |
Ahh actually yes, I'm seeing now that this is consistent across the examples. |
Also, that dataset above was taking forever, so I'm trying to use a much smaller dataset now. I'm curious if you all could help me create a few examples of 3D kriging. Perhaps we start with this example from PyVista where we try kriging some 3D point data onto a "terrain" surface in 3D (in pyvista, we simply use a Gaussian kernel based interpolation)? This is what I have so far, but it's not really working: from gstools import Gaussian, krige
import numpy as np
import pyvista as pv
from pyvista import examples
surface = examples.download_saddle_surface()
samples = examples.download_sparse_points()
p = pv.Plotter()
p.add_mesh(samples, point_size=30.0, render_points_as_spheres=True)
p.add_mesh(surface)
p.show() cond_pos = samples.points.T
cond_val = samples['val']
# conditions
model = Gaussian(dim=3,)
krig = krige.Ordinary(model, cond_pos=cond_pos, cond_val=cond_val)
# create the kriging grid using the original dataset
x = surface.points[:, 0]
y = surface.points[:, 1]
z = surface.points[:, 2]
# Krige it
krig((x,y,z), mesh_type="structured")
# Grab a PyVista mesh
krigged = krig.to_pyvista()
krigged.plot() ... ran for a while then killed my kernel. My system info is as follows: >>> pv.Report(["scipy", "hankel", "emcee", ])
--------------------------------------------------------------------------------
Date: Wed Sep 25 17:02:15 2019 MDT
Darwin : OS
12 : CPU(s)
x86_64 : Machine
64bit : Architecture
32.0 GB : RAM
Jupyter : Environment
Python 3.7.3 | packaged by conda-forge | (default, Jul 1 2019, 14:38:56)
[Clang 4.0.1 (tags/RELEASE_401/final)]
1.3.0 : scipy
0.3.9 : hankel
3.0rc2 : emcee
0.22.2 : pyvista
8.2.0 : vtk
1.16.3 : numpy
2.5.0 : imageio
1.4.3 : appdirs
0.4.3 : scooby
3.1.0 : matplotlib
5.9.2 : PyQt5
7.6.1 : IPython
7.4.2 : ipywidgets
1.0.0 : colorcet
2.0 : cmocean
0.6.2 : panel
Intel(R) Math Kernel Library Version 2018.0.3 Product Build 20180406 for
Intel(R) 64 architecture applications
-------------------------------------------------------------------------------- |
Ahh... turns out I needed an cond_pos = samples.points.T
cond_val = samples['val']
# conditions
model = Gaussian(dim=3, len_scale=12)
krig = krige.Ordinary(model, cond_pos=cond_pos, cond_val=cond_val)
# create the kriging grid using the original dataset
x = surface.points[:, 0]
y = surface.points[:, 1]
z = surface.points[:, 2]
# Krige it
krig((x,y,z), mesh_type="unstructured")
# Grab a PyVista mesh
surface["krige"] = krig.field
surface.plot(scalars="krige") |
So this leaves me with one final question, are "structured" grids, strictly rectilinear? I.e the surface I use above is not rectilinear and thus "unstructured"? Solving it this way is totally fine as PyVista can manage all of the geometry and all GSTools needs are the node locations... |
Sure we can help! - But obviously, you're figuring out by yourself ;-) You're now the second one to stumble upon the nomenclature of "structured" / "unstructured". What exactly did you think the "structured" mesh would be? |
By the way, in case you really have trouble with long computation times, have you tried out compiling GSTools with OpenMP support? - It makes quite a difference:
|
I'm trying to teach myself how to use this library and thought I'd try out oridinary kriging but I keep running into an issue when I try to krige a random sample of points from a known dataset:
The text was updated successfully, but these errors were encountered: