Golden Software recently hosted a training class on gridding and interpolating data in Surfer. Before the class was held, a user asked if we’d specifically cover the best options for gridding airborne geophysical data. At the time, it was not in the schedule, but as I looked at the data I thought this type of data could be very common and would make a great example. In this type of data, the data is taken in lines, where the data points along the lines are much closer together than the spacing between the lines. Users generally want to interpolate the data to create a smooth color-filled image map while maintaining the data at sufficient resolution to show important anomalies.

A popular source of airborne geophysical survey data is the USGS aeromagnetic surveys, available at http://mrdata.usgs.gov/magnetic/surveys.php. Some of the data sets have over one million data points, which is quite cumbersome to work with unless you have a lot of memory available on your computer. One data set that is more manageable to work with, and which we’ll use for this example, is for Cuprite, Nevada. This is a tough data set to interpolate, because of the high density of data in one direction (along the flight lines) versus the other direction (between the flight lines).
To find the best gridding method for this (or any) data set, these are the steps I perform when evaluating gridding options:
- Create a classed post map to visualize the data distribution.
- Run the sample script GridData_Comparison.bas to compare gridding methods and narrow down the gridding methods to just a few.
- Manually grid the data with the gridding methods previously selected with more specific gridding options.
- Calculate the residuals to determine the most accurate method (optional).
In detail, the steps I followed with this data set are outlined below.
Step 1: Create a Classed Post Map
The first step I always do is to create a classed post map of the data. I find that it is very useful to get a feel for the spatial distribution of the data, so I know what to expect when gridding the data. For example, areas with fewer data points may generate some odd-looking contours or contours that are significantly different depending upon gridding method. Or if the data points are regularly spaced, I know that Nearest Neighbor might be the best gridding method. In this case, I also want to find out how close the data points are along the lines and between the lines.
- Click Map | New | Classed Post Map, select NV_1152.dat and click Open.
- Select the Classed Post layer in the Object Manager, and in the Property Manager, on the General page, change the X, Y and Z columns to C, D and K, respectively. I noticed the data points were very close together in the X direction, but father apart in the Y direction.
- Click the Classes tab in the Property Manager.
- Click the Edit Classes button.
- In the Classes for Map dialog:
- Set the Binning method to Equal Intervals.
- Set the Number of classes to 7.
- Note that interval between classes is about 23, the minimum of the first class is about -288, and the minimum of the last class is about -154.
- Click the Symbol button. In the Class Symbol Properties dialog, set the Line color to Black with 10% opacity, and change the symbol itself to a square shape. Click OK.
- Click the Size button. Set the Minimum size and Maximum size to the same small value, 0.005, and click OK.
- Click each of the symbols for each class and change the Fill color for that class. I chose navy blue, cyan, green, yellow, red, magenta and pink for my classes.
- Click Save and save the class definitions to a CLS file (ClassedPostClasses.cls) for future use.
- Click OK.
- Then, I measure the distance of points. I zoom in to the map so I could see the points individually along the lines and click Map | Measure.
- In the Y direction, the flight lines were spaced apart about 0.005° on average.
- In the X direction, the points were spaced apart about every 0.0001° on average.
- Press the ESC key to exit measuring mode.
- I want to make the symbol sizes a little larger now. Click the Edit Classes button again and click the Size button.
- Set the Minimum size and Maximum size to the same small value, 0.02, and click OK and OK.

Step 2: Run the Script
After getting a feel for the data, I run the script GridData_Comparison.bas with the data file using columns 3, 4, 11 (C, D, K), and compare the results to see the best potential gridding methods. The script grids the data with the eight most popular gridding methods and creates a map from the result. It uses the default options, so it’s not perfect, but gives us a good idea for what the data looks like gridded with those methods.
- Open Scripter by clicking Windows Start | All Programs | Golden Software Surfer 13 | Scripter.
- Once Scripter is opened, click File | Open, navigate to the Surfer 13 SamplesScripts directory (within the installation folder), select GridData_Comparison.bas and click Open.
- Click Script | Run.
- When prompted for the data, select NV_1152.dat and click Open.
- When asked for the X data column, enter 3 and click OK.
- When asked for the Y data column, enter 4 and click OK.
- When asked for the Z data column, enter 11 and click OK. The script opens a new Surfer window and creates a map in it for each of the eight gridding methods.
Right away, I can eliminate Modified Shepard’s Method and Nearest Neighbor because I do not think the interpolation matches what I want the map to look like. I delete those maps. I also do not like how jagged the map is using Radial Basis Function. I delete that map also.

