GridTransform2
GridTransform2 transforms an existing grid file. It scales, offsets, mirrors, or rotates an existing grid file. Returns a Boolean. It returns 'True', if the operation is successful, else returns 'False'.
Syntax
object.GridTransform2( InGrid, Operation, xOffset, yOffset, xScale, yScale, Rotation, OutGrid, OutFmt, OutGridOptions )
Parameter |
Type |
Required/ Optional |
Default |
Description |
InGrid |
String |
Required |
|
This provides the path and file name of the input grid file. |
Operation |
Required |
|
This specifies the transform operation -- scale, offset, mirror, or rotate. |
|
xOffset |
Double |
Optional |
0.0 |
This specifies the X offset; used with offset operation only. |
yOffset |
Double |
Optional |
1.0 |
This specifies the Y offset; used with offset operation only. |
xScale |
Double |
Optional |
1.0 |
This specifies the X scale factor; used with scale operation only. |
yScale |
Double |
Optional |
1.0 |
This specifies the Y scale factor; used with scale operation only. |
Rotation |
Double |
Optional |
0.0 |
This provides the angle in degrees to rotate grid. * |
OutGrid |
String |
Optional |
"" |
This provides the path and file name of the output grid file. |
OutFmt |
Optional |
srfGridFmtS7 |
This provides the output grid file format. |
|
OutGridOptions |
String |
Optional |
"" |
This provides the output options string for the grid format. |
Remarks
Positive degrees rotate the grid counterclockwise, negative degrees rotate the grid clockwise.
Example 1
This example demonstrates how to shift the origin of demogrid.grd to the right by three units and down five units, saving the result as dgrid1.grd.
SurferApp.GridTransform2(InGrid:=SurferApp.Path+"\Samples\demogrid.grd", _
Operation:= srfGridTransOffset, xOffset:=3, yOffset:=-5, _
OutGrid:=SurferApp.Path+"\Samples\dgrid1.grd", OutFmt:=srfGridFmtS7)
Example 2
This example demonstrates how to mirror the X axis of demogrid.grd and saves the resulting grid as dgrid1.grd.
SurferApp.GridTransform2(InGrid:=SurferApp.Path+"\Samples\demogrid.grd", _
Operation:=srfGridTransMirrorX, OutGrid:="c:\temp\dgrid1.grd", _
OutFmt:=srfGridFmtS7)
Example 3
This example demonstrates how to rotate demogrid.grd 90 degrees counterclockwise and saves the resulting grid as dgrid1.grd.
SurferApp.GridTransform2(InGrid:=SurferApp.Path+"\Samples\demogrid.grd", _
Operation:= srfGridTransRotate, Rotation:=90, _
OutGrid:="c:\temp\dgrid1.grd", OutFmt:=srfGridFmtS7)
Example 4
This example demonstrates how to rotate telluride.grd by 180 degrees counterclockwise and save the spatial reference file as an Esri .prj file.
Surfer.GridTransform2(InGrid:=InGridPath+"telluride.grd", Operation:=srfGridTransRotate, Rotation:=180, OutGrid:=OutGridPath + "Transform.grd", _
OutFmt:=srfGridFmtAscii, OutGridOptions:="UseDefaults=1, ForgetOptions=1, ValuesPerLine=7, BlankLinePerGridRow=1, NumericFormatType=1, NumericFormatDigits=1, SaveRefInfoAsESRIprj=1")
Example 5
This script displays all the methods in the Application object.
Used by: Application object