Added error variance of 0.5, and micro variance of 0.5 for proper curve smoothing (code added is below).
Set components(1) = surferApp.NewVarioComponent(srfVarLinear)
Set components(2) = surferApp.NewVarioComponent(srfVarNugget, 0.5, 0.5)
Code used to grid data using multiple Variogram components
Sub Main
Dim surferApp, COntourMap As Object
Dim inputFile, Gridfile As String
Dim outputPath As String
Dim dirPath As String
Set surferApp = CreateObject("Surfer.Application")
dirPath = "C:\Documents and Settings\Administrator\My Documents\research\FEMA Projects\Rainfall Reports\"
inputFile = dirPath + "StationCoordinatesModified.xls"
outputPath = dirPath + "Grid Files\KrigingNugget5-5\"
' Here we simply Grid COlumns 8 (1 hr ) To columns
Dim outGridFilename As String
Dim colDurations(11) As String
colDurations(1) = "1HR"
colDurations(2) = "2HR"
colDurations(3) = "6HR"
colDurations(4) = "12HR"
colDurations(5) = "24HR"
colDurations(6) = "48HR"
colDurations(7) = "72HR"
colDurations(8) = "4D"
colDurations(9) = "5D"
Dim sheets(9) As String
sheets(1) = "Sheet=2 Year"
sheets(2) = "Sheet=3 Year"
sheets(3) = "Sheet=5 Year"
sheets(4) = "Sheet=10 Year"
sheets(5) = "Sheet=25 Year"
sheets(6) = "Sheet=50 Year"
sheets(7) = "Sheet=100 Year"
sheets(8) = "Sheet=200 Year"
Dim ReturnPeriods(9) As String
ReturnPeriods(1) = "2YR"
ReturnPeriods(2) = "3YR"
ReturnPeriods(3) = "5YR"
ReturnPeriods(4) = "10YR"
ReturnPeriods(5) = "25YR"
ReturnPeriods(6) = "50YR"
ReturnPeriods(7) = "100YR"
ReturnPeriods(8) = "200YR"
' An output for each krig method will be produced
'SrfGridAlgorithm Values
'Value Description
'srfInverseDistance Inverse Distance To a Power
'srfKriging Kriging
'srfMinCurvature Minimum Curvature
'srfShepards Modified Shepard's Method
'srfNaturalNeighbor Natural Neighbor
'srfNearestNeighbor Nearest Neighbor
'srfRegression Polynomial Regression
'srfRadialBasis Radial Basis Functions
'srfTriangulation Triangulation With Linear Interpolation
'srfMovingAverage Moving Average
'srfDataMetrics Data Metrics
'srfLocalPolynomial Local Polynomial
' To open a specific worksheet inside a spreadsheet, we must open the file within the
' documents collection and set the active sheet.
Dim ReturnPeriod As String
Dim i As Integer
Dim j As Integer
Dim components(1 To 2) As Object
Set components(1) = surferApp.NewVarioComponent(srfVarLinear)
Set components(2) = surferApp.NewVarioComponent(srfVarNugget, 0.5, 0.5)
For j=1 To 8
Set wksdoc1 = surferApp.Documents.Open(inputFile, Options:=sheets(j))
ReturnPeriod = ReturnPeriods(j)
For i=1 To 9
surferApp.GridData DataFile:=inputFile, xcol:=6, ycol:=5, zcol:=i+7, Algorithm:=srfKriging, KrigVariogram:=components, DupMethod:=srfDupNone, ShowReport:=False, OutGrid:=outputPath+ReturnPeriod+colDurations(i)+".grd"
Next i
wksdoc1.Close(SaveChanges:=srfSaveChangesNo)
Next j
End Sub
|
Comments (0)
You don't have permission to comment on this page.