GithubHelp home page GithubHelp logo

Comments (8)

bsmurphy avatar bsmurphy commented on May 21, 2024 1

PyKrige doesn't use search parameters in the same way that Surfer does; by default all points in the dataset are used to solve the kriging system. There is an option to specify a number of closest points to use in solving the kriging problem (the 'moving window' capability). You can invoke that by using the n_closest_points kwarg when calling the execute method (see the docstrings). We currently don't support the elliptical search window thing that other kriging packages use. (Mainly because no one has requested or worked on that yet, although in my opinion this capability also can cause more trouble than it's worth.)

from pykrige.

bsmurphy avatar bsmurphy commented on May 21, 2024 1

Sounds like you would want to use the anisotropy parameters in your problem -- you can specify the angle of anisotropy and the relative scaling between the principle directions in order to essentially define a new internal coordinate system in which the variogram model is the same in all directions. Inside the code, once you specify the anisotropy direction and scaling, the data coordinates are translated into this new coordinate system and then the kriging problem is actually solved in this 'uniform' coordinate system. The point is just to take into account exactly your kind of problem, where things aren't changing in the same way in different directions. Adjusting for anisotropy makes the problem 'homogeneous' in some sense.

You're right, using a uniform search radius or n_closest_points does somewhat ignore this kind of anisotropy. @rth, if we do end up implementing a search radius kwarg (which I think we should do, definitely a nice feature to have), we should be sure to search on the anisotropy-adjusted data, that way it'll be in the 'uniform' coordinate space...

Using an elliptical search window would allow you to do something similar, but I think actually implementing anisotropy explicitly (i.e., in the PyKrige formulation) would be a better bet in your case... If you end up using it on your data, please let us know how it works for you! I've never used the anisotropy parameters myself in any problems, so any input on how it's working would be useful. (Also, if you need help making sense of the anisotropy settings, let us know...)

from pykrige.

bsmurphy avatar bsmurphy commented on May 21, 2024 1

So the call to OrdinaryKriging should look something like this:

OrdinaryKriging(x, y, z, anisotropy_angle=90., anisotropy_scaling=2., variogram_model='linear', variogram_parameters=[1., 0.])

I'd recommend looking at the docstring for the OrdinaryKriging class as well, just to make sure the way in which the anisotropy is handle is as you'd expect with these values (specifically, the new y direction is multiplied by 2 I think, not the x direction...).

from pykrige.

rth avatar rth commented on May 21, 2024

Also, a good description of Surfer search parameters can be found here and in here, I think (never used it myself).

As @bsmurphy mentioned, the only search parameter we support at the moment is n_closest_points, though I believe we could add a spherical search radius (which would be simpler than the elliptical one) if that would be useful. What search parameters are you interested in?

from pykrige.

SBFRF avatar SBFRF commented on May 21, 2024

so forgive me here, as i'm not all that familar with the innards of the krigging. but doesn't the search ellipse allow one to make an assumption about the data, ie the data are going to vary in a similar manner. for my case, we use the search window to define the cross shore and along shore widths of beach transect data. where we can make the assumption about the data that the beach profile will vary more in the cross shore direction than it does in the alongshore direction. ie the beach gets deeper faster than it varies moving down the beach. if one uses a 'moving window' or n_closest_points I feel like that would weight them, for lack of a better way to put it, weird? no?

from pykrige.

SBFRF avatar SBFRF commented on May 21, 2024

so i implement the following arguments in addition to the search ellipse in surfer. which I've also included in the initialization on your OK class
anisotropyAngle = 90
anisotropyRatio=2
VariogramSlope=1

from pykrige.

SBFRF avatar SBFRF commented on May 21, 2024

so my notes are two fold: First, If the anisotropy parameters take care of the anisotropy of the data, then what do the search parameters do? are the simply to make the variogram generation more efficient (ie not looking at the whole data set) ?

Secondly, while I've added those, i'm running into constant memory issues when using this interpolation scheme. I've attached the data (and code) for reference.
from pykrige.ok import OrdinaryKriging
import numpy as np
x _grid = np.loadtxt('gridX.txt', delimiter=',', usecols=[0])
y_grid = np.loadtxt('gridY.txt', delimiter=',', usecols=[0])
data_x, data_y, data_z = np.loadtxt('xyzGridparms.txt', delimiter=',', usecols=[0,1,2], unpack=True)
ok = OrdinaryKriging(data_x, data_y, data_z, anisotropy_angle=90,
anisotropy_scaling=2,
variogram_parameters=[1, 0.],
variogram_model='linear')
newBathyGrid, ss = ok.execute('grid', x_grid, y_grid, backend='C', n_closest_points=40)

gridX.txt
gridY.txt
xyzGridparms.txt

from pykrige.

MuellerSeb avatar MuellerSeb commented on May 21, 2024

Closing due to inactivity. Feel free to re-open.

from pykrige.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.