-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #161 from GeoStat-Framework/develop
v1.5.1 release
- Loading branch information
Showing
24 changed files
with
1,101 additions
and
367 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,3 +121,4 @@ pykrige/_version.py | |
*.vtr | ||
examples/meuse_example_data/* | ||
*.ipynb_checkpoints/* | ||
examples/output.asc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
""" | ||
Ordinary Kriging Example | ||
======================== | ||
First we will create a 2D dataset together with the associated x, y grids. | ||
""" | ||
|
||
import numpy as np | ||
import pykrige.kriging_tools as kt | ||
from pykrige.ok import OrdinaryKriging | ||
import matplotlib.pyplot as plt | ||
|
||
|
||
data = np.array( | ||
[ | ||
[0.3, 1.2, 0.47], | ||
[1.9, 0.6, 0.56], | ||
[1.1, 3.2, 0.74], | ||
[3.3, 4.4, 1.47], | ||
[4.7, 3.8, 1.74], | ||
] | ||
) | ||
|
||
gridx = np.arange(0.0, 5.5, 0.5) | ||
gridy = np.arange(0.0, 5.5, 0.5) | ||
|
||
############################################################################### | ||
# Create the ordinary kriging object. Required inputs are the X-coordinates of | ||
# the data points, the Y-coordinates of the data points, and the Z-values of the | ||
# data points. If no variogram model is specified, defaults to a linear variogram | ||
# model. If no variogram model parameters are specified, then the code automatically | ||
# calculates the parameters by fitting the variogram model to the binned | ||
# experimental semivariogram. The verbose kwarg controls code talk-back, and | ||
# the enable_plotting kwarg controls the display of the semivariogram. | ||
|
||
OK = OrdinaryKriging( | ||
data[:, 0], | ||
data[:, 1], | ||
data[:, 2], | ||
variogram_model="linear", | ||
verbose=False, | ||
enable_plotting=False, | ||
) | ||
|
||
############################################################################### | ||
# Creates the kriged grid and the variance grid. Allows for kriging on a rectangular | ||
# grid of points, on a masked rectangular grid of points, or with arbitrary points. | ||
# (See OrdinaryKriging.__doc__ for more information.) | ||
|
||
z, ss = OK.execute("grid", gridx, gridy) | ||
|
||
############################################################################### | ||
# Writes the kriged grid to an ASCII grid file and plot it. | ||
|
||
kt.write_asc_grid(gridx, gridy, z, filename="output.asc") | ||
plt.imshow(z) | ||
plt.show() |
Oops, something went wrong.