Reproject a grid file to a different coordinate system via Surfer automation
Certain workflows require that your input files use the same coordinate system. For example, performing grid math on one grid in lat/lon and the other in UTM coordinates would never work. The Grid Project feature resolves this by creating a new grid in a different coordinate system from the input grid file. Detailed specifications for this automation method can be found in Surfer's help here: GridProject
Remarks
In the UI, there is a "Resize output grid" checkbox. Instead of including another parameter to represent this, resizing the output grid will be false if neither NumRows nor NumCols are specified. If either of NumRows or NumCols is specified, then resizing the output grid will occur.
The InCS and OutCS parameters can be a name, token, or valid WKT for a coordinate system.
Example
Sub Main Dim Surfer As Object Set Surfer = CreateObject("Surfer.Application") Surfer.Visible = True 'project "Colorado.grd" from it's internal Coordinate System to "Bonne Projection", save to "output.grd" Surfer.GridProject(Surfer.Path + "\Samples\Colorado.grd", "Bonne Projection", OutGrid:="C:\Users\David\Downloads\output.grd") 'project "Grand Canyon.grd" from "World Geodetic System 1972" to "Eckert IV" (using it's token) using the Cubic Convolution resampling method. The output grid with be 124 x 118 and will be saved to "output.vtk" Surfer.GridProject(Surfer.Path + "\Samples\Grand Canyon.grd", OutCS:="WORLD_ECKERT4", InCS:="World Geodetic System 1972", NumRows:=124, NumCols:=118, ResampleMethod:=srfCubic, _ OutGrid:="C:\Users\David\Downloads\output.vtk", OutFmt:=srfGridFmtVTK) End Sub
Updated November 2021
Comments
0 comments
Please sign in to leave a comment.