next up previous contents index
Next: B.2.2 Grid line and Up: B.2 2-D grdfiles Previous: B.2 2-D grdfiles   Contents   Index


B.2.1 File contents

The default 2-D binary netCDF grdfile in GMT has several attributes. The grdedit utility program will allow you to edit parts of the header of an existing grdfile. The attributes listed in Table B.1 are contained within the header record in the order given (except the $z$-array which is not part of the header structure, but makes up the rest of the file).


Table B.1: GMT gridded file header record
Parameter Description
int nx Number of nodes in the $x$-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 $x$-value of region
double x_max Maximum $x$-value of region
double y_min Minimum $y$-value of region
double y_max Maximum $y$-value of region
double z_min Minimum $z$-value in data set
double z_max Maximum $z$-value in data set
double x_inc Node spacing in $x$-dimension
double y_inc Node spacing in $y$-dimension
double z_scale_factor Factor to multiply $z$-values after read
double z_add_offset Offset to add to scaled $z$-values
char x_units[80] Units of the $x$-dimension
char y_units[80] Units of the $y$-dimension
char z_units[80] Units of the $z$-dimension
char title[80] Descriptive title of the data set
char command[320] Command line that produced the grdfile
char remark[160] Any additional comments
float z[nx*ny] 1-D array with $z$-values in scanline format


GMT version 3 also allows other formats to be read. In addition to the default netCDF format it can use binary floating points, short integers, bytes, and bits, as well as 8-bit Sun rasterfiles (colormap ignored). Additional formats may be used by supplying read/write functions and linking these with the GMT libraries. The source file gmt_customio.c has the information that programmers will need to augment GMT to read custom grdfiles. We anticipate that the number of pre-programmed formats will increase as enterprising users implement what they need.


next up previous contents index
Next: B.2.2 Grid line and Up: B.2 2-D grdfiles Previous: B.2 2-D grdfiles   Contents   Index
Paul Wessel 2001-04-18