Welcome to Golden Software Support

Two Variogram Components in Kriging

Comments

5 comments

  • Avatar
    Kari Dickenson

    Hi Dave,

    Create the variogram first and then use the variogram with Kriging. For example:

    Sub Main 
    Dim SurferApp As Object
    Set SurferApp = CreateObject("Surfer.Application")
    SurferApp.Visible = True
    Dim Plot As Object

    Set Plot = SurferApp.Documents.Add
    MyDataFile = SurferApp.Path+"\Samples\demogrid.dat"

    'Create a variogram
    Set MyVariogram = Plot.Shapes.AddVariogram(MyDataFile)

    'Create 3 variogram components
    Dim VarioComponents(1 To 3) As Object
    Set VarioComponents(1) = SurferApp.NewVarioComponent(srfVarExponential, Param1:=3, Param2:=4.5)
    Set VarioComponents(2) = SurferApp.NewVarioComponent(VarioType:=srfVarLogarithmic,Param1:=2, Param2:=2.5, AnisotropyRatio:=0.5, AnisotropyAngle:=52)
    Set VarioComponents(3) = SurferApp.NewVarioComponent(VarioType:=srfVarPower,Param1:=2.1, Param2:=3.2, Power:=1.9, AnisotropyRatio:=0.8, AnisotropyAngle:=125)

    'Change the parameters for variogram component 2 (Logarithmic) to Nugget Effect
    VarioComponents(2).Set(VarioType:=srfVarNugget, Param1:=0.2, Param2:=2.3)

    'Set the AutoFit parameter limits for component 1 (Exponential):
    'Scale of variogram component 1
    VarioComponents(1).SetFitLimits(Param:=srfVarParam1, LowerLimit:=0.5, UpperLimit:=50)

    'Length of variogram component 1
    VarioComponents(1).SetFitLimits(Param:=srfVarParam2, LowerLimit:=0.25, UpperLimit:=250)

    ' Anisotropy Ratio of variogram component 1
    VarioComponents(1).SetFitLimits(Param:=srfVarParamRatio, LowerLimit:=1, UpperLimit:=10)

    'Anisotropy Angle of variogram component 1
    VarioComponents(1).SetFitLimits(Param:=srfVarParamAngle, LowerLimit:=-180, UpperLimit:=180)

    'Use the components in the variogram
    outgrid = "C:\temp\Forum_Variogram.grd"

    MyVariogram.Model=VarioComponents

    SurferApp.GridData3 (Datafile:=MyDataFile, KrigVariogram:=VarioComponents, Outgrid:=outgrid)

    Plot.Shapes.AddContourMap(GridFileName:=outgrid)

    End Sub

     

    Thanks,

    Kari

    0
    Comment actions Permalink
  • Avatar
    Kari Dickenson

    Hi Dave,

    It's not the same as in the user interface. There isn't a way to add a component - you create new ones. So you do have to explicitly state which components you want, including the linear model. For example, this will only use the Nugget Effect, not Nugget+Linear.

    Sub Main 

    Dim SurferApp As Object
    Set SurferApp = CreateObject("Surfer.Application")

    SurferApp.Visible = True

    Dim Plot As Object
    Set Plot = SurferApp.Documents.Add

    Dim VarioComponent As Object
    Set VarioComponent = SurferApp.NewVarioComponent(VarioType:=srfVarNugget, Param1:=3.1, Param2:=4.7)

    SurferApp.GridData(DataFile:=SurferApp.Path+"\samples\Demogrid.dat", Algorithm:=srfKriging, ShowReport:=False, KrigVariogram:=VarioComponent, OutGrid:="c:\temp\Demogrid_V.grd")

    Set Map = Plot.Shapes.AddContourMap(GridFileName:="c:\temp\Demogrid_V.grd")

    End Sub

    Thanks,

    Kari

    0
    Comment actions Permalink
  • Avatar
    Kari Dickenson

    Hi Dave,

    Ok, good luck! Let me know if you have any other questions. The KrigVariogram parameter should work, as long as the components are defined correctly. Let me know if you'd like to work on it.

    Thanks,

    Kari

    0
    Comment actions Permalink
  • Avatar
    Dave Paton
    OK, thanks Kari. But I'm still wondering about this. When you go and manually create a kriging variogram, under Advanced Options, the Linear model is already in there and you just Add the nugget effect. In Scripter, is this also the way it works, that the linear model is there by default and you simply add whatever other components you want, OR, do you have to explicitly state which components you want in the variogram, including the linear model?
    0
    Comment actions Permalink
  • Avatar
    Dave Paton
    I think I might bail on my variogram algorithm from kriging in favor of natural neighbor. It appears to be a bit more simple to program and appears to give about the same results as kriging. VB.net has changed something and now I can't get the KrigVariogram component to work, though it did until recently. Natural neighbor seems to work just fine with fewer moving parts.
    0
    Comment actions Permalink

Please sign in to leave a comment.