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 |
Returns the application object. It is a read-only property. |
|
Returns/sets the NoData value. |
|
Returns/sets the coordinate system for the grid. |
|
Returns the filename of the grid (if any). It is a read-only property. |
|
Returns the number of columns in the grid. It is a read-only property. |
|
Returns the number of rows in the grid. It is a read-only property. |
|
Returns the parent object. It is a read-only property. |
|
Returns/sets the maximum X coordinate of the grid. |
|
Returns/sets the minimum X coordinate of the grid. |
|
Returns the size of a grid cell in the X direction (data units). It is a read-only property. |
|
Returns/sets the maximum Y coordinate of the grid. |
|
Returns/sets the minimum Y coordinate of the grid. |
|
Returns the size of a grid cell in the Y direction (data units). It is a read-only property. |
|
Returns/sets the maximum Z coordinate of the grid. |
|
Returns/sets the minimum Z coordinate of the grid. |
The following table provides the methods of the Grid object:
Method |
Description |
Allocates the specified number of rows and columns. |
|
Assigns the NoData value to the node at a specified position. |
|
Gets the value of a node at a specified position. |
|
Interpolates a value within the grid at a specified position. |
|
Returns true if the node at the specified position is assigned NoData. |
|
Loads the specified grid file. |
|
Loads the specified grid file with import options string. |
|
Saves the grid to a disk file. |
|
Sets the value of a node at a specified position. |
|
Returns the GridStatistics object for the grid. It is a read-only property. |
|
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