Surfer's profile object can be used to create a multi-layer cross section. First, a map with each layer of interest must be created. The sample script below creates an overlain map from two grid files and then generates a cross section along a user defined profile line.
To run this script:
- Copy the script below, or download the attached BAS file: Profile.BAS.
- In a Windows Explorer window, navigate to C:\Program Files\Golden Software\Surfer.
- Double click on Scripter.exe to launch Scripter.
- Press Ctrl+A to select all of the existing lines then press Delete.
- If you copied this script, press Ctrl+V to paste it into Scripter. If you downloaded it, click File | Open, select the BAS file from your downloads directory, and click Open.
- In the USER VARIABLES section of the script, near the top, enter the appropriate file path and grid file names. If you have more than two grids, enter more grid#="name.grd" lines below the existing lines.
- Define the profile line using 2 points for each vertex as shown below.
pts(n)=# : pts(n+1)=#
After defining the profile line, set m in the Dim pts(m) As Double line to the n+1 number from the last vertex.
- If you have more than two grids, copy and paste line 32, incrementing the 2 in MapFrame2 and grid2 (so the next line would be MapFrame3 and grid3), until maps are created for all of your grids.
- Click Script | Run to run the script.
Sub Main 'Initialize Surfer Dim SurferApp, Plot As Object Set SurferApp = CreateObject("Surfer.Application") SurferApp.Visible = True Set Plot = SurferApp.Documents.Add '====================================== 'User-defined variables '====================================== 'Path where grid files are located filepath = "c:\temp\" 'Grid files. If there are more than two, add grid3 = ..., grid4 = ..., etc. grid1 = "layer1.grd" grid2 = "layer2.grd" 'Create 2 Points for Profile Line (in map units). 'Adjust number in Dimmed pts (should be odd) and number of rows below as needed. Dim pts(3) As Double pts(0) = 521421.4 : pts(1) = 6811877.6 pts(2) = 534224.1 : pts(3) = 6792017.0 '====================================== 'Create a contour map and assigns the map frame to the variable "MapFrame" Set MapFrame = Plot.Shapes.AddContourMap(filepath+grid1) 'Create another contour map. 'If there are more than two grid files, copy/paste this line, incrementing the 2 in grid2 and MapFrame2 Set MapFrame2 = Plot.Shapes.AddContourMap(filepath+grid2) 'Overlay maps Plot.Shapes.SelectAll Set NewMapFrame = Plot.Selection.OverlayMaps 'Create Profile object Set Profile = NewMapFrame.Profiles.Add(pts) End Sub
Updated December 2021