GridFilter2

The GridFilter2 method applies a filter to an existing grid.

The process applies methods of digital image analysis to grids. This includes a broad suite of smoothing (low-pass) filters, as well as contrast enhancement filters, edge enhancement filters, edge detection filters, general high-pass filters, etc. Surfer also includes the capability for user-defined, general linear filters.

Returns a Boolean value. The value is 'True', if the filtering process is successful, otherwise it is 'False'.

Syntax

object.GridFilter2( InGrid, Filter, EdgeOp, BlankOp, NumPasses, EdgeFill, BlankFill, NumRow, NumCol, Param1, Param2, UserFilter, OutGrid, OutFmt, OutGridOptions)

Parameter

Type

Required/

Optional

Default

Description

InGrid

String

Required

 

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

Filter

SrfFilter

Required

 

This specifies the filter type.

EdgeOp

SrfFilterEdge

Optional

 

This specifies the edge of grid method.

BlankOp

SrfFilterBlank

Optional

This specifies the NoData nodes method.

NumPasses

Integer

Optional

This specifies the number of passes, i.e., number of times the filter is applied.

EdgeFill

Double

Optional

This specifies the fill value when SrfFilterEdge=srfFltEdgeFill.

BlankFill

Double

Optional

This specifies the fill value when SrfFilterBlank=srfFltBlankFill.

NumRow

Integer

Optional

This is used when filter size can be changed, number of rows, must be odd.

NumCol

Integer

Optional

This is used when filter size can be changed, number of columns, must be odd

Param1

Variant

Optional

See

Remarks

section.

Param2

Variant

Optional

See

Remarks

section.

UserFilter

Variant

Optional

This specifies the two dimensional array of doubles, dimensioned to NumRows and NumCol, element 1,1 is the lower left corner, used when SrfFilter=srfFilterUserSpecified.

OutGrid

String

Optional

""

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

OutFmt

SrfGridFormat

Optional

srfGridFmtS7

This provides the output grid format.

OutGridOptions

String

Optional

""

This provides the output option string for the grid format.

Remarks

Param1 and Param2 depend upon the SrfFilter setting as follows:

Filter

Param1

Param2

srfFilterDist

Power

srfFilterInvDist

Power

Central Weight

srfFilterGaussianLP

Alpha

srfFilterThresholdAve

Threshold

Example 1

This is an example for how to use GridFilter2.

Dim Filter(1 To 7,1 To 7) As Double

For i=1 To 7

For j=1 To 7

Filter(i,j) = (i-1)*7 + j-1

Next

Next

status = SurferApp.GridFilter2(SurferApp.Path+"\Samples\demogrid.grd", _

SrfFilterUserSpecified,srfFltEdgeBlank,

UserFilter:=Filter)

Example 2

This example demonstrates how to apply a filter to diablo.grd, save the file as Filter.grd and save the spatial references as an Esri AUX.XML file.

Surfer.GridFilter2(InGrid:=InGridPath+"diablo.grd", Filter:=srfFilterAvg, OutGrid:=OutGridPath + "Filter.grd", OutGridOptions:= "UseDefaults=1, ForgetOptions=1, SaveRefInfoAsAUXXML=1")

Example 3

This script displays all the methods in the Application object.

Used by: Application object