The scripts here are provided as free downloads for the benefit of geospatial software users, particularly users of Surfer. Please note they are to be used AT YOUR OWN RISK. You are welcome to modify or re-distribute them as you please, as long as the header comments remain intact, and any changes are documented below the header. Please send your comments, questions, or bug reports to support. From time to time we may write special request scripts and post them here. Feel free to request custom scripts or help, and we'll do the best we can to help you out.
GetFilenames is a simple function to return a list of all the filenames in a given folder. You can specify a file extension to filter by as well, so only matching file types are returned in the list. Download
SetBlankingFlag is a script to open up a folder full of bln files, and set the blanking flag for each one to the same value (valid values are 1 or 0, but 1 is default in Surfer). NOTE: This script uses the GetFilenames function posted above, but it is also included in the zip file. Download
GridLoader is a Scripter class that provides a simple pair of functions for loading the data of a grid into an array, and writing an array of data back to a new grid. If you are doing pixel operations, such as filtering or math functions, the Grid.GetNode method offered by Surfer works, but is fairly slow. Instead, load the data into an array, then loop through the array performing the required operations, and finally re-write the data to a new file when you are done. A sample script is also included to demonstrate using the class. Download
GridStats is a Scripter class that provides functionality for producing grid reports using Surfer Automation. Currently, Surfer does not provide access to the Grid Report (or it's data) via automation. Including this class in your scripts allows you to load a grid and calculate all of the statistics that can be found in a grid report. You can then access any of the stats values and use them in your scripts, or you can write the information to a text file that mimics the standard Surfer grid report. A sample script is also included to demonstrate using the class. Download
GridRecovery is a very small script that recovers grids from Surfer plots. Since the actual grid data is stored in your .srf files, you can extract and save grids quite easily if you've lost the original grids - with only a couple of lines of code! Download
RowFilter demonstrates looping through the nodes in a grid file to apply a custom filter to the grid. It also uses the y-position value as part of the function, so you can write filters that are location-variable. Note it would be quite easy to modify the script to include the x-position in the function as well. Originally posted on Surfer boards as reply to request. Download
BlnTools is a pair of routines to separate individual shapes in a .bln file into their own files, or combine several shapes into a single file. Golden Software blanking files are easy to work with because they are ASCII text - if you have other files that you would like split or combined, such as shape or DXF, try converting them to .bln format in Surfer first, then use this script. Download