Problem in using user-defined covariance base class (CovModel) #194
-
I am trying to generate a user-defined spatial random field in 2D (Earthquake slip realisations in my case) using the CovModel base class for Von-Karmen Auto-correlation function (link ). Unfortunately I am stuck at an error message and it is getting difficult to get past it. It would be a great help if you could help me get some insights to solve the issue. Here is the Covmodel I created- class VK(gs.CovModel):
def cor(self, h):
h = np.array(h, dtype=np.double)
nu = 0.8
res= (4*np.pi*nu*(h**nu)*sps.kv(nu, h)) /sps.kv(nu,h.min() )
return res I can plot spectral density using the covmodel but cannot create the model using SRF method. model = VK(dim=2)
slip_srf = gs.SRF(model,seed=10) I get a TypeError when I run the above commands.- TypeError: 'float' object cannot be interpreted as an integer |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey there, I see two problems here:
Hope that helps! |
Beta Was this translation helpful? Give feedback.
Hey there,
thanks for using GSTools.
I see two problems here:
emcee
but we fixed this in GSTools v1.3.2. so upgrading GSTools should solve this. (See: #183)K(v,0)
, which is infinit and the model would result in a constantly zero one.The cited reference has a similar definition:
But they use another function with a finite value to normalize the function.
In the end, the described model is exatly the matern model with a slightly modified rescaling factor. So I would recommend using this predefined model.
Hope that helps!
Cheers, sebastian