GridData6

GridData6 creates a grid from irregularly spaced XYZ data. Grid files are required to create different types of maps, including contour, color relief, vector, 3D surface, and 3D wireframe. The grid data files are typically randomly spaced files, and this data must be converted into an evenly spaced grid before using. GridData6 returns a Boolean value. It returns 'True' if the grid file is successfully created, otherwise returns 'False'.

Syntax

object.GridData6( DataFile, xCol, yCol, zCol, ExclusionFilter, DupMethod, xDupTol, yDupTol, NumCols, NumRows, xMin, xMax, yMin, yMax, Algorithm, ShowReport, SearchEnable, SearchNumSectors, SearchRad1, SearchRad2, SearchAngle, SearchMinData, SearchDataPerSect, SearchMaxEmpty, FaultFileName, BreakFileName, AnisotropyRatio, AnisotropyAngle, IDPower, IDSmoothing, KrigType, KrigDriftType, KrigStdDevGrid, KrigVariogram, MCMaxResidual, MCMaxIterations, MCInternalTension, MCBoundaryTension, MCRelaxationFactor, ShepSmoothFactor, ShepQuadraticNeighbors, ShepWeightingNeighbors, RegrMaxXOrder, RegrMaxYOrder, RegrMaxTotalOrder, RBBasisType, RBRSquared, OutGrid, OutFmt, SearchMaxData, KrigStdDevFormat, DataMetric, LocalPolyOrder, LocalPolyPower, TriangleFileName, TriangleFileOptions, DataFileOptions, BlankOutsideHull, InflateHull, xSize, ySize, SaveReportAs, ReportFormat, ZLimitMinMethod, ZLimitMaxMethod, ZLimitMin, ZLimitMax, ZTransformMethod, SaveSettingsAs, LoadSettingsAs, OutGridOptions )

Note: ShepRange1 and ShepRange2 have been deprecated. Use SearchRad1 and SearchRad2 instead.

Parameter

Type

Required/

Optional

Default

Description

DataFile

String

Required

 

This provides the path and file name of the XYZ data file name

xCol

Long

Optional

1 (Column A)

This provides the column containing X values, column A = 1.

yCol

Long

Optional

2 (Column B)

This provides the column containing Y values, column B = 2.

zCol

Long

Optional

3 (Column C)

This provides the column containing Z values, column C = 3.

ExclusionFilter

Variant

Optional

 

This provides the Boolean search to exclude values.

DupMethod

Variant

Optional

 

This provides the method for eliminating duplicates, the SrfDupMethod enumeration can be used for this parameter.

xDupTol

Variant

Optional

 

This provides the separation distance of X values to be considered duplicates.

yDupTol

Variant

Optional

 

This provides the separation distance of Y values to be considered duplicates.

NumCols

Variant

Optional

 

This provides the output grid geometry number of columns (number of nodes in the X direction).

NumRows

Variant

Optional

 

This provides the output grid geometry number of rows (number of nodes in the Y direction).

xMin

Variant

Optional

 

This provides the output grid geometry minimum X value.

xMax

Variant

Optional

 

This provides the output grid geometry maximum X value.

yMin

Variant

Optional

 

This provides the output grid geometry minimum Y value.

yMax

Variant

Optional

 

This provides the output grid geometry maximum Y value.

Algorithm

Variant

Optional

 

This provides the gridding method (kriging, etc.), the SrfGridAlgorithm enumeration can be used for this parameter.

ShowReport

Variant

Optional

 

'True' or '1' enables the show grid report, the report is only shown if ShowReport is true and Surfer is visible. 'False' or '0' does not show the report.

SearchEnable

Variant

Optional

 

'True' or '1' enables the search. 'False' or '0' disables the search, i.e. uses No Search (use all of the data). It is one of the search options.

SearchNumSectors

Variant

Optional

 

This provides the number of sectors to search.

SearchRad1

Variant

Optional

 

This provides the search ellipse radius 1. It is one of the search options. SearchRad1 can be used for Modified Shepard's Method.

SearchRad2

Variant

Optional

 

This provides the search ellipse radius 2. It is one of the search options. SearchRad2 can be used for Modified Shepard's Method.

SearchAngle

Variant

Optional

 

This provides the search ellipse angle. It is one of the search options.

