1GRDIMAGE(1) Generic Mapping Tools GRDIMAGE(1)
2
3
4
6 grdimage - Create grayshaded or colored image from a 2-D netCDF grid
7 file
8
10 grdimage grd_z | grd_r grd_g grd_b -Ccptfile -Jparameters [
11 -B[p|s]parameters ] [ -Ei|dpi ] [ -G[f|b]color ] [ -Iintensfile] [ -K ]
12 [ -M ] [ -N ] [ -O ] [ -P ] [ -Q ] [ -Rwest/east/south/north[r] ] [
13 -S[-]b|c|l|n[/threshold] ] [ -T ] [ -U[just/dx/dy/][c|label] ] [ -V ] [
14 -X[a|c|r][x-shift[u]] ] [ -Y[a|c|r][y-shift[u]] ] [ -ccopies ] [
15 -f[i|o]colinfo ]
16
18 grdimage reads one 2-D gridded file and produces a gray-shaded (or col‐
19 ored) map by plotting rectangles centered on each grid node and assign‐
20 ing them a gray-shade (or color) based on the z-value. Alternatively,
21 grdimage reads three 2-D gridded files with the red, green, and blue
22 components directly (all must be in the 0-255 range). Optionally, illu‐
23 mination may be added by providing a file with intensities in the
24 (-1,+1) range. Values outside this range will be clipped. Such inten‐
25 sity files can be created from the grid using grdgradient and, option‐
26 ally, modified by grdmath or grdhisteq.
27 When using map projections, the grid is first resampled on a new rec‐
28 tangular grid with the same dimensions. Higher resolution images can be
29 optained by using the -E option. To obtain the resampled value (and
30 hence shade or color) of each map pixel, its location is inversely pro‐
31 jected back onto the input grid after which a value is interpolated
32 between the surrounding input grid values. By default bi-cubic interpo‐
33 lation is used. Aliasing is avoided by also forward projecting the
34 input grid nodes. If two or more nodes are projected onto the same
35 pixel, their average will dominate in the calculation of the pixel
36 value. Interpolation and aliasing is controlled with the -S option.
37 The -R option can be used to select a map region larger or smaller than
38 that implied by the extent of the grid.
39 A (color) PostScript file is output.
40
41 grd_z | grd_r grd_g grd_b
42 2-D gridded data set (or red, green, blue grids) to be imaged
43 (See GRID FILE FORMATS below.)
44
45 -C name of the color palette table (for grd_z only).
46
47 -J Selects the map projection. Scale is UNIT/degree, 1:xxxxx, or
48 width in UNIT (upper case modifier). UNIT is cm, inch, or m,
49 depending on the MEASURE_UNIT setting in .gmtdefaults4, but this
50 can be overridden on the command line by appending c, i, or m to
51 the scale/width value. When central meridian is optional,
52 default is center of longitude range on -R option. Default
53 standard parallel is the equator. For map height, max dimen‐
54 sion, or min dimension, append h, +, or - to the width, respec‐
55 tively.
56 More details can be found in the psbasemap man pages.
57
58 CYLINDRICAL PROJECTIONS:
59
60 -Jclon0/lat0/scale (Cassini)
61 -Jcyl_stere/[lon0/[lat0/]]scale (Cylindrical Stereographic)
62 -Jj[lon0/]scale (Miller)
63 -Jm[lon0/[lat0/]]scale (Mercator)
64 -Jmlon0/lat0/scale (Mercator - Give meridian and standard paral‐
65 lel)
66 -Jo[a]lon0/lat0/azimuth/scale (Oblique Mercator - point and
67 azimuth)
68 -Jo[b]lon0/lat0/lon1/lat1/scale (Oblique Mercator - two points)
69 -Joclon0/lat0/lonp/latp/scale (Oblique Mercator - point and
70 pole)
71 -Jq[lon0/[lat0/]]scale (Cylindrical Equidistant)
72 -Jtlon0/[lat0/]scale (TM - Transverse Mercator)
73 -Juzone/scale (UTM - Universal Transverse Mercator)
74 -Jy[lon0/[lat0/]]scale (Cylindrical Equal-Area)
75
76 CONIC PROJECTIONS:
77
78 -Jblon0/lat0/lat1/lat2/scale (Albers)
79 -Jdlon0/lat0/lat1/lat2/scale (Conic Equidistant)
80 -Jllon0/lat0/lat1/lat2/scale (Lambert Conic Conformal)
81
82 AZIMUTHAL PROJECTIONS:
83
84 -Jalon0/lat0[/horizon]/scale (Lambert Azimuthal Equal-Area)
85 -Jelon0/lat0[/horizon]/scale (Azimuthal Equidistant)
86 -Jflon0/lat0[/horizon]/scale (Gnomonic)
87 -Jglon0/lat0[/horizon]/scale (Orthographic)
88 -Jglon0/lat0/altitude/azimuth/tilt/twist/Width/Height/scale
89 (General Perspective).
90 -Jslon0/lat0[/horizon][/slat]/scale (General Stereographic)
91
92 MISCELLANEOUS PROJECTIONS:
93
94 -Jh[lon0/]scale (Hammer)
95 -Ji[lon0/]scale (Sinusoidal)
96 -Jkf[lon0/]scale (Eckert IV)
97 -Jk[s][lon0/]scale (Eckert IV)
98 -Jn[lon0/]scale (Robinson)
99 -Jr[lon0/]scale (Winkel Tripel)
100 -Jv[lon0/]scale (Van der Grinten)
101 -Jw[lon0/]scale (Mollweide)
102
103 NON-GEOGRAPHICAL PROJECTIONS:
104
105 -Jp[a]scale[/origin][r|z] (Polar coordinates (theta,r))
106 -Jxx-scale[d|l|ppow|t|T][/y-scale[d|l|ppow|t|T]] (Linear, log,
107 and power scaling)
108
110 No space between the option flag and the associated arguments.
111
112 -B Sets map boundary annotation and tickmark intervals; see the
113 psbasemap man page for all the details.
114
115 -E Sets the resolution of the projected grid that will be created
116 if a map projection other than Linear or Mercator was selected.
117 By default, the projected grid will be of the same size (rows
118 and columns) as the input file. Specify i to use the PostScript
119 image operator to interpolate the image at the device resolu‐
120 tion.
121
122 -G This option only applies when the resulting image otherwise
123 would consist of only two colors: black (0) and white (255). If
124 so, this option will instead use the image as a transparent mask
125 and paint the mask (or its inverse, with -Gb) with the given
126 color combination. (See SPECIFYING COLOR below).
127
128 -I Gives the name of a grid file with intensities in the (-1,+1)
129 range. [Default is no illumination].
130
131 -K More PostScript code will be appended later [Default terminates
132 the plot system].
133
134 -M Force conversion to monochrome image using the (television) YIQ
135 transformation.
136
137 -N Do not clip the image at the map boundary (only relevant for
138 non-rectangular maps).
139
140 -O Selects Overlay plot mode [Default initializes a new plot sys‐
141 tem].
142
143 -P Selects Portrait plotting mode [Default is Landscape, see gmtde‐
144 faults to change this].
145
146 -Q Make grid nodes with z = NaN transparent, using the colormasking
147 feature in PostScript Level 3 (the PS device must support PS
148 Level 3).
149
150 -R xmin, xmax, ymin, and ymax specify the Region of interest. For
151 geographic regions, these limits correspond to west, east,
152 south, and north and you may specify them in decimal degrees or
153 in [+-]dd:mm[:ss.xxx][W|E|S|N] format. Append r if lower left
154 and upper right map coordinates are given instead of w/e/s/n.
155 The two shorthands -Rg and -Rd stand for global domain (0/360
156 and -180/+180 in longitude respectively, with -90/+90 in lati‐
157 tude). For calendar time coordinates you may either give (a)
158 relative time (relative to the selected TIME_EPOCH and in the
159 selected TIME_UNIT; append t to -JX|x), or (b) absolute time of
160 the form [date]T[clock] (append T to -JX|x). At least one of
161 date and clock must be present; the T is always required. The
162 date string must be of the form [-]yyyy[-mm[-dd]] (Gregorian
163 calendar) or yyyy[-Www[-d]] (ISO week calendar), while the clock
164 string must be of the form hh:mm:ss[.xxx]. The use of delim‐
165 iters and their type and positions must be exactly as indicated
166 (however, input, output and plot formats are customizable; see
167 gmtdefaults). You may ask for a larger w/e/s/n region to have
168 more room between the image and the axes. A smaller region than
169 specified in the grid file will result in a subset of the grid
170 [Default is the region given by the grid file].
171
172 -S Select the interpolation mode by adding b for B-spline smooth‐
173 ing, c for bicubic interpolation, l for bilinear interpolation,
174 or n for nearest-neighbor value (for example to plot categorical
175 data). Optionally, prepend - to switch off antialiasing. Add
176 /threshold to control how close to nodes with NaNs the interpo‐
177 lation will go. A threshold of 1.0 requires all (4 or 16) nodes
178 involved in interpolation to be non-NaN. 0.5 will interpolate
179 about half way from a non-NaN value; 0.1 will go about 90% of
180 the way, etc. [Default is bicubic interpolation with antialias‐
181 ing and a threshold of 0.5].
182
183 -T This option has become OBSOLETE. Use grdview -T instead. Use
184 -Sn to plot near-neighbor values only (use -E to increase the
185 resolution). Use -Sn -Q to obtain something similar to the old
186 option -Ts. The option -To is no longer supported.
187
188 -U Draw Unix System time stamp on plot. By adding just/dx/dy/, the
189 user may specify the justification of the stamp and where the
190 stamp should fall on the page relative to lower left corner of
191 the plot. For example, BL/0/0 will align the lower left corner
192 of the time stamp with the lower left corner of the plot.
193 Optionally, append a label, or c (which will plot the command
194 string.). The GMT parameters UNIX_TIME, UNIX_TIME_POS, and
195 UNIX_TIME_FORMAT can affect the appearance; see the gmtdefaults
196 man page for details. The time string will be in the locale set
197 by the environment variable TZ (generally local time).
198
199 -V Selects verbose mode, which will send progress reports to stderr
200 [Default runs "silently"].
201
202 -X -Y Shift plot origin relative to the current origin by (x-shift,y-
203 shift) and optionally append the length unit (c, i, m, p). You
204 can prepend a to shift the origin back to the original position
205 after plotting, or prepend r [Default] to reset the current
206 origin to the new location. If -O is used then the default (x-
207 shift,y-shift) is (0,0), otherwise it is (r1i, r1i) or (r2.5c,
208 r2.5c). Alternatively, give c to align the center coordinate (x
209 or y) of the plot with the center of the page based on current
210 page size.
211
212 -c Specifies the number of plot copies. [Default is 1].
213
214 -f Special formatting of input and/or output columns (time or geo‐
215 graphical data). Specify i or o to make this apply only to
216 input or output [Default applies to both]. Give one or more
217 columns (or column ranges) separated by commas. Append T (abso‐
218 lute calendar time), t (relative time in chosen TIME_UNIT since
219 TIME_EPOCH), x (longitude), y (latitude), or f (floating point)
220 to each column or column range item. Shorthand -f[i|o]g means
221 -f[i|o]0x,1y (geographic coordinates).
222
224 GMT is able to recognize many of the commonly used grid file formats,
225 as well as the precision, scale and offset of the values contained in
226 the grid file. When GMT needs a little help with that, you can add the
227 suffix =id[/scale/offset[/nan]], where id is a two-letter identifier of
228 the grid type and precision, and scale and offset are optional scale
229 factor and offset to be applied to all grid values, and nan is the
230 value used to indicate missing data. See grdreformat(1) and Section
231 4.17 of the GMT Technical Reference and Cookbook for more information.
232
233 When reading a netCDF file that contains multiple grids, GMT will read,
234 by default, the first 2-dimensional grid that can find in that file. To
235 coax GMT into reading another multi-dimensional variable in the grid
236 file, append ?varname to the file name, where varname is the name of
237 the variable. Note that you may need to escape the special meaning of ?
238 in your shell program by putting a backslash in front of it, or by
239 placing the filename and suffix between quotes or double quotes. See
240 grdreformat(1) and Section 4.18 of the GMT Technical Reference and
241 Cookbook for more information, particularly on how to read splices of
242 3-, 4-, or 5-dimensional grids.
243
245 To gray-shade the file hawaii_grav.grd with shades given in shades.cpt
246 on a Lambert map at 1.5 cm/degree along the standard parallels 18 and
247 24, and using 1 degree tickmarks:
248
249 grdimage hawaii_grav.grd -Jl18/24/1.5c -Cshades.cpt -B1 >
250 hawaii_grav_image.ps
251
252 To create an illuminated color PostScript plot of the gridded data set
253 image.grd, using the intensities provided by the file intens.grd, and
254 color levels in the file colors.cpt, with linear scaling at 10 inch/x-
255 unit, tickmarks every 5 units:
256
257 grdimage image.grd -Jx10i -Ccolors.cpt -Iintens.grd -B5 > image.ps
258
259 To create an false color PostScript plot from the three gridded files
260 red.grd, green.grd, and blue.grd, with linear scaling at 10 inch/x-
261 unit, tickmarks every 5 units:
262
263 grdimage red.grd green.grd blue.grd -Jx10i -B5 > rgbimage.ps
264
266 GMT(1), gmt2rgb(1), grdcontour(1), grdview(1), grdgradient(1), grdhis‐
267 teq(1)
268
269
270
271GMT 4.3.1 15 May 2008 GRDIMAGE(1)