-
Hi, # Grid
gridx = np.arange(0.0, 5.5, 0.5)
gridy = np.arange(0.0, 5.5, 0.5)
# observations
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],
]
)
x=data[:, 0]
y=data[:, 1]
cond_val=data[:, 2]
# Drift-Samples
ext_drift_samp = np.array([0.5, 0.56, 0.5, 1.5, 1.8])
# drift at the grid level
grid_drift = np.ones((11,11))*0
# define kriging
model = Gaussian(dim=2, var=1, len_scale=2)
krig = krige.ExtDrift(model=model,
cond_pos=(x,y),
cond_val=cond_val,
ext_drift=ext_drift_samp)
krig((gridx, gridy), ext_drift=grid_drift) |
Beta Was this translation helpful? Give feedback.
Answered by
gld78
Apr 3, 2024
Replies: 2 comments
-
Hi, in the 2d case, you need two drift sample values per point, e.g. ext_drift_samp = np.array([0.5, 0.56, 0.5, 1.5, 1.8], [0.5, 0.56, 0.5, 1.5, 1.8]) By the way, instead of using grid_drift = np.ones((11,11))*0 you can use grid_drift = np.zeros((11,11)) |
Beta Was this translation helpful? Give feedback.
0 replies
-
Thanks for your suggestions. The following code seems to be ok for me: import numpy as np
from gstools import Gaussian, krige
# Grid
gridx = np.arange(0.0, 5.5, 0.5)
gridy = np.arange(0.0, 5.5, 0.5)
# observations
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],
]
)
x=data[:, 0]
y=data[:, 1]
cond_val=data[:, 2]
# Drift-Samples
ext_drift_samp = np.array([0.5, 0.56, 0.5, 1.5, 1.8])
# drift at the grid level
grid_drift = np.ones((11,11))*0
# define kriging
model = Gaussian(dim=2, var=1, len_scale=2)
krig = krige.ExtDrift(model=model,
cond_pos=(x,y),
cond_val=cond_val,
ext_drift=ext_drift_samp)
krig.structured((gridx, gridy), ext_drift=grid_drift)
krig.plot() |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
gld78
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for your suggestions.
Just one drift sample value per point seems to be fine.
I simply had to call ".structured"
The following code seems to be ok for me: