grdedit − Modifying the header in a 2-D grdfile


grdedit grdfile [ −A ] [ −Dxname/yname/zname/scale/offset/title/remark ] [ −Nxyzfile ] [ −Rwest/east/south/north[r] ] [ −S ] [ −V ] [ −: ] [ −bi[s][n] ] [ −f[i|o]colinfo ]


grdedit reads the header information in a binary 2-D grdfile and replaces the information with values provided on the command line [if any]. As an option, global, geographical grids (with 360 degrees longitude range) can be rotated in the east-west direction, and individual nodal values can be replaced from a table of x, y, z values. grdedit only operates on files containing a grdheader.
No space between the option flag and the associated arguments. Use upper case for the option flags and lower case for modifiers.


Name of the 2-D grdfile to modify



If necessary, adjust the file’s x_inc, y_inc to be compatible with its domain (or a new domain set with −R). Older gridfiles (i.e., created prior to GMT 3.1) often had excessive slop in x_inc, y_inc and an adjustment is necessary. Newer files are created correctly.


Give new values for xname, yname, zname, scale, offset, title, and remark. To leave some of the values untouched, specify = as the new value.


Input file(s) has Header record(s). Number of header records can be changed by editing your .gmtdefaults4 file. If used, GMT default is 1 header record. Use −Hi if only input data should have header records [Default will write out header records if the input data have them].


Read the ASCII (or binary; see −bi) file xyzfile and replace the corresponding nodal values in the grid with these z values.


xmin, xmax, ymin, and ymax specify the Region of interest. For geographic regions, these limits correspond to west, east, south, and north and you may specify them in decimal degrees or in [+-]dd:mm[][W|E|S|N] format. Append r if lower left and upper right map coordinates are given instead of wesn. The two shorthands −Rg −Rd stand for global domain (0/360 or -180/+180 in longitude respectively, with -90/+90 in latitude). For calendar time coordinates you may either give relative time (relative to the selected TIME_EPOCH and in the selected TIME_UNIT; append t to −JX|x), or absolute time of the form [date]T[clock] (append T to −JX|x). At least one of date and clock must be present; the T is always required. The date string must be of the form [-]yyyy[-mm[-dd]] (Gregorian calendar) or yyyy[-Www[-d]] (ISO week calendar), while the clock string must be of the form hh:mm:ss[.xxx]. The use of delimiters and their type and positions must be as indicated (however, input/output and plotting formats are flexible). The new w/e/s/n values will replace those in the grid, and the x_inc, y_inc values are adjusted, if necessary.


For global, geographical grids only. Grid values will be shifted longitudionally according to the new borders given in −R.


Selects verbose mode, which will send progress reports to stderr [Default runs "silently"].


Selects binary input. Append s for single precision [Default is double]. Uppercase S (or D) will force byte-swapping. Append n for the number of columns in the binary file(s). [Default is 3 input columns].


Special formatting of input and output columns (time or geographical data). Specify i(nput) or o(utput) [Default is both input and output]. Give one or more columns (or column ranges) separated by commas. Append T (Absolute calendar time), t (time relative to chosen TIME_EPOCH), x (longitude), y (latitude), or f (floating point) to each column or column range item. Shorthand −f[i|o]g means −f[i|o]0x,1y (geographic coordinates).


Let us assume the file data.grd covers the area 300/310/10/30. We want to change the boundaries from geodetic longitudes to geographic and put a new title in the header. We accomplish this by

grdedit data.grd −R-60/-50/10/30 −D=/=/=/=/=/"Gravity Anomalies"/=

The grid world.grd has the limits 0/360/-72/72. To shift the data so that the limits would be -180/180/-72/72, use

grdedit world.grd −R-180/180/-72/72 −S

The file junk.grd was created prior to GMT 3.1 with incompatible −R and −I arguments. To reset the x- and y-increments we run

grdedit junk.grd −A


GMT(l), grd2xyz(l), xyz2grd(l)