SearchMinData

Variant

Optional

 

This provides the minimum number of data in all sectors (node is assigned NoData if the data surrounding the node are less than this number).

SearchDataPerSect

Variant

Optional

 

This provides the maximum number of data to use from each sector.

SearchMaxEmpty

Variant

Optional

 

This provides the number of NoData nodes if more than this many sectors are empty.

FaultFileName

Variant

Optional

 

This provides the file containing fault traces.

BreakFileName

Variant

Optional

 

This provides the file containing breaklines.

AnisotropyRatio

Variant

Optional

 

This provides the anisotropy ratio used for various algorithms.

AnisotropyAngle

Variant

Optional

 

This provides the anisotropy angle used for various algorithms.

IDPower

Variant

Optional

 

This specifies the inverse distance to a power, power number.

IDSmoothing

Variant

Optional

 

This specifies the inverse distance to a power, smoothing factor.

KrigType

Variant

Optional

 

This specifies the kriging type (point or block. The SrfKrigType enumeration can be used for this parameter.

KrigDriftType

Variant

Optional

 

This specifies the kriging drift type (none, linear, or quadratic), the SrfDriftType enumeration can be used for this parameter.

KrigStdDevGrid

Variant

Optional

 

This provides the output grid of kriging standard deviations

KrigVariogram

Variant

Optional

 

This specifies the kriging variogram model. KrigVariogram may contain an array of VarioComponent objects. If this parameter is not specified the default Linear variogram is used.

MCMaxResidual

Variant

Optional

 

This specifies the minimum curvature maximum residual.

MCMaxIterations

Variant

Optional

 

This specifies the minimum curvature maximum number of iterations.

MCInternalTension

Variant

Optional

 

This specifies the minimum curvature internal tension factor.

MCBoundaryTension

Variant

Optional

 

This specifies the minimum curvature boundary tension factor.

MCRelaxationFactor

Variant

Optional

 

This specifies the minimum curvature relaxation factor.

ShepSmoothFactor

Variant

Optional

 

This specifies the modified Shepard's method smoothing factor.

ShepQuadraticNeighbors

Variant

Optional

 

This specifies the modified Shepard's method quadratic neighbors.

ShepWeightingNeighbors

Variant

Optional

 

This specifies the modified Shepard's method weighting neighbors.

ShepRange1

Variant

Optional

 

ShepRange1 has been deprecated. Use SearchRad1 instead.

ShepRange2

Variant

Optional

 

ShepRange2 has been deprecated. Use SearchRad2 instead.

RegrMaxXOrder

Variant

Optional

 

This specifies the polynomial regression maximum X order.

RegrMaxYOrder

Variant

Optional

 

This specifies the polynomial regression maximum Y order.

RegrMaxTotalOrder

Variant

Optional

 

This specifies the polynomial regression maximum total order.

RBBasisType

Variant

Optional

 

This specifies the radial basis function type (inverse multiquadric, multilog, multiquadric, natural cubic spline, or thin plate spline), the SrfBasisType enumeration can be used for this parameter.

RBRSquared

Variant

Optional

 

This specifies the radial basis function correlation coefficient

OutGrid

String

Optional

""

This provides the path and file name of the output grid file.

OutFmt

SrfGridFormat

Optional

srfGridFmtS7

This provides the output grid file format,

SearchMaxData

Variant

Optional

 

This specifies the maximum number of data to use from all sectors. This one of the search criteria.

KrigStdDevFormat

Variant

Optional

 

This specifies the standard deviation grid file format, the SrfGridFormat enumeration can be used for this parameter

DataMetric

Variant

Optional

 

This specifies one of the data metric options, the SrfDataMetric enumeration can be used for this parameter.

LocalPolyOrder

Variant

Optional

 

This specifies the local polynomial order.

LocalPolyPower

Variant

Optional

 

This specifies the local polynomial power (0 to 20).

TriangleFileName

Variant

Optional

 

This provides the name of the file to contain the triangulation - the format is determined by the file name extension.

TriangleFileOptions

Variant

Optional

 

This specifies the triangle export options dependent on the graphic format specified for export

DataFileOptions

Variant

Optional

 

This specifies data import options

BlankOutsideHull

Variant

Optional

0

This specifies whether to Assign NoData to grid outside the convex hull of data. 'True' or '1' assigns the NoData value outside of the convex hull of the data. 'False' or '0' extends the grid to the grid extents.

InflateHull

Variant

Optional

 

This specifies the amount to expand or contract the convex hull in map units.

xSize

Variant

Optional

 

This specifies the X spacing of the output grid.

ySize

Variant

Optional

 

This specifies the Y spacing of the output grid.

SaveReportAs

Variant

Optional

 

This specifies the path and file name to which the gridding report is saved. The Surfer application must be visible and ShowReport must be True to save the gridding report.

ReportFormat

SrfReportFormat

Optional

srfReportFormatRTF

This specifies the format for the saved gridding report, TXT or RTF

ZLimitMinMethod

srfZLimitMethod

Optional

srfZLimitNone

This provides the method for the output grid Z minimum limit. Uses srfZLimitMethod. ZLimitMinMethod must be srfZLimitCustom to use ZLimitMin.

ZLimitMaxMethod

srfZLimitMethod

Optional

srfZLimitNone

This provides the method for the output grid Z maximum limit. Uses srfZLimitMethod. ZLimitMaxMethod must be srfZLimitCustom in order to use ZLimitMax.

ZLimitMin

Double

Optional

 

This provides the output grid minimum Z limit value when ZLimitMinMethod = srfZLimitCustom.

ZLimitMax

Double

Optional

 

This provides the output grid maximum Z limit value when ZLimitMaxMethod = srfZLimitCustom.

ZTransformMethod

SrfTransformMethod

Optional

srfZTransformLinear

This provides the method to transform z linearly or logarithmically. The SrfTransformMethod enumeration can be used for this parameter.

SaveSettingsAs

String

Optional

 

Loads grid data settings from an .SRFGDS file.

LoadSettingsAs

String

Optional

 

Saves grid data settings to an .SRFGDS file.

OutGridOptions

String

Optional

""

This provides the output option string for the grid format.

Remarks

Please refer to the gridding advanced options dialogs for more information on using gridding options. Some of the above options require certain parameters to be used and some parameters cannot be used with other parameters. For example, SearchEnable must be enabled to successfully use the seven parameters (Search...) that follow it. Another example is if the natural neighbor gridding method is selected for Algorithm, KrigVariogram should not be set. Since this method contains so many parameters, try using named arguments for this method (see examples below). There is no need to preload the file into the worksheet.

The BlankOutsideHull parameter must be set to 'True' or '1' to use the InflateHull parameter.

X spacing can be specified with either NumCols or xSize. Y spacing can be specified with either NumRows or ySize. However, if both NumCols and xSize or NumRows and ySize are specified, the script will result in an error.

The Surfer application must be visible and ShowReport must be set to True to save the gridding report with the SaveReportAs and ReportFormat parameters. The report is saved via the user interface functionality. Any errors in saving the report will happen via the user interface as well, and the error will block the script from proceeding.

Example 1

This example uses GridData6. The Grid Report was turned on in this example to display the correct sheet being used.

Dim SurferApp As Object

Set SurferApp = CreateObject("Surfer.Application")

SurferApp.Visible = True

Dim Doc As Object

Set Doc = SurferApp.Documents.Add(srfDocPlot)

SurferApp.GridData6("c:\temp\book1.xls",DataFileOptions:="sheet=Test", _

ShowReport:=True,OutGrid:="c:\temp\book1.grd"), _

Doc.Shapes.AddContourMap(GridFileName:="c:\temp\test.grd")

Example 2

This example uses GridData6 to grid the data using a specific worksheet in an Excel file and creates a grid file.

'Grids the data using a specific sheet in a workbook and creates a grid file

SurferApp.GridData6(DataFile:="c:\temp\book1.xlsx",DataFileOptions:="sheet=sheet2", _

Algorithm:=1, ShowReport:=False, OutGrid:="c:\temp\sheet2.grd")

Example 3

This example shows how to use GridData6 to export a Triangle File with file-specific options.

'Grids the data using Triangulation with Linear Interpolation and also exports vector triangles

SurferApp.GridData6(DataFile:="c:\temp\demodata.dat", Algorithm:=srfTriangulation, _

ShowReport:=False, OutGrid:="c:\temp\Demogrid.grd", TriangleFile:= _

"c:\temp\Demogrid_Triangles.bln", TriangleFileOptions:="SaveScalingInfo=1, _

BreakApartCompoundAreas=0")

Example 4

This example shows how to use GridData6 to grid a table from an Access database.

'Grids the Access database using Kriging

SurferApp.GridData6 (DataFile:="C:\temp\sample.mdb", _

DataFileOptions:="Table=elevation", xcol:=4, ycol:=3, zcol:=5, _

Algorithm:=srfKriging, OutGrid:="C:\temp\Access.grd")

Example 5

This example creates a grid file from the DAT and also assigns the NoData value to the area outside the convex hull of the data inflated by .5 units.

SurferApp.GridData6(DataFile:="c:\test\digitized.dat", _

OutGrid:="c:\test\digitized_blanking_outside.grd", ShowReport:=0, _

BlankOutsideHull:=1, InflateHull:=.5)

Example 6

This example demonstrates how to create a grid and save the gridding report as a plain text file.

'Make the application visible

SurferApp.Visible = True

'Create the grid and save the gridding report

SurferApp.GridData6(DataFile:=SurferApp.Path+"\Samples\demogrid.dat", _

ShowReport:=True, OutGrid:="C:\Test\newdeomgrid.grd", _

SaveReportAs:="C:\Users\JohnSmith\Desktop\gridreport.txt", _

ReportFormat:=srfReportFormatTXT)

Example 7

This example demonstrates how to use GridData6 to set the Z Transform to linear and how to both transform and save the data either as logarithmic or linear.

SurferApp.GridData6(DataFile:=DataFile, Algorithm:=srfMinCurvature, ZTransformMethod:=srfZTransformLinear, OutGrid:=Outpath+"linear.grd")

Set MapFrame1 = Plot.Shapes.AddContourMap(GridFileName:=Outpath+"linear.grd")

 

SurferApp.GridData6(DataFile:=DataFile, Algorithm:=srfMinCurvature, ZTransformMethod:=srfZTransformLogSaveAsLog, OutGrid:=Outpath+"logsavelog.grd")

Set MapFrame2 = Plot.Shapes.AddContourMap(GridFileName:=Outpath+"logsavelog.grd")

SurferApp.GridData6(DataFile:=DataFile, Algorithm:=srfMinCurvature, ZTransformMethod:=srfZTransformLogSaveAsLinear, OutGrid:=Outpath+"logsavelinear.grd")

Example 8

This example demonstrates how to use GridData6 set the Z Limit to none, the minimum, or a custom maximum.

SurferApp.GridData6(DataFile:=DataFile, Algorithm:=srfMinCurvature, ZLimitMinMethod:=srfZLimitNone, ZLimitMaxMethod:=srfZLimitNone, OutGrid:=Outpath+"LimitNone.grd")

Set MapFrame4 = Plot.Shapes.AddContourMap(GridFileName:=Outpath+"LimitNone.grd")

 

SurferApp.GridData6(DataFile:=DataFile, Algorithm:=srfMinCurvature, ZLimitMinMethod:=srfZLimitData, ZLimitMaxMethod:=srfZLimitData, OutGrid:=Outpath+"LimitData.grd")

Set MapFrame5 = Plot.Shapes.AddContourMap(GridFileName:=Outpath+"LimitData.grd")

 

SurferApp.GridData6(DataFile:=DataFile, Algorithm:=srfMinCurvature, ZLimitMinMethod:=srfZLimitCustom, ZLimitMin:=33.5, ZLimitMaxMethod:=srfZLimitCustom, ZLimitMax:=89.21, OutGrid:=Outpath+"LimitCustom.grd")

Set MapFrame6 = Plot.Shapes.AddContourMap(GridFileName:=Outpath+"LimitCustom.grd")

Example 9

This example demonstrates how to save the file as a .grd file and the spatial reference as a Golden Software Reference (GSIREF) version 1 file.

Surfer.GridData6(DataFile:=InGridPath+"Diablo Example.dat", Algorithm:=1, ShowReport:=False, OutGrid:=OutGridPath + "GridData6.grd", OutGridOptions:="UseDefaults=1, ForgetOptions=1, SaveRefInfoAsGSIREF=1")

Example 10

This script displays all the methods in the Application object.

Used by: Application object