ASCII Grid File Format

 

File Description

ASCII grid files .GRD contain five header lines that provide information about the size and limits of the grid, followed by a list of Z values. The fields within ASCII grid files must be space delimited.

 

The listing of Z values follows the header information in the file. The Z values are stored in row-major order starting with the minimum Y coordinate. The first Z value in the grid file corresponds to the lower left corner of the map. This can also be thought of as the southwest corner of the map or, more specifically, the grid node of minimum X and minimum Y. The second Z value is the next adjacent grid node in the same row (the same Y coordinate but the next higher X coordinate). When the maximum X value is reached in the row, the list of Z values continues with the next higher row until all of the rows of Z values have been included.

 

The general format of an ASCII grid file is:

id

The identification string DSAA that identifies the file as an ASCII grid file.

 

 

nx ny

nx is the integer number of grid lines along the X axis (columns)

 

ny is the integer number of grid lines along the Y axis (rows)

 

 

xlo xhi

xlo is the minimum X value of the grid

 

xhi is the maximum X value of the grid

 

 

ylo yhi

ylo is the minimum Y value of the grid

 

yhi is the maximum Y value of the grid

 

 

zlo zhi

zlo is the minimum Z value of the grid

 

zhi is the maximum Z value of the grid

 

 

grid row 1

grid row 2

grid row 3

...

These are the rows of Z values of the grid, organized in row order. Each row has a constant Y coordinate. Grid row 1 corresponds to ylo; the last grid row corresponds to yhi. Within each row, the Z values are arranged from xlo to xhi.

 

Example

The following example grid file is ten rows high by ten columns wide. The first five lines of the file contain header information. X ranges from 0 to 9; Y ranges from 0 to 7; and Z ranges from 25 to 97.19. The first Z value shown corresponds to the lower left corner of the map and the following values correspond to the increasing X positions along the bottom row of the grid file. This file has a total of 100 Z values.

 

 

 

See Also

Surfer 6 Grid File Format

Surfer 7 Grid File Format

File Format Chart