Error in the code for calculating the final variogram, error in hermitian matrices

I’m new to Julia and I’m trying to create a notebook that works with different geostatic methods, when I finish the code for calculating the final variogram this error appears:

begin

# Elipsoides de anisotropia (θ seguindo regra da mão esquerda)
ellipsoid₁ = Ellipsoid([rpri₁, rsec₁, rter₁], [azi, -dip, -θ], convention = GSLIB)

ellipsoid₂ = Ellipsoid([rpri₂, rsec₂, rter₂], [azi, -dip, -θ], convention = GSLIB)

# Estruturas do variograma final
γₒ = NuggetEffect(nugget = Float64(cₒ))

γ₁ = model[m](sill = Float64(c₁), distance = metric(ellipsoid₁))

γ₂ = model[m](sill = Float64(c₂), distance = metric(ellipsoid₂))

# Variograma final
γ = γₒ + γ₁ + γ₂

end;

The error would be this:

Only hermitian matrices are diagonalizable by StaticArrays. Non-Hermitian matrices should be converted to Array first.

  1. error (::String)@ error.jl:33
  2. #eigvals#619 @ eigen.jl:12 [inlined]
  3. #eigmin#80 @ eigen.jl:416 [inlined]
  4. eigmin @ eigen.jl:416 [inlined]
  5. (::Distances.var"#Mahalanobis#5#6")(::Bool, ::Type{Distances.Mahalanobis}, ::StaticArrays.SMatrix{3, 3, Float64, 9})@ mahalanobis.jl:28
  6. Distances.Mahalanobis (::StaticArrays.SMatrix{3, 3, Float64, 9})@ mahalanobis.jl:26
  7. var"#Ellipsoid#96" (::Type{Meshes.GSLIB}, ::Type{Meshes.Ellipsoid}, ::Vector{Float64}, ::Vector{Float64})@ ellipsoid.jl:41
  8. top-level scope @ Local: 4 [inlined]

Could someone explain to me the reason for this error and how do I fix it for the code to process?

Hi @jaquetdiamantino , this is an error that was fixed in more recent releases of the project. Can you please update to the latest release of GeoStats.jl v0.29.1 and use the new anisotropic model interface?

https://juliaearth.github.io/GeoStats.jl/stable/variography/theoretical.html#Anisotropy

Hi, @juliohm. Thanks for the feedback. So, I updated the new version of the update on the notebook and made some changes, but I’m having trouble conveting the rotation. So far the code looks like this:

begin

ellipsoid₁ = MetricBall([range(fit_gpri),range(fit_gsec), range(fit_gter)], [azi, dip, θ])

	# Estruturas do variograma final
γₒ = NuggetEffect(nugget = Float64(fit_gdh.nugget))

γ₁ = SineHoleVariogram(ellipsoid₁, sill = Float64(fit_gdh.sill))

# Variograma final
γ = γₒ + γ₁ 

end

I saw that the EulerAngles function is used to make the conversion, but I am not able to apply it in the algorithm.

Hi @jaquetdiamantino , what do you mean by apply the rotation in the algorithm?

Sorry, I used the wrong expression. It’s just that I’m working on a project of yours with Franco, and in the part of using a rotation convention, and defining the theoretical 3D variogram model, I wasn’t able to make the rotation convention of the GSLIB for the new function after the package update. But I think that now I get it, I used the GslibAngles function.

begin

ellipsoid₁ = MetricBall([range(fit_gpri),range(fit_gsec), range(fit_gter)], GslibAngles(azi, -dip, -θ))

	# Estruturas do variograma final
γₒ = NuggetEffect(nugget = Float64(fit_gdh.nugget))

γ₁ = SineHoleVariogram(ellipsoid₁, sill = Float64(fit_gdh.sill))

# Variograma final
γ = γₒ + γ₁ 

end

1 Like
 plot(thisvgm, fitvgm2, main = paste0(Reduce(paste, deparse(FORMULAS[[MOD]] )), " range = 15"), ylim = c(0,1500),
         panel = function(x, ...) {
           panel = vgm.panel.xyplot(x, ...);
           panel.abline(h = c(fitvgm2$psill[1],sum(fitvgm2$psill)), v = fitvgm2$range[2])})

I have try this out.

This is not Julia code @Larson , can you please explain why you are posting this random snippet in the thread?

Hi, @juliohm. After applying this code, post it here. I got the following answers:
NestedVariogram{2} (anisotropic)
structures
└─NuggetEffect(nugget=0.06113842883173626)
└─SineHoleVariogram(sill=0.22022981842719538, nugget=0.0, ranges=(161.74488721490707, 99.9464437260163, 57.37471854119326), metric=EulerAngles)
coefficients
└─1
└─1
So the metric = EulerAngles, which in my opinion I should have gotten the Mahalanobis metric. Is there any adjustment I should make more in this code?

Hi @jaquetdiamantino, EulerAngles is a rotation specification. Mahalanobis is a metric.

Can you please share the code you are using? Also, feel free to send me a direct message here or on Zulip in Portuguese if you find it easier. I can’t understand what you are trying to ask in English.