That still leaves five potential gridding method options. To try and eliminate others, I next check how well the contours match the original data.
- Click back to the plot window containing the classed post map previously created, copy it, click back to the window with the contour maps in it, and paste it five times.
- Overlay each of the classed post maps with each of the remaining contour maps by dragging a Classed Post layer into each of the maps above the Contour layers in the Object Manager.
- Adjust the contours to match the classed post map colors. To do this, select one of the contour layers and click on the Levels tab in the Property Manager. On the Levels page:
- Change the Level method to Advanced, and click Edit Levels.
- Click the Level button, set the Minimum to -288 and the Interval to 23 (just like the classed post classes) and click OK.
- Double click on each of the levels under the Fill column and change the color fill for each level to the same as that of the classed post classes (navy blue, cyan, green, yellow, red, magenta, pink).
- You may want to fine tune the values for each level to match the minimum value of the classed post map classes exactly.
- Click Save and saved the levels to an LVL file (ContourLevels.lvl) and click OK.
- Check the check box next to Fill contours.
- Load the LVL file for each of the four remaining contour layers and fill the contours. For example:
- Select one of the other contour layers and click on the Levels tab in the Property Manager.
- Change the Level method to Advanced, and click Edit Levels.
- Click Load, select the LVL file and click Open and OK.
- Check the check box next to Fill contours.
- All the methods seem relatively accurate to the data, so that is good. But I do not like how Triangulation with Linear Interpolation interpolated the data in between the flight lines. When I zoom in, it appears quite jagged. So I remove that option. That leaves four gridding methods.

Step 3: Grid the Data Manually with Options Specific to Data
With the 4 methods left (Inverse Distance, Kriging, Natural Neighbor, and Minimum Curvature), I wanted to grid them with the actual grid spacing of the data to help pick up any anomalies that the coarser default grid spacing missed. I do this manually.
- Click Grid | Data, select NV_1152.dat and click Open.
- In the Grid Data dialog:
- Set the XYZ columns to C, D and K, respectively.
- Select Inverse Distance to a Power gridding method
- Change the Spacing in the X direction to 0.0001 (the distance between points in the X direction, as measured above).
- Change the Spacing in the Y direction to 0.001 (about 1/5 the distance between flight lines).
- Check Blank grid outside convex hull of data so that the areas outside the flight lines are not interpolated.
- Change the Output Grid File name to include the gridding method (e.g. InverseDistance_HiRes.grd).
- Click OK. The grid is created.
- Now let’s update the map with the new grid. Select the contour layer for Inverse Distance, and in the Property Manager, on the General page, click the Open Grid button, select the new grid file and click Open. The contours are updated.
- Repeat steps 1-3 for Kriging, Natural Neighbor, and Minimum Curvature.
- Once all the maps are updated, I can see that gridding with Minimum Curvature at a higher resolution method really smeared the contours out. I don’t like that. Setting an anisotropy value (an advanced option for that gridding method) didn’t seem to help, so I eliminated that method. That left 3 potential gridding methods: Inverse Distance to a Power, Kriging, and Natural Neighbor.

Step 4: Calculate Residuals
At this point, all three remaining maps look pretty similar to me visually, and they all look “nice”. The next step is to see if I can tell a difference between the maps (and hence grids) mathematically, using the residuals. This is important because although I want the map to look nice, I also want it to be the most accurate relative to the data. For this, I will calculate the sum of the residuals for those three grids.
- Click Grid | Residuals.
- Select the high resolution Kriging grid and click Open.
- Select NV_1152.dat and click Open.
- Select columns C, D and K as XYZ and store the residuals in column L.
- Click OK. The worksheet opens with the data and the new Residuals column.
- Click File | Save to save the worksheet and then File | Close to close it.
- Click Grid | Residuals again.
- Select the high resolution Inverse Distance grid and click Open.
- Select NV_1152.dat and click Open.
- Select columns C, D and K as XYZ and store the residuals in column M.
- Click OK. The worksheet opens with the data and the new Residuals column.
- Click File | Save to save the worksheet and then File | Close to close it.
- Click Grid | Residuals a last time.
- Select the high resolution Natural Neighbor grid and click Open.
- Select NV_1152.dat and click Open.
- Select columns C, D and K as XYZ and store the residuals in column N.
- Click OK. Now all three residuals are there in the worksheet.
- Let’s calculate the square of the residuals.
- Select column L by clicking on the column header.
- Click Data | Transform, enter the function L=L*L
- Click OK.
- Click Data | Statistics, make sure Sum is checked and click OK. The sum of the square of the residuals (for the Kriging grid) is displayed. Note this value and click Close.

