Next: B.3 Sun raster files Up: B.2 Grid files Previous: B.2.3 Boundary Conditions for Contents Index

##
B.2.4 Native binary grid files

The old style native grid file format that was common in earlier version of GMT is still supported, although the use of netCDF files is strongly recommended. The file starts with a header of 892 bytes containing a number of attributes defining the content. The grdedit utility program will allow you to edit parts of the header of an existing grid file. The attributes listed in Table B.2 are contained within the header record in the order given (except the -array which is not part of the header structure, but makes up the rest of the file). As this header was designed long before 64-bit architectures became available, the jump from the first three integers to the subsequent doubles in the structure does not occur on a 16-byte alignment. While GMT handles the reading of these structures correctly, enterprising programmers must take care to read this header correctly (see our code for details).

Table: GMT grid file header record. TYPE can be char, short, int, float, or double.
Parameter | Description
int nx | Number of nodes in the -dimension
int ny | Number of nodes in the y-dimension
int node_offset | 0 for grid line registration, 1 for pixel registration
double x_min | Minimum -value of region
double x_max | Maximum -value of region
double y_min | Minimum -value of region
double y_max | Maximum -value of region
double z_min | Minimum -value in data set
double z_max | Maximum -value in data set
double x_inc | Node spacing in -dimension
double y_inc | Node spacing in -dimension
double z_scale_factor | Factor to multiply -values after read
double z_add_offset | Offset to add to scaled -values
char x_units[80] | Units of the -dimension
char y_units[80] | Units of the -dimension
char z_units[80] | Units of the -dimension
char title[80] | Descriptive title of the data set
char command[320] | Command line that produced the grid file
char remark[160] | Any additional comments
TYPE z[nx*ny] | 1-D array with -values in scanline format

Next: B.3 Sun raster files Up: B.2 Grid files Previous: B.2.3 Boundary Conditions for Contents Index