'Grids selected data columns in selected data file using 8 'different gridding methods and produces contour maps of 'the resulting grids to compare results. '1. Go to Script | Run '2. Select data file and click Open. '3. Enter the column number for the X data and click OK. '4. Enter the column number for the Y data and click OK. '5. Enter the column number for the Z data and click OK. '****************************************** Sub Main Dim SurferApp As Object Set SurferApp = CreateObject("Surfer.Application") SurferApp.Visible = True 'Specify the height of the map ylength = 2 'Specifies the data file to grid Data$ = GetFilePath( , "dat;csv;xls;xlsx",path1, "Data file to grid") If Data$ ="" Then End Dim Doc As Object Set Doc = SurferApp.Documents.Add 'Set data columns xcol= Val(InputBox$("Enter X column number. For example, Column A = 1", "X Column", "1")) ycol= Val(InputBox$("Enter Y column number. For example, Column B = 2", "Y Column", "2")) zcol= Val(InputBox$("Enter Z column number. For example, Column C = 3", "Z Column", "3")) 'Inverse Distance SurferApp.GridData(DataFile:=Data$, xcol:=xcol, ycol:=ycol, zcol:=zcol, Algorithm:=1, OutGrid:=Data$+"_InverseDistance.grd") Dim Map As Object Set Map = Doc.Shapes.AddContourMap(GridFileName:=Data$+"_InverseDistance.grd") Map.yLength = ylength Map.xMapPerPU = Map.yMapPerPU If Map.Width<3.5 Then Map.xMapPerPU=Map.yMapPerPU Else Map.xLength=3.5 Map.Axes("Bottom Axis").Title = "Inverse Distance" Map.Axes("Bottom Axis").TitleFont.ForeColorRGBA.Color = srfColorRed Map.Left = 0.25 Map.Top = 10.75 'Kriging SurferApp.GridData(DataFile:=Data$, xcol:=xcol, ycol:=ycol, zcol:=zcol, Algorithm:=2, OutGrid:=Data$+"_Kriging.grd") Dim Map2 As Object Set Map2 = Doc.Shapes.AddContourMap(GridFileName:=Data$+"_Kriging.grd") Map2.yLength = ylength Map2.xMapPerPU = Map.yMapPerPU If Map2.Width<3.5 Then Map2.xMapPerPU=Map2.yMapPerPU Else Map2.xLength=3.5 Map2.Axes("Bottom Axis").Title = "Kriging" Map2.Axes("Bottom Axis").TitleFont.ForeColorRGBA.Color = srfColorRed Map2.Left = 0.25 Map2.Top = 8.1 'Minimum Curvature SurferApp.GridData(DataFile:=Data$, xcol:=xcol, ycol:=ycol, zcol:=zcol, Algorithm:=3, OutGrid:=Data$+"_MinimumCurvature.grd") Dim Map3 As Object Set Map3 = Doc.Shapes.AddContourMap(GridFileName:=Data$+"_MinimumCurvature.grd") Map3.yLength = ylength Map3.xMapPerPU = Map.yMapPerPU If Map3.Width<3.5 Then Map3.xMapPerPU=Map3.yMapPerPU Else Map3.xLength=3.5 Map3.Axes("Bottom Axis").Title = "Minimum Curvature" Map3.Axes("Bottom Axis").TitleFont.ForeColorRGBA.Color = srfColorRed Map3.Left = 0.25 Map3.Top = 5.4 'Modified Shepard's Method SurferApp.GridData(DataFile:=Data$, xcol:=xcol, ycol:=ycol, zcol:=zcol, Algorithm:=4, OutGrid:=Data$+"_ModifiedShepard.grd") Dim Map4 As Object Set Map4 = Doc.Shapes.AddContourMap(GridFileName:=Data$+"_ModifiedShepard.grd") Map4.yLength = ylength Map4.xMapPerPU = Map.yMapPerPU If Map4.Width<3.5 Then Map4.xMapPerPU=Map4.yMapPerPU Else Map4.xLength=3.5 Map4.Axes("Bottom Axis").Title = "Modified Shepard's Method" Map4.Axes("Bottom Axis").TitleFont.ForeColorRGBA.Color = srfColorRed Map4.Left = 0.25 Map4.Top = 2.75 'Natural Neighbor SurferApp.GridData(DataFile:=Data$, xcol:=xcol, ycol:=ycol, zcol:=zcol, Algorithm:=5, OutGrid:=Data$+"_NaturalNeighbor.grd") Dim Map5 As Object Set Map5 = Doc.Shapes.AddContourMap(GridFileName:=Data$+"_NaturalNeighbor.grd") Map5.yLength = ylength Map5.xMapPerPU = Map.yMapPerPU If Map5.Width<3.5 Then Map5.xMapPerPU=Map5.yMapPerPU Else Map5.xLength=3.5 Map5.Axes("Bottom Axis").Title = "Natural Neighbor" Map5.Axes("Bottom Axis").TitleFont.ForeColorRGBA.Color = srfColorRed Map5.Left = 4.5 Map5.Top = 10.75 'Nearest Neighbor SurferApp.GridData(DataFile:=Data$, xcol:=xcol, ycol:=ycol, zcol:=zcol, Algorithm:=6, OutGrid:=Data$+"_NearestNeighbor.grd") Dim Map6 As Object Set Map6 = Doc.Shapes.AddContourMap(GridFileName:=Data$+"_NearestNeighbor.grd") Map6.yLength = ylength Map6.xMapPerPU = Map.yMapPerPU If Map6.Width<3.5 Then Map6.xMapPerPU=Map6.yMapPerPU Else Map6.xLength=3.5 Map6.Axes("Bottom Axis").Title = "Nearest Neighbor" Map6.Axes("Bottom Axis").TitleFont.ForeColorRGBA.Color = srfColorRed Map6.Left = 4.5 Map6.Top = 8.1 'Radial Basis Function SurferApp.GridData(DataFile:=Data$, xcol:=xcol, ycol:=ycol, zcol:=zcol, Algorithm:=8, OutGrid:=Data$+"_RadialBasisFunction.grd") Dim Map8 As Object Set Map8 = Doc.Shapes.AddContourMap(GridFileName:=Data$+"_RadialBasisFunction.grd") Map8.yLength = ylength Map8.xMapPerPU = Map.yMapPerPU If Map8.Width<3.5 Then Map8.xMapPerPU=Map8.yMapPerPU Else Map8.xLength=3.5 Map8.Axes("Bottom Axis").Title = "Radial Basis Function" Map8.Axes("Bottom Axis").TitleFont.ForeColorRGBA.Color = srfColorRed Map8.Left = 4.5 Map8.Top = 5.4 'Triangulation with Linear Interpolation SurferApp.GridData(DataFile:=Data$, xcol:=xcol, ycol:=ycol, zcol:=zcol, Algorithm:=9, OutGrid:=Data$+"_TriangulationLinearInterpolation.grd") Dim Map9 As Object Set Map9 = Doc.Shapes.AddContourMap(GridFileName:=Data$+"_TriangulationLinearInterpolation.grd") Map9.yLength = ylength Map9.xMapPerPU = Map.yMapPerPU If Map9.Width<3.5 Then Map9.xMapPerPU=Map9.yMapPerPU Else Map9.xLength=3.5 Map9.Axes("Bottom Axis").Title = "Triangulation with Linear Interpolation" Map9.Axes("Bottom Axis").TitleFont.ForeColorRGBA.Color = srfColorRed Map9.Left = 4.5 Map9.Top = 2.75 End Sub