- Repeat Step 17 for columns M (Inverse Distance) and N (Natural Neighbor).
- The results show that Kriging has the lowest residuals and so is the most accurate relative to the original data. You can calculate the residuals for the original Kriging grid created by the script with the default settings to compare if decreasing the grid spacing (increasing the resolution) has increased the accuracy, and yes it has.

Based on the residuals, the Kriging grid best represents the data with a higher density of grid nodes. So my conclusion is that the best gridding parameters to use for this data set is the Kriging gridding method with a grid node spacing of 0.0001 in the X direction and 0.001 in the Y direction.
Although much time was spent to conclude the best gridding parameters, most of the time was spent eliminating the other methods or parameters. I can now be confident that I’m using an accurate set of gridding parameters to best display the data.

The map above is created with proportional XY scaling (and the maps created by the script are scaled to a particular size, unrelated to their map coordinates). As many of you know, 1° of latitude does not equal 1° of longitude, except at the equator. Therefore, the map above is a little compressed in the Y direction. To scale lat/long maps correctly, multiply the X scaling by the cosine of the latitude, and then multiply the Y scaling by that value. Please see our KB article: How can I scale my Lat/Long maps correctly?

Another option, suggested by a user, is to convert the data from lat/long to UTM (or another coordinate system with linear units) prior to gridding. Having linear, or proportional, XY units could have a slight effect on the search around the grid nodes, or the weight of the data points in the grid node calculation. For instructions on converting the coordinate system of raw data in Surfer, please see our KB article: How can I convert the coordinate system of raw data, such as from UTM to Lat/Long?
For more information about gridding data, please see these additional resources:
- The Help (Help | Contents): On the Contents page, review the topics under the Gridding | Gridding Methods book
- Webinar Gridding in Surfer
- Knowledge Base articles:
- What types of gridding methods are available?
- What gridding method is best for my data file?
- What advanced options are available for each of the different gridding methods?
- Newsletter articles:
- What gridding method should I use? Gridding for non-geostatisticians
- A Basic Understanding of Surfer Gridding Methods – Part 1
- A Basic Understanding of Surfer Gridding Methods – Part 2
- Paper by Chin-Shung Yang, Szu-Pyng Kao, Fen-Bin Lee, Pen-Shan Hung: TWELVE DIFFERENT INTERPOLATION METHODS: A CASE STUDY OF SURFER 8.0
Comments 5
Thanks for sharing this example. I had one comment that users may want to consider or keep in mind. Generally I had the understanding that it is best practice to convert your data from a geographic projection (e.g. coordinates in lat/lon in degrees) into some projected coordinate system selected to preserves distance in all directions locally (e.g. a UTM grid) BEFORE you do your gridding and interpolation. The reason for this is that the latitude/longitude grid system is not a uniform grid in terms of distance and the distance represented by a degree of latitude and a degree of longitude are not necessarily the same and are dependent on latitude as the meridians converge at the poles. In your example it appears that you have left the data in lat/lon and the interpolation methods are treating them as if they were in consistent units of length, rather than in degrees. For your example data set from Cuprite, with a latitude of ~37.54 deg, one degree of latitude would be equal to approximately 111 kilometers whereas one degree of longitude would be equal to 88 kilometers. So users should be cognizant of this when applying these techniques to data sets.
You are correct that one degree of latitude is not the same as one degree of longitude.
As you say, you could do the conversion to UTM (or any other coordinate system with linear units) before you grid the data. That may affect the search or the weight of the data points around a node. I'm not sure it would have a significant effect though, but it could. That is a good idea.
Alternatively, for visual appearance you could grid the data in lat/long and rescale the maps. By default, Surfer scales maps proportionally so 1x = 1y. This is how I left the final map in that article (the script scales the maps by size, so that is even more different). However, you can change the scaling of the map easily in Surfer to be more appropriate to lat/long data by multiplying the longitude by the cosine of the latitude (see: http://www.goldensoftware.com/knowledge-base/surfer/1067-how-can-i-scale-my-lat-long-maps-correctly).
I have updated the article with this information! Thank you!
Great Post! Very helpful as I am gridding with similarly acquired ground data. It seems like this whole workflow could be automated into one script for ease of use.
A very good approach. Should be helpful for 2D seismic mapping too.
Thank you for excellent overview!!