GridResiduals
The GridResiduals method is superseded by GridResiduals2. Please consider using the more recent version. GridResiduals has been retained for backward compatibility.
GridResiduals calculates the difference between XYZ data and a grid surface and stores the residuals in a worksheet. Returns the worksheet object in a WksDocument object.
The GridResiduals2 command should specifically be used instead of GridResiduals 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.GridResiduals( InGrid, DataFile, xCol, yCol, zCol, ResidCol )
Parameter |
Type |
Required/ Optional |
Default |
Description |
InGrid |
String |
Required |
|
This provides the path and file name of the input grid file. |
DataFile |
String |
Required |
|
This provides the path and file name of the XYZ data file. |
xCol |
Long |
Optional |
1 (Column A) |
This specifies the column containing X data. |
yCol |
Long |
Optional |
2 (column B) |
This specifies the column containing Y data. |
zCol |
Long |
Optional |
3 (column C) |
This specifies the column containing Z data. |
ResidCol |
Long |
Optional |
4 (column D) |
This specifies the column where the residuals are stored. |
Example 1
This example demonstrates how to calculate the difference between the XYZ data of demogrid.dat and the grid surface of demogrid.grd and store the residuals in the fourth column of demogrid.dat.
SurferApp.GridResiduals(InGrid:=SurferApp.Path+"\Samples\demogrid.grd", _
DataFile:=SurferApp.Path+"\Samples\demogrid.dat", xCol:=1, yCol:=2, zCol:=3, ResidCol:=4)
Example 2
This example demonstrates how to calculate the difference between the original Z values in the data file and the Z value in the grid file.
Sub Main
Dim SurferApp As Object
Set SurferApp = CreateObject("Surfer.Application")
SurferApp.Visible = True
'Specifies the grid and data files to use
GridFile = SurferApp.Path+"\Samples\demogrid.grd"
DataFile = SurferApp.Path+"\Samples\demogrid.dat"
'Uses Grid Residuals and stores the residuals in Column D
Set Wks = SurferApp.GridResiduals(InGrid:=GridFile, DataFile:=DataFile, _
xCol:=1, yCol:=2, zCol:=3, ResidCol:=4)
'Saves the worksheet with the residuals
Wks.SaveAs(FileName:="C:\temp\GridResiduals.dat")
'Closes the worksheet
Wks.Close
End Sub
Example 3
This script displays all the methods in the Application object.
Used by: Application object