GridMath

The GridMath method has been superseded by GridMath3. Consider using GridMath3 instead.

GridMath performs grid-to-grid and grid-to-constant math operations. It creates a new grid file that transforms the Z values of a single grid file or combines Z values from two grid files. The output grid file is based on a mathematical function of the form C = f(A,B), where C is the output grid file, and A and B represent input grid files. Returns a Boolean. Returns 'True', if the new grid file is successfully created, otherwise, returns 'False'.

The GridMath2 command should be used instead of GridMath command when more than two grids need to be combined or when the Z value of blanked grid nodes need to be changed.

Syntax

object.GridMath( Function, InGridA, InGridB, OutGridC, OutFmt)

Parameter

Type

Required/

Optional

Default

Description

Function

String

Required

 

This specifies the function equation.

InGridA

String

Required

 

This provides the path and file name of the first input grid file.

InGridB

String

Optional

""

This provides the path and file name of the second input grid file.

OutGridC

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.

Example 1

This example demonstrates how to add two grids together. Sample1a.grd is gridded using the first, second and third columns (X, Y and Z1) of Sample1.dat while Sample1b.grd is gridded using the first, second and fourth columns (X, Y and Z2). Sample1c.grd represents the difference in Z values between Sample1a.grd and Sample1b.grd.

SurferApp.GridData(DataFile:=SurferApp.Path+"\Samples\demogrid.dat", xCol:=1, yCol:=2, zCol:=3, _

Algorithm:=srfKriging, ShowReport:=False, OutGrid:=SurferApp.Path+"\Samples\demogrida.grd", _

OutFmt:=srfGridFmtS7)

SurferApp.GridData(DataFile:=SurferApp.Path+"\Samples\demogrid.dat", xCol:=1, yCol:=2, zCol:=3, _

Algorithm:=srfKriging, ShowReport:=False, OutGrid:=SurferApp.Path+"\Samples\demogridb.grd", OutFmt:=srfGridFmtS7)

SurferApp.GridMath(Function:=

InGridB:=SurferApp.Path+"\Samples\demogridb.grd", _

OutGridC:=SurferApp.Path+"\Samples\demogridc.grd", OutFmt:=srfGridFmtS7)

Example 2

This script displays all the methods in the Application object.

Used by: Application object