1GRDIMAGE(1) GMT GRDIMAGE(1)
2
3
4
6 grdimage - Project grids or images and plot them on maps
7
9 grdimage grd_z | grd_r grd_g grd_b [ -Aout_img[=driver] ] [
10 -B[p|s]parameters ] [ -Ccpt ] [ -D[r] ] [ -E[i|dpi] ] -Jparameters
11 [ -G[f|b]color ] [ -I[intensfile|intensity|modifiers] ] [ -Jz|-Zpa‐
12 rameters ] [ -K ] [ -M ] [ -N ] [ -O ] [ -P ] [ -Q ] [
13 -Rwest/east/south/north[/zmin/zmax][+r] ] [ -U[stamp] ] [ -V[level] ]
14 [ -Xx_offset ] [ -Yy_offset ] [ -fflags ] [ -nflags ] [ -pflags ] [
15 -tr ]
16
17 Note: No space is allowed between the option flag and the associated
18 arguments.
19
21 grdimage reads one 2-D grid file and produces a gray-shaded (or col‐
22 ored) map by plotting rectangles centered on each grid node and assign‐
23 ing them a gray-shade (or color) based on the z-value. Alternatively,
24 grdimage reads three 2-D grid files with the red, green, and blue com‐
25 ponents directly (all must be in the 0-255 range). Optionally, illumi‐
26 nation may be added by providing a file with intensities in the (-1,+1)
27 range. Values outside this range will be clipped. Such intensity files
28 can be created from the grid using grdgradient and, optionally, modi‐
29 fied by grdmath or grdhisteq. Yet as a third alternative available when
30 GMT is build with GDAL support the grd_z file can be an image refer‐
31 enced or not (than see -Dr). In this case the images can be illuminated
32 with the file provided via the -I option. Here if image has no coordi‐
33 nates those of the intensity file will be used.
34
35 When using map projections, the grid is first resampled on a new rec‐
36 tangular grid with the same dimensions. Higher resolution images can be
37 obtained by using the -E option. To obtain the resampled value (and
38 hence shade or color) of each map pixel, its location is inversely pro‐
39 jected back onto the input grid after which a value is interpolated
40 between the surrounding input grid values. By default bi-cubic interpo‐
41 lation is used. Aliasing is avoided by also forward projecting the
42 input grid nodes. If two or more nodes are projected onto the same
43 pixel, their average will dominate in the calculation of the pixel
44 value. Interpolation and aliasing is controlled with the -n option.
45
46 The -R option can be used to select a map region larger or smaller than
47 that implied by the extent of the grid.
48
49 A (color) PostScript file is output.
50
52 grd_z | grd_r grd_g grd_b
53 2-D gridded data set (or red, green, blue grids) to be imaged
54 (See GRID FILE FORMATS below.)
55
56 -Jparameters (more ...)
57 Select map projection.
58
60 -Aout_img[=driver]
61 Save an image in a raster format instead of PostScript. Use
62 extension Append out_img to select the image file name and
63 extension. If the extension is one of .bmp, .gif, .jpg, .png,
64 or .tif then no driver information is required. For other out‐
65 put formats you must append the required GDAL driver. The
66 driver is the driver code name used by GDAL; see your GDAL
67 installation's documentation for available drivers. Notes: (1)
68 If a tiff file (.tif) is selected then we will write a GeoTiff
69 image if the GMT projection syntax translates into a PROJ4 syn‐
70 tax, otherwise a plain tiff file is produced. (2) Any vector
71 elements will be lost.
72
73 -B[p|s]parameters (more ...)
74 Set map boundary frame and axes attributes.
75
76 -Ccpt Name of the CPT (for grd_z only). Alternatively, supply the name
77 of a GMT color master dynamic CPT [rainbow] to automatically
78 determine a continuous CPT from the grid's z-range. If the
79 dynamic CPT has a default range then that range will be imposed
80 instead. Yet another option is to specify
81 -Ccolor1,color2[,color3,...] to build a linear continuous CPT
82 from those colors automatically. In this case color1 etc can be
83 a r/g/b triplet, a color name, or an HTML hexadecimal color
84 (e.g. #aabbcc ).
85
86 -D[r] Specifies that the grid supplied is an image file to be read via
87 GDAL. Obviously this option will work only with GMT versions
88 built with GDAL support. The image can be indexed or true color
89 (RGB) and can be an URL of a remotely located file. That is -D
90 http://www.somewhere.com/image.jpg is a valid file syntax. Note,
91 however, that to use it this way you must not be blocked by a
92 proxy. If you are, chances are good that it can work by setting
93 the environmental variable http_proxy with the value
94 'your_proxy:port' Append r to use the region specified by -R to
95 apply to the image. For example, if you have used -Rd then the
96 image will be assigned the limits of a global domain. The inter‐
97 est of this mode is that you can project a raw image (an image
98 without referencing coordinates).
99
100 -E[i|dpi]
101 Sets the resolution of the projected grid that will be created
102 if a map projection other than Linear or Mercator was selected
103 [100]. By default, the projected grid will be of the same size
104 (rows and columns) as the input file. Specify i to use the Post‐
105 Script image operator to interpolate the image at the device
106 resolution.
107
108 -G[f|b]color
109 This option only applies when the resulting image otherwise
110 would consist of only two colors: black (0) and white (255). If
111 so, this option will instead use the image as a transparent mask
112 and paint the mask (or its inverse, with -Gb) with the given
113 color combination.
114
115 -I[intensfile|intensity|modifiers]
116 Gives the name of a grid file with intensities in the (-1,+1)
117 range, or a constant intensity to apply everywhere; this simply
118 affects the ambient light. If just + is given then we derive an
119 intensity grid from the input data grid grd_z via a call to grd‐
120 gradient using the arguments -A-45 and -Nt1 for that module. You
121 can append +aazimuth and **+n*args to override those values. If
122 you want more specific intensities then run grdgradient sepa‐
123 rately first. [Default is no illumination].
124
125 -Jz|Zparameters (more ...)
126 Set z-axis scaling; same syntax as -Jx.
127
128 -K (more ...)
129 Do not finalize the PostScript plot.
130
131 -M Force conversion to monochrome image using the (television) YIQ
132 transformation. Cannot be used with -Q.
133
134 -N Do not clip the image at the map boundary (only relevant for
135 non-rectangular maps).
136
137 -O (more ...)
138 Append to existing PostScript plot.
139
140 -P (more ...)
141 Select "Portrait" plot orientation.
142
143 -Q Make grid nodes with z = NaN transparent, using the colormasking
144 feature in PostScript Level 3 (the PS device must support PS
145 Level 3).
146
147 -Rxmin/xmax/ymin/ymax[+r][+uunit] (more ...)
148 Specify the region of interest.
149
150 For perspective view p, optionally append /zmin/zmax. (more ...) You
151 may ask for a larger w/e/s/n region to have more room between the image
152 and the axes. A smaller region than specified in the grid file will
153 result in a subset of the grid [Default is the region given by the grid
154 file].
155
156 -U[[just]/dx/dy/][c|label] (more ...)
157 Draw GMT time stamp logo on plot.
158
159 -V[level] (more ...)
160 Select verbosity level [c].
161
162 -X[a|c|f|r][x-shift[u]]
163
164 -Y[a|c|f|r][y-shift[u]] (more ...)
165 Shift plot origin.
166
167 -f[i|o]colinfo (more ...)
168 Specify data types of input and/or output columns.
169
170 -n[b|c|l|n][+a][+bBC][+c][+tthreshold] (more ...)
171 Select interpolation mode for grids.
172
173 -p[x|y|z]azim[/elev[/zlevel]][+wlon0/lat0[/z0]][+vx0/y0] (more ...)
174 Select perspective view.
175
176 -t[transp] (more ...)
177 Set PDF transparency level in percent.
178
179 -^ or just -
180 Print a short message about the syntax of the command, then
181 exits (NOTE: on Windows just use -).
182
183 -+ or just +
184 Print an extensive usage (help) message, including the explana‐
185 tion of any module-specific option (but not the GMT common
186 options), then exits.
187
188 -? or no arguments
189 Print a complete usage (help) message, including the explanation
190 of all options, then exits.
191
193 By default GMT writes out grid as single precision floats in a
194 COARDS-complaint netCDF file format. However, GMT is able to produce
195 grid files in many other commonly used grid file formats and also
196 facilitates so called "packing" of grids, writing out floating point
197 data as 1- or 2-byte integers. (more ...)
198
200 Be aware that if your input grid contains patches of NaNs, these
201 patches can become larger as a consequence of the resampling that must
202 take place with most map projections. Because grdimage uses the Post‐
203 Script colorimage operator, for most non-linear projections we must
204 resample your grid onto an equidistant rectangular lattice. If you find
205 that the NaN areas are not treated adequately, consider (a) use a lin‐
206 ear projection, or (b) use grdview -Ts instead.
207
209 Except for Cartesian cases, we need to resample your geographic grid
210 onto an equidistant projected grid. In doing so various algorithms come
211 into play that projects data from one lattice to another while avoiding
212 anti-aliasing, leading to possible distortions. One expected effect of
213 resampling with splines is the tendency for the new resampled grid to
214 slightly exceed the global min/max limits of the original grid. If
215 this is coupled with tight CPT limits you may find that some map areas
216 may show up with fore- or background color due to the resampling. In
217 that case you have two options: (1) Modify your CPT to fit the resam‐
218 pled extrema (reported with -V) or (2) Impose clipping of resampled
219 values so they do not exceed the input min/max values (add +c to your
220 -n option).
221
223 For a quick-and-dirty illuminated color map of the data in the file
224 stuff.nc, with the maximum map dimension limited to be 6 inches, try
225
226 gmt grdimage stuff.nc -JX6i+ -I+ > quick.ps
227
228 To gray-shade the file hawaii_grav.nc with shades given in shades.cpt
229 on a Lambert map at 1.5 cm/degree along the standard parallels 18 and
230 24, and using 1 degree tickmarks:
231
232 gmt grdimage hawaii_grav.nc -Jl18/24/1.5c -Cshades.cpt -B1 > hawaii_grav_image.ps
233
234 To create an illuminated color PostScript plot of the gridded data set
235 image.nc, using the intensities provided by the file intens.nc, and
236 color levels in the file colors.cpt, with linear scaling at 10
237 inch/x-unit, tickmarks every 5 units:
238
239 gmt grdimage image.nc -Jx10i -Ccolors.cpt -Iintens.nc -B5 > image.ps
240
241 To create an false color PostScript plot from the three grid files
242 red.nc, green.nc, and blue.nc, with linear scaling at 10 inch/x-unit,
243 tickmarks every 5 units:
244
245 gmt grdimage red.nc green.nc blue.nc -Jx10i -B5 > rgbimage.ps
246
247 When GDAL support is built in: To create a sinusoidal projection of a
248 remotely located Jessica Rabbit
249
250 gmt grdimage -JI15c -Rd -Dr \
251 http://larryfire.files.wordpress.com/2009/07/untooned_jessicarabbit.jpg \
252 -P > jess.ps
253
255 gmt, gmt.conf, grd2rgb, grdcontour, grdview, grdgradient, grdhisteq
256
258 2019, P. Wessel, W. H. F. Smith, R. Scharroo, J. Luis, and F. Wobbe
259
260
261
262
2635.4.5 Feb 24, 2019 GRDIMAGE(1)