CrossValidate2

CrossValidate2 performs cross validation. Cross validation is an objective method used for assessing the quality of a gridding method, or to compare the relative quality of two or more candidate gridding methods. Surfer allows cross validation to be used with all gridding methods. While cross validation can be used to select a gridding method, the results can also be used to assess the spatial variation in gridding quality and to guide data sampling.

Given the known values at N observation locations in the original data set, cross validation allows you to assess the relative quality of the grid by computing and investigating the gridding errors. It returns a Boolean value: True or False. It returns 'True', if the operation is successful, otherwise, it returns 'False'.

The CrossValidate2 command should be used instead of CrossValidate when the worksheet being loaded is an Excel file where the sheet name needs to be specified. It can also be used to specify any data import options when loading a data file.

Syntax

object.CrossValidate2( 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, KrigVariogram, MCMaxResidual, MCMaxIterations, MCInternalTension, MCBoundaryTension, MCRelaxationFactor, ShepSmoothFactor, ShepQuadraticNeighbors, ShepWeightingNeighbors, ShepRange1, ShepRange2, RegrMaxXOrder, RegrMaxYOrder, RegrMaxTotalOrder, RBBasisType, RBRSquared, SearchMaxData, LocalPolyOrder, LocalPolyPower, NumRandomPoints, xMinValidate, xMaxValidate, yMinValidate, yMaxValidate, zMinValidate, zMaxValidate, xTolValidate, yTolValidate, ResultsFile, pResults, DataFileOptions)

Parameter

Type

Required/

Optional

Default

Description

DataFile

String

Required

 

This provides 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 grid line geometry number of columns.

NumRows

Variant

Optional

 

This provides the output grid geometry number of rows.

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

 

This shows the cross validation report, the report is only shown if ShowReport is true and Surfer is visible.

SearchEnable

Variant

Optional

 

This enables 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.

SearchRad2

Variant

Optional

 

This provides the search ellipse radius 2. It is one of the search options.

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 blanked 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 blank 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.

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

 

This specifies the modified Shepard's method anisotropy range 1.

ShepRange2

Variant

Optional

 

This specifies the modified Shepard's method anisotropy range 2.

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), theSrfBasisTypeenumeration can be used for this parameter.

RBRSquared

Variant

Optional

 

This specifies the radial basis function correlation coefficient

SearchMaxData

Variant

Optional

 

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

LocalPolyOrder

Variant

Optional

 

This specifies the local polynomial order.

LocalPolyPower

Variant

Optional

 

This specifies the local polynomial power (0 to 20)

NumRandomPoints

Variant

Optional

Total number of observations or 100, whichever is lesser.

This specifies the number of random points to validate.

xMinValidate

Variant

Optional

 

This specifies the minimum X value cross validation limit.

xMaxValidate

Variant

Optional

 

This specifies the maximum X value cross validation limit.

yMinValidate

Variant

Optional

 

This specifies the minimum Y value cross validation limit.

yMaxValidate

Variant

Optional

 

This specifies the maximum Y value cross validation limit.

zMinValidate

Variant

Optional

 

This specifies the, minimum Z value cross validation limit.

zMaxValidate

Variant

Optional

 

This specifies the maximum Z value cross validation limit.

xTolValidate

Variant

Optional

This specifies the X tolerance distance from validation point to exclude data.

yTolValidate

Variant

Optional

This specifies the Y tolerance distance from validation point to exclude data.

ResultsFile

Variant

Optional

This specifies the name of cross validation results file [*.DAT].

pResults

Variant

Optional

This specifies the returned array of doubles is base-0 and is indexed using the srfCVResults enumeration.

DataFileOptions

Variant

Optional

""

This specifies the data import options.

Remarks

  • The report is only shown if ShowReport is true and Surfer is visible.

  • KrigVariogram may contain a single VarioComponent or an array of VarioComponent objects. If KrigVariogram is not specified, a default linear model is used.

  • Algorithm cannot equal srfDataMetrics because cross validation is not supported with this method.

  • Minimum curvature is the only algorithm that uses the grid geometry parameters (NumCols, NumRows, xMin, xMax, yMin, yMax).

  • 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).

Example 1

This example shows how to use CrossValidate2 to create a cross validation report for the data in a specific sheet of an Excel file.

'Creates a cross validation report for the data in a specific
'sheet in a workbook and saves it to a file

SurferApp.CrossValidate2(DataFile:="c:\temp\book1.xlsx", _

DataFileOptions:="sheet=sheet2", Algorithm:=1, _

ShowReport:=False, ResultsFile:="c:\temp\CrossValidate.dat")

Example 2

This script displays all the methods in the Application object.

Used by: Application object