Creating and Translating Grid Files for SURFER and ArcGIS:

 

SURFER Format:

If you have a data file that already contains gridded data, the following header can be placed in the file and the file directly imported into SURFER:

id                  the code letters DSAA which identify the file as an ASCII grid file.
                     (note: DSAA must be in caps)
nx   ny           nx (integer) is the # of grid lines along the x axis (columns)
                     ny (integer) is the # of grid lines along the y axis (rows)
xlo   xhi        xlo min. x value of the grid
                     xhi max. x value of the grid
ylo   yhi        ylo min. y value of the grid
                     yhi max. y value of the grid
zlo   zhi        zlo min. z value of the grid
                    zhi max. z value of the grid
grid row 1 z data.............................................
grid row 2 z data.............................................
etc.

these are the z values of the grid, organized in row order. The grid row 1 corresponds to ylo and the last to yhi. (This means that the first line corresponds to the “south” end of the map). As long as the grid values in the file are ordered correctly from left to right, it does not matter how many entries there are per line. Thus, you can put a grid row on one or more lines, as long as the values are ordered consecutively.
 

For an example of the header, say you have generated a grid containing 11 rows and 6 columns. Edit the file by typing in the first five lines as described above (shown in bold italics):

DSAA
6  11
0  500
0  1000
100.0  104.0
100.0       100.9       101.3       101.5       101.6       101.5
100.9       101.3       101.5       101.7       101.8       101.8
101.6       101.7       101.9       102.0       102.0       102.0
102.1       102.1       102.2       102.3       102.3       102.3
102.5       102.5       102.6       102.6       102.6       102.6
102.8       102.9       103.2       102.9       102.8       102.8
103.0       103.1       103.2       103.1       103.1       103.0
103.2       103.2       103.3       103.2       103.2       103.2
103.4       103.4       103.4       103.4       103.4       103.4
103.5       103.5       103.5       103.5       103.6       103.7
103.6       103.7       103.6       103.6       103.7       104.0

download the file: example.grd

Save the file on disk. Next, once in SURFER, click on “MAP” and then “CONTOUR.”  Find the file with the browse button and click OK. The next window will let you select the way you want to style your map. Click OK and the contour map should appear on the screen.

Note: you will probably want your grid to be mapped so that the first line of the file will be the “north” row and the last line the “south” row. The row order can be reversed in the file editor or you can do this directly in SURFER (version 6 or higher). Choose GRID and then TRANSFORM. Select your grid file and then choose “Mirror Y” as the operation. The new file (by default called “OUT.GRD”) will be oriented properly and can then be contoured as needed. Here is the map using default SURFER's default parameters:
 

contour map
 

 

ArcGIS Format:

ASCII grid files in ArcGIS have a header that is very similar to SURFER. By swapping headers, you can convert an ArcGIS ascii grid file to SURFER and vice-versa. The ASCII file must consist of header information containing a set of keywords, followed by cell values in row-major order. The file format is

NCOLS ###  (number of columns)

NROWS ###  (number of rows)

XLLCORNER ### (this is the world x-coordinate for the lower left corner of the map)

YLLCORNER ### (this is the world y-coordinate for the lower left corner of the map)

CELLSIZE ### (edge length of the raster cell – note that cells must be square)

NODATA_VALUE ###  (value of “no data” so that areas without data can be blanked on the map)

row 1 (begin the data, which is for the most part free format)

row 2

.

.

.

row n

 

where ### is a number, and the keyword NODATA_VALUE is optional and defaults to -9999. Row 1 of the data is at the top of the raster, row 2 is under row 1, and so on. Using the same example as the one above:

 

NCOLS 6

NROWS 11

XLLCORNER 0.0

YLLCORNER 0.0

CELLSIZE 100.0

NODATA_VALUE -9999

100.0       100.9       101.3       101.5       101.6       101.5
100.9       101.3       101.5       101.7       101.8       101.8
……

……
103.6       103.7       103.6       103.6       103.7       104.0

 

 

The NODATA_VALUE is the value in the ASCII file assigned to those cells whose true value is unknown. In the raster, they will be assigned the keyword NODATA. Cell values should be delimited by spaces. No carriage returns are necessary at the end of each row in the raster. The number of columns in the header determines when a new row begins. The number of cell values must be equal to the number of rows times the number of columns, or an error will be returned.

 

Once in this format, save the file as *.asc and use the toolbox command <Conversion Tools>  >>  <To Raster> >>  <ASCII to Raster> to translate the data to ArcGIS grid format.