GridExtract2
GridExtract2 extracts a subset from an existing grid file. When you extract information from a grid file, you can specify the starting and ending rows and columns to extract. Returns a Boolean. Returns 'True', if the extraction and new grid creation is successful, else returns 'False'.
Syntax
object.GridExtract2( InGrid, r1, r2, rFreq, c1, c2, cFreq, OutGrid, OutFmt, OutGridOptions )
Parameter |
Type |
Required/ Optional |
Default |
Description |
InGrid |
String |
Required |
|
This provides the path and file name of the input grid file. |
r1 |
Integer |
Optional |
-1 |
This specifies the beginning row number. |
r2 |
Integer |
Optional |
-1 |
This specifies the ending row number. |
rFreq |
Integer |
Optional |
-1 |
This specifies the row frequency (skip rows). |
c1 |
Integer |
Optional |
-1 |
This specifies the beginning column number. |
c2 |
Integer |
Optional |
-1 |
This specifies the ending column number. |
cFreq |
Integer |
Optional |
-1 |
This specifies the column frequency (skip columns). |
OutGrid |
String |
Optional |
"" |
This provides the path and file name of the output grid file. |
OutFmt |
Optional |
srfGridFmtS7 |
This provides the output grid format. |
|
OutGridOptions |
String |
Optional |
"" |
This provides the output option string for the grid format. |
Remarks
default = -1 indicates:
-
the beginning row or column is the first row or column in the grid
-
the ending row or column is the last row or column in the grid
-
the row or column frequency is 1
-
default = "" indicates the default output grid file name is "out.grd"
Example 1
This example demonstrates how to extract the right two thirds of the upper half of DEMOGRID.GRD, saving the result as DGRID1.GRD.
SurferApp.GridExtract2(InGrid:=SurferApp.Path+\Samples\demogrid.grd, r1:=1, _
r2:=26, c1:=1, c2:=25, OutGrid:="c:\temp\dgrid1.grd", _
OutFmt:=srfGridFmtS7)
Example 2
This example demonstrates how to create a new grid with information extracted and save the spatial references as an Esri AUX.XML file and a MapInfo TAB file.
Surfer.GridExtract2(InGrid:=InGridPath+"Golden.grd", rFreq:=2, cFreq:=3, OutGrid:=OutGridPath + "Extract.grd", OutGridOptions:= "UseDefaults=1, ForgetOptions=1, SaveRefInfoAsAUXXML=1, SaveRefInfoAsTAB=1" )
Example 3
This script displays all the methods in the Application object.
Used by: Application object