1GRDEDIT(1) Generic Mapping Tools GRDEDIT(1)
2
3
4
6 grdedit - Modifying the header or content of a 2-D grid file
7
9 grdedit grdfile [ -A ] [ -Dxname/yname/zname/scale/offset/title/remark
10 ] [ -E ] [ -Nxyzfile ] [ -Rwest/east/south/north[r] ] [ -S ] [ -T ] [
11 -V ] [ -:[i|o] ] [ -bi[s|S|d|D[ncol]|c[var1/...]] ] [ -f[i|o]colinfo ]
12
14 grdedit reads the header information in a binary 2-D grid file and
15 replaces the information with values provided on the command line [if
16 any]. As an option, global, geographical grids (with 360 degrees lon‐
17 gitude range) can be rotated in the east-west direction, and individual
18 nodal values can be replaced from a table of x, y, z values. grdedit
19 only operates on files containing a grdheader.
20
21 grdfile
22 Name of the 2-D grid file to modify. (See GRID FILE FORMATS
23 below).
24
26 No space between the option flag and the associated arguments.
27
28 -A If necessary, adjust the file's x_inc, y_inc to be compatible
29 with its domain (or a new domain set with -R). Older grid files
30 (i.e., created prior to GMT 3.1) often had excessive slop in
31 x_inc, y_inc and an adjustment is necessary. Newer files are
32 created correctly.
33
34 -D Give new values for xname, yname, zname, scale, offset, title,
35 and remark. To leave some of the values untouched, specify = as
36 the new value. Alternatively, to allow "/" to be part of one of
37 the values, use any non-alphanumeric character (and not the
38 equal sign) as separator by both starting and ending with it.
39 For example: -D:xname:yname:zname:scale:offset:title:remark:
40
41 -E Transpose the grid and exchange the x and y information. Incom‐
42 patible with the other options.
43
44 -H Input file(s) has Header record(s). Number of header records
45 can be changed by editing your .gmtdefaults4 file. If used, GMT
46 default is 1 header record. Use -Hi if only input data should
47 have header records [Default will write out header records if
48 the input data have them]. Blank lines and lines starting with #
49 are always skipped.
50
51 -N Read the ASCII (or binary; see -bi) file xyzfile and replace the
52 corresponding nodal values in the grid with these z values.
53
54 -R xmin, xmax, ymin, and ymax specify the Region of interest. For
55 geographic regions, these limits correspond to west, east,
56 south, and north and you may specify them in decimal degrees or
57 in [+-]dd:mm[:ss.xxx][W|E|S|N] format. Append r if lower left
58 and upper right map coordinates are given instead of w/e/s/n.
59 The two shorthands -Rg and -Rd stand for global domain (0/360
60 and -180/+180 in longitude respectively, with -90/+90 in lati‐
61 tude). For calendar time coordinates you may either give (a)
62 relative time (relative to the selected TIME_EPOCH and in the
63 selected TIME_UNIT; append t to -JX|x), or (b) absolute time of
64 the form [date]T[clock] (append T to -JX|x). At least one of
65 date and clock must be present; the T is always required. The
66 date string must be of the form [-]yyyy[-mm[-dd]] (Gregorian
67 calendar) or yyyy[-Www[-d]] (ISO week calendar), while the clock
68 string must be of the form hh:mm:ss[.xxx]. The use of delim‐
69 iters and their type and positions must be exactly as indicated
70 (however, input, output and plot formats are customizable; see
71 gmtdefaults). The new w/e/s/n values will replace those in the
72 grid, and the x_inc, y_inc values are adjusted, if necessary.
73
74 -S For global, geographical grids only. Grid values will be
75 shifted longitudionally according to the new borders given in
76 -R.
77
78 -T Make necessary changes in the header to convert a gridline-reg‐
79 istred grid to a pixel-registered grid, or vice-versa. Basi‐
80 cally, gridline-registered grids will have their domain extended
81 by half the x- and y-increments whereas pixel-registered grids
82 will have their domain shrunk by the same amount.
83
84 -V Selects verbose mode, which will send progress reports to stderr
85 [Default runs "silently"].
86
87 -bi Selects binary input. Append s for single precision [Default is
88 d (double)]. Uppercase S or D will force byte-swapping.
89 Optionally, append ncol, the number of columns in your binary
90 input file if it exceeds the columns needed by the program. Or
91 append c if the input file is netCDF. Optionally, append
92 var1/var2/... to specify the variables to be read. [Default is
93 3 input columns].
94
95 -f Special formatting of input and/or output columns (time or geo‐
96 graphical data). Specify i or o to make this apply only to
97 input or output [Default applies to both]. Give one or more
98 columns (or column ranges) separated by commas. Append T (abso‐
99 lute calendar time), t (relative time in chosen TIME_UNIT since
100 TIME_EPOCH), x (longitude), y (latitude), or f (floating point)
101 to each column or column range item. Shorthand -f[i|o]g means
102 -f[i|o]0x,1y (geographic coordinates).
103
105 By default GMT writes out grid as single precision floats in a COARDS-
106 complaint netCDF file format. However, GMT is able to produce grid
107 files in many other commonly used grid file formats and also facili‐
108 tates so called "packing" of grids, writing out floating point data as
109 2- or 4-byte integers. To specify the precision, scale and offset, the
110 user should add the suffix =id[/scale/offset[/nan]], where id is a two-
111 letter identifier of the grid type and precision, and scale and offset
112 are optional scale factor and offset to be applied to all grid values,
113 and nan is the value used to indicate missing data. When reading
114 grids, the format is generally automatically recognized. If not, the
115 same suffix can be added to input grid file names. See grdreformat(1)
116 and Section 4.17 of the GMT Technical Reference and Cookbook for more
117 information.
118
119 When reading a netCDF file that contains multiple grids, GMT will read,
120 by default, the first 2-dimensional grid that can find in that file. To
121 coax GMT into reading another multi-dimensional variable in the grid
122 file, append ?varname to the file name, where varname is the name of
123 the variable. Note that you may need to escape the special meaning of ?
124 in your shell program by putting a backslash in front of it, or by
125 placing the filename and suffix between quotes or double quotes. The
126 ?varname suffix can also be used for output grids to specify a variable
127 name different from the default: "z". See grdreformat(1) and Section
128 4.18 of the GMT Technical Reference and Cookbook for more information,
129 particularly on how to read splices of 3-, 4-, or 5-dimensional grids.
130
132 When the output grid type is netCDF, the coordinates will be labeled
133 "longitude", "latitude", or "time" based on the attributes of the input
134 data or grid (if any) or on the -f or -R options. For example, both
135 -f0x -f1t and -R90w/90e/0t/3t will result in a longitude/time grid.
136 When the x, y, or z coordinate is time, it will be stored in the grid
137 as relative time since epoch as specified by TIME_UNIT and TIME_EPOCH
138 in the .gmtdefaults file or on the command line. In addition, the unit
139 attribute of the time variable will indicate both this unit and epoch.
140
142 Let us assume the file data.grd covers the area 300/310/10/30. We want
143 to change the boundaries from geodetic longitudes to geographic and put
144 a new title in the header. We accomplish this by
145
146 grdedit data.grd -R-60/-50/10/30 -D=/=/=/=/=/"Gravity Anomalies"/=
147
148 The grid world.grd has the limits 0/360/-72/72. To shift the data so
149 that the limits would be -180/180/-72/72, use
150
151 grdedit world.grd -R-180/180/-72/72 -S
152
153 The file junk.grd was created prior to GMT 3.1 with incompatible -R and
154 -I arguments. To reset the x- and y-increments we run
155
156 grdedit junk.grd -A
157
158 The file junk.grd was created prior to GMT 4.1.3 and does not contain
159 the required information to indicate that the grid is geographic. To
160 add this information, run
161
162 grdedit junk.grd -fg
163
165 GMT(1), grd2xyz(1), xyz2grd(1)
166
167
168
169GMT 4.3.1 15 May 2008 GRDEDIT(1)