1GRDEDIT(1) GMT GRDEDIT(1)
2
3
4
6 grdedit - Modify header or content of a grid
7
9 grdedit grid [ -A ] [ -C ] [
10 -D[+xxname][+yyname][+zzname][+sscale][+ooffset][+ninvalid][+tti‐
11 tle][+rremark] ] [ -E[a|h|l|r|t|v] ] [ -Goutgrid ] [ -Jparameters ]
12 [ -Ntable ] [ -Rregion ] [ -S ] [ -T ] [ -V[level] ] [ -bibinary ]
13 [ -dinodata ] [ -eregexp ] [ -fflags ] [ -:[i|o] ]
14
15 Note: No space is allowed between the option flag and the associated
16 arguments.
17
19 grdedit reads the header information in a binary 2-D grid file and
20 replaces the information with values provided on the command line [if
21 any]. As an option, global, geographical grids (with 360 degrees longi‐
22 tude range) can be rotated in the east-west direction, and individual
23 nodal values can be replaced from a table of x, y, z values. grdedit
24 only operates on files containing a grid header. Note: If it is impor‐
25 tant to retain the original data you should use -G to save the modified
26 grid to a new file.
27
29 grid Name of the 2-D grid file to modify. (See GRID FILE FORMATS
30 below).
31
33 -A If necessary, adjust the file's x_inc, y_inc to be compatible
34 with its domain (or a new domain set with -R). Older grid files
35 (i.e., created prior to GMT 3.1) often had excessive slop in
36 x_inc, y_inc and an adjustment is necessary. Newer files are
37 created correctly.
38
39 -C Clear the command history from the grid header.
40
41 -D[+xxname][+yyname][+zzname][+sscale][+ooffset][+ninvalid][+tti‐
42 tle][+rremark]
43 Give one or more combinations for values xname, yname, zname
44 (give the names of those variables and in square bracket their
45 units, e.g., "distance [km]"), scale (to multiply grid values
46 after read [normally 1]), offset (to add to grid after scaling
47 [normally 0]), invalid (a value to represent missing data
48 [NaN]), title (anything you like), and remark (anything you
49 like). Items not listed will remain untouched. Give a blank
50 name to completely reset a particular string. Use quotes to
51 group texts with more than one word. Note that for geographic
52 grids (-fg) xname and yname are set automatically.
53
54 -E[a|h|l|r|t|v]
55 Transform the grid in one of six ways and (for l|r|t) inter‐
56 change the x and y information: -Ea will rotate the grid around
57 180 degrees, -Eh will flip the grid horizontally
58 (left-to-right), -El will rotate the grid 90 degrees
59 counter-clockwise (left), -Er will rotate the grid 90 degrees
60 clockwise (right), -Et will transpose the grid [Default], -Ev
61 will flip the grid vertically (top-to-bottom). Incompatible
62 with the other options (except -G).
63
64 -Goutgrid
65 Normally, grdedit will overwrite the existing grid with the mod‐
66 ified grid. Use -G to write the modified grid to the file out‐
67 grid instead.
68
69 -Jparameters (more ...)
70 Select map projection. Use the -J syntax to save the georefer‐
71 encing info as CF-1 compliant metadata in netCDF grids. This
72 metadata will be recognized by GDAL.
73
74 -Ntable
75 Read the ASCII (or binary; see -bi) file table and replace the
76 corresponding nodal values in the grid with these x,y,z values.
77
78 -Rxmin/xmax/ymin/ymax[+r][+uunit] (more ...)
79 Specify the region of interest. The new w/e/s/n values will
80 replace those in the grid, and the x_inc, y_inc values are
81 adjusted, if necessary.
82
83 -S For global, geographical grids only. Grid values will be shifted
84 longitudinally according to the new borders given in -R.
85
86 -T Make necessary changes in the header to convert a gridline-reg‐
87 istered grid to a pixel-registered grid, or vice-versa. Basi‐
88 cally, gridline-registered grids will have their domain extended
89 by half the x- and y-increments whereas pixel-registered grids
90 will have their domain shrunk by the same amount.
91
92 -V[level] (more ...)
93 Select verbosity level [c].
94
95 -bi[ncols][t] (more ...)
96 Select native binary input. [Default is 3 input columns].
97
98 -dinodata (more ...)
99 Replace input columns that equal nodata with NaN.
100
101 -e[~]"pattern" | -e[~]/regexp/[i] (more ...)
102 Only accept data records that match the given pattern.
103
104 -f[i|o]colinfo (more ...)
105 Specify data types of input and/or output columns.
106
107 -h[i|o][n][+c][+d][+rremark][+rtitle] (more ...)
108 Skip or produce header record(s).
109
110 -^ or just -
111 Print a short message about the syntax of the command, then
112 exits (NOTE: on Windows just use -).
113
114 -+ or just +
115 Print an extensive usage (help) message, including the explana‐
116 tion of any module-specific option (but not the GMT common
117 options), then exits.
118
119 -? or no arguments
120 Print a complete usage (help) message, including the explanation
121 of all options, then exits.
122
124 By default GMT writes out grid as single precision floats in a
125 COARDS-complaint netCDF file format. However, GMT is able to produce
126 grid files in many other commonly used grid file formats and also
127 facilitates so called "packing" of grids, writing out floating point
128 data as 1- or 2-byte integers. (more ...)
129
131 When the output grid type is netCDF, the coordinates will be labeled
132 "longitude", "latitude", or "time" based on the attributes of the input
133 data or grid (if any) or on the -f or -R options. For example, both
134 -f0x -f1t and -R90w/90e/0t/3t will result in a longitude/time grid.
135 When the x, y, or z coordinate is time, it will be stored in the grid
136 as relative time since epoch as specified by TIME_UNIT and TIME_EPOCH
137 in the gmt.conf file or on the command line. In addition, the unit
138 attribute of the time variable will indicate both this unit and epoch.
139
141 Let us assume the file data.nc covers the area 300/310/10/30. We want
142 to change the boundaries from geodetic longitudes to geographic and put
143 a new title in the header. We accomplish this by
144
145 gmt grdedit data.nc -R-60/-50/10/30 -D+t"Gravity Anomalies"
146
147 The grid world.nc has the limits 0/360/-72/72. To shift the data so
148 that the limits would be -180/180/-72/72, use
149
150 gmt grdedit world.nc -R-180/180/-72/72 -S
151
152 The file junk.nc was created prior to GMT 3.1 with incompatible -R and
153 -I arguments. To reset the x- and y-increments we run
154
155 gmt grdedit junk.nc -A
156
157 The file junk.nc was created prior to GMT 4.1.3 and does not contain
158 the required information to indicate that the grid is geographic. To
159 add this information, run
160
161 gmt grdedit junk.nc -fg
162
163 To rotate the grid oblique.nc 90 degrees counter-clockwise and write
164 out the rotated grid to a new file, run
165
166 gmt grdedit oblique.nc -El -Goblique_rot.nc
167
169 gmt, grd2xyz, grdinfo xyz2grd
170
172 2019, P. Wessel, W. H. F. Smith, R. Scharroo, J. Luis, and F. Wobbe
173
174
175
176
1775.4.5 Feb 24, 2019 GRDEDIT(1)