How to extract the covariance matrix of a defined model #327
-
Hi, Could anyone assist me with how I can extract the covariance matrix of any generated model? Thank you in advance, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi, what exactly do you mean by covariance matrix? - The Gaussian fields used here are completely defined by their covariance model. The fields are statistically homogeneous, except for an anisotropy factor along the main axes. |
Beta Was this translation helpful? Give feedback.
-
Hey there, my assumption is, you mean the covariance matrix used in simple-kriging (or any other kriging routine). I really though it was implemented there, but it seems, that this attribute is missing in the kriging classes. A temporary workaround to calculate import gstools as gs
from scipy.spatial.distance import pdist, squareform
# 2D x-y pos pairs for unstructured data
pos = ([2,3,4], [1,3,5])
model = gs.Gaussian(dim=2, nugget=0.5)
iso_pos = model.isometrize(pos)
cov_mat = model.cov_nugget(squareform(pdist(iso_pos.T)))
print(cov_mat) Maybe this helps in the meantime. Cheers, Sebastian |
Beta Was this translation helpful? Give feedback.
Hey there,
my assumption is, you mean the covariance matrix used in simple-kriging (or any other kriging routine).
I really though it was implemented there, but it seems, that this attribute is missing in the kriging classes.
A temporary workaround to calculate
cov_mat
could look like this:Maybe this helps in the meantime.
Cheers, Sebastian