Grid Object

The Grid object represents a 2D matrix of data values. Grids are used to create contour and other map types in Surfer. By using the methods and properties of the Grid object, grids can be created, loaded from disk, queried, modified, and saved back to disk.

The following table provides the properties of the Grid object:

Property

Description

Application

Returns the application object. It is a read-only property.

BlankValue

Returns/sets the NoData value.

CoordinateSystem

Returns/sets the coordinate system for the grid.

FileName

Returns the filename of the grid (if any). It is a read-only property.

NumCols

Returns the number of columns in the grid. It is a read-only property.

NumRows

Returns the number of rows in the grid. It is a read-only property.

Parent

Returns the parent object. It is a read-only property.

xMax

Returns/sets the maximum X coordinate of the grid.

xMin

Returns/sets the minimum X coordinate of the grid.

xSize

Returns the size of a grid cell in the X direction (data units). It is a read-only property.

yMax

Returns/sets the maximum Y coordinate of the grid.

yMin

Returns/sets the minimum Y coordinate of the grid.

ySize

Returns the size of a grid cell in the Y direction (data units). It is a read-only property.

zMax

Returns/sets the maximum Z coordinate of the grid.

zMin

Returns/sets the minimum Z coordinate of the grid.

The following table provides the methods of the Grid object:

Method

Description

Allocate

Allocates the specified number of rows and columns.

BlankNode

Assigns the NoData value to the node at a specified position.

GetNode

Gets the value of a node at a specified position.

Interpolate

Interpolates a value within the grid at a specified position.

IsBlanked

Returns true if the node at the specified position is assigned NoData.

LoadFile

Loads the specified grid file.

LoadFile2

Loads the specified grid file with import options string.

SaveFile2

Saves the grid to a disk file.

SetNode

Sets the value of a node at a specified position.

Statistics

Returns the GridStatistics object for the grid. It is a read-only property.

UpdateZLimits

Recomputes the zMin and zMax fields based on the current node values

Example 1

The following script demonstrates how the Grid object is used in reference to the Application object.

Sub Main

 

'Declares SurferApp as an object

Dim SurferApp As Object

 

'Creates an instance of the Surfer Application object and assigns

'it to the variable named "SurferApp"

Set SurferApp = CreateObject("Surfer.Application")

 

'Makes Surfer visible

SurferApp.Visible = True

 

'Declares Grid as an object

Dim Grid As Object

 

'Creates a new grid and assigns it to the variable named "Grid"

Set Grid = SurferApp.NewGrid

 

End Sub