Import Surfer ASCII grid

This tool can be used to import a Surfer (Golden Software) ASCII grid file (*.grd) to a Whitebox GAT raster file. ASCII files are text and as such are capable of being opened and viewed using any text editor. The user must specify the name of one or more Surfer ASCII grid files to be imported. The tool will create Whitebox GAT raster files for each input file. Output file names are the same of the input files.

The format of the Surfer ASCII grid format is as follows:

DSAA
NumberOfColumns NumberOfRows
MinXCoordinate MaxXCoordinate
MinYCoordinate MaxYCoordinate
MinZValue MaxZValue
####.### ####.### ####.###...
####.### ####.### ####.###...

An Example is given below:

DSAA
201 380
416798.95 417000
4679619.71 4680000
174.66 174.54 174.39 ...
175.44 174.32 173.99 ...

ASCII files can be very large when there are a large number of rows and columns in the grid and are also much slower to read/write compared to binary files. Notice as well that all grid cells containing the Surfer NoData value of 1.70141E+38 will be converted to the Whitebox GAT NoData values (-32,768) in the output grid.

See Also:

Scripting:

The following is an example of a Python script using this tool:

wd = pluginHost.getWorkingDirectory()
# You may have multiple input files but they must
# be separated by semicolons in the string.
inputFiles = wd + "input1.grd" + ";" + wd + "input2.grd" + ";" + wd + "input3.grd"
args = [inputFiles]
pluginHost.runPlugin("ImportSurferAsciiGrid", args, False)

This is a Groovy script also using this tool:

def wd = pluginHost.getWorkingDirectory()
// You may have multiple input files but they must
// be separated by semicolons in the string.
def inputFiles = wd + "input1.grd" + ";" + wd + "input2.grd" + ";" + wd + "input3.grd"
String[] args = [inputFiles]
pluginHost.runPlugin("ImportSurferAsciiGrid", args, false)

Credits: