1GRDVIEW(1)                            GMT                           GRDVIEW(1)
2
3
4

NAME

6       grdview - Create 3-D perspective image or surface mesh from a grid
7

SYNOPSIS

9       grdview  relief_file  -Jparameters [  -B[p|s]parameters ] [  -C[cpt]] [
10       -Gdrapefile |  -Ggrd_r   -Ggrd_g   -Ggrd_b  ]  [   -I[intensfile|inten‐
11       sity|modifiers]  ] [ -Jz|Zparameters ] [ -K ] [  -Nlevel[+gfill] ] [ -O
12       ] [ -P ] [  -Qargs[+m] ] [  -Rwest/east/south/north[/zmin/zmax][+r] ] [
13       -Ssmooth  ]  [   -T[s][o[pen]]  ]  [   -U[stamp]  ]  [   -Wc|m|fpen ] [
14       -Xx_offset ] [  -Yy_offset ] [ -fflags ] [ -nflags  ]  [  -pflags  ]  [
15       -ttransp ]
16
17       Note:  No  space  is allowed between the option flag and the associated
18       arguments.
19

DESCRIPTION

21       grdview reads a 2-D grid file and produces a 3-D  perspective  plot  by
22       drawing  a mesh, painting a colored/grayshaded surface made up of poly‐
23       gons, or by scanline conversion of these polygons to  a  raster  image.
24       Options  include  draping  a  data set on top of a surface, plotting of
25       contours on top of the surface, and apply artificial illumination based
26       on intensities provided in a separate grid file.
27

REQUIRED ARGUMENTS

29       relief_file
30              2-D  gridded  data set to be imaged (the relief of the surface).
31              (See GRID FILE FORMAT below.)
32
33       -Jparameters (more ...)
34              Select map projection.
35
36       -Jz|Zparameters (more ...)
37              Set z-axis scaling; same syntax as -Jx.
38

OPTIONAL ARGUMENTS

40       -B[p|s]parameters (more ...)
41              Set map boundary frame and axes attributes.
42
43       -C[cpt]
44              name of the CPT. Must be present if you want (1) mesh plot  with
45              contours  (-Qm), or (2) shaded/colored perspective image (-Qs or
46              -Qi). For -Qs: You can specify that you want to skip  a  z-slice
47              by  setting  the red r/g/b component to -; to use a pattern give
48              red = P|ppattern[+bcolor][+fcolor][+rdpi].  Alternatively,  sup‐
49              ply  the  name  of  a  GMT color master dynamic CPT [rainbow] to
50              automatically  determine  a  continuous  CPT  from  the   grid's
51              z-range.  If the dynamic CPT has a default range then that range
52              will be imposed instead.
53
54        -Gdrapefile |  -Ggrd_r  -Ggrd_g  -Ggrd_b
55              Drape the image in drapefile on top of the  relief  provided  by
56              relief_file.  [Default  is  relief_file].  Note  that -Jz and -N
57              always refers to the relief_file. The  drapefile  only  provides
58              the information pertaining to colors, which is looked-up via the
59              CPT (see -C). Alternatively, give three grid files via  separate
60              -G  options in the specified order. These files must contain the
61              red, green, and blue colors directly (in 0-255 range) and no CPT
62              is  needed.  The  drapefile may be of higher resolution than the
63              relief_file.
64
65       -I[intensfile|intensity|modifiers]
66              Gives the name of a grid file with intensities  in  the  (-1,+1)
67              range,  or a constant intensity to apply everywhere; this simply
68              affects the ambient light.  If just + is given then we derive an
69              intensity grid from the input data grid grd_z via a call to grd‐
70              gradient using the arguments -A-45 and -Nt1 for that module. You
71              can append +aazimuth and **+n*args to override those values.  If
72              you want more specific intensities then  run  grdgradient  sepa‐
73              rately first.  [Default is no illumination].
74
75       -K (more ...)
76              Do not finalize the PostScript plot.
77
78       -Nlevel[+gfill]
79              Draws a plane at this z-level. If the optional color is provided
80              via the +g modifier, the frontal facade between  the  plane  and
81              the  data perimeter is colored. See -Wf for setting the pen used
82              for the outline.
83
84       -O (more ...)
85              Append to existing PostScript plot.
86
87       -P (more ...)
88              Select "Portrait" plot orientation.
89
90       -Qargs[+m]
91              Select one of following settings. For any of these choices,  you
92              may  force a monochrome image by appending the modifier +m. Col‐
93              ors are then converted to shades of gray using  the  (monochrome
94              television) YIQ transformation
95
96              1. Specify  m  for  mesh  plot  [Default], and optionally append
97                 color for a different mesh paint [white].
98
99              2. Specify mx or my for waterfall  plots  (row  or  column  pro‐
100                 files). Specify color as for plain m
101
102              3. Specify  s  for surface plot, and optionally append m to have
103                 mesh lines drawn on top of surface.
104
105              4. Specify i for image plot, and optionally append the effective
106                 dpi resolution for the rasterization [100].
107
108              5. Specify  c.  Same  as  -Qi  but  will make nodes with z = NaN
109                 transparent, using the  colormasking  feature  in  PostScript
110                 Level 3 (the PS device must support PS Level 3). .
111
112       -Rxmin/xmax/ymin/ymax[+r][+uunit] (more ...)
113              Specify the region of interest.
114
115       For  perspective  view p, optionally append /zmin/zmax. (more ...) This
116       option may be used to indicate the range used for the 3-D axes [Default
117       is  region  given by the relief_file]. You may ask for a larger w/e/s/n
118       region to have more room between the image  and  the  axes.  A  smaller
119       region than specified in the relief_file will result in a subset of the
120       grid.
121
122       -Ssmooth
123              Smooth the contours before plotting (see grdcontour) [Default is
124              no smoothing].
125
126       -T[s][o[pen]]
127              Plot  image  without any interpolation. This involves converting
128              each node-centered bin into a polygon which is then painted sep‐
129              arately.   Append  s  to skip nodes with z = NaN. This option is
130              useful for categorical data where interpolating  between  values
131              is meaningless.  Optionally, append o to draw the tile outlines,
132              and specify a custom pen if the default pen is not to your  lik‐
133              ing.  As  this  option produces a flat surface it cannot be com‐
134              bined with -JZ or -Jz.
135
136       -U[[just]/dx/dy/][c|label] (more ...)
137              Draw GMT time stamp logo on plot.
138
139       -V[level] (more ...)
140              Select verbosity level [c].
141
142       -Wc|m|fpen
143
144          -Wc    Draw contour lines on top of surface  or  mesh  (not  image).
145                 Append  pen attributes used for the contours. [Default: width
146                 = 0.75p, color = black, style = solid].
147
148          -Wm    Sets the pen attributes used for the mesh. [Default: width  =
149                 0.25p,  color  =  black, style = solid]. You must also select
150                 -Qm or -Qsm for meshlines to be drawn.
151
152          -Wf    Sets the pen attributes used for the facade. [Default:  width
153                 =  0.25p, color = black, style = solid]. You must also select
154                 -N for the facade outline to be drawn.
155
156       -X[a|c|f|r][x-shift[u]]
157
158       -Y[a|c|f|r][y-shift[u]] (more ...)
159              Shift plot origin.
160
161       -n[b|c|l|n][+a][+bBC][+c][+tthreshold] (more ...)
162              Select interpolation mode for grids.
163
164       -p[x|y|z]azim[/elev[/zlevel]][+wlon0/lat0[/z0]][+vx0/y0] (more ...)
165              Select perspective view.
166
167       -t[transp] (more ...)
168              Set PDF transparency level in percent.
169
170       -^ or just -
171              Print a short message about the  syntax  of  the  command,  then
172              exits (NOTE: on Windows just use -).
173
174       -+ or just +
175              Print  an extensive usage (help) message, including the explana‐
176              tion of any module-specific  option  (but  not  the  GMT  common
177              options), then exits.
178
179       -? or no arguments
180              Print a complete usage (help) message, including the explanation
181              of all options, then exits.
182

GRID FILE FORMATS

184       By default GMT  writes  out  grid  as  single  precision  floats  in  a
185       COARDS-complaint  netCDF  file  format. However, GMT is able to produce
186       grid files in many other commonly  used  grid  file  formats  and  also
187       facilitates  so  called  "packing" of grids, writing out floating point
188       data as 1- or 2-byte integers. (more ...)
189

CONSEQUENCES OF GRID RESAMPLING

191       Except for Cartesian cases, we need to resample  your  geographic  grid
192       onto an equidistant projected grid. In doing so various algorithms come
193       into play that projects data from one lattice to another while avoiding
194       anti-aliasing, leading to possible distortions.  One expected effect of
195       resampling with splines is the tendency for the new resampled  grid  to
196       slightly  exceed  the  global  min/max limits of the original grid.  If
197       this is coupled with tight CPT limits you may find that some map  areas
198       may  show  up with fore- or background color due to the resampling.  In
199       that case you have two options: (1) Modify your CPT to fit  the  resam‐
200       pled  extrema  (reported  with  -V) or (2) Impose clipping of resampled
201       values so they do not exceed the input min/max values (add +c  to  your
202       -n option).
203

EXAMPLES

205       To  make  a mesh plot from the file hawaii_grav.nc and drawing the con‐
206       tours given in the CPT hawaii.cpt on a Lambert  map  at  1.5  cm/degree
207       along the standard parallels 18 and 24, with vertical scale 20 mgal/cm,
208       and looking at the surface from SW at 30 degree elevation, run
209
210              gmt grdview hawaii_grav.nc -Jl18/24/1.5c -Chawaii.cpt \
211                          -Jz0.05c -Qm -N-100 -p225/30 -Wc > hawaii_grav_image.ps
212
213       To create a illuminated color perspective plot of the gridded data  set
214       image.nc,  using the CPT color.rgb, with linear scaling at 10 cm/x-unit
215       and tickmarks every 5 units, with  intensities  provided  by  the  file
216       intens.nc, and looking from the SE, use
217
218              gmt grdview image.nc -Jx10.0c -Ccolor.rgb -Qs -p135/30 -Iintens.nc > image3D.ps
219
220       To make the same plot using the rastering option with dpi = 50, use
221
222              gmt grdview image.nc -Jx10.0c -Ccolor.rgb -Qi50 -p135/30 -Iintens.nc > image3D.ps
223
224       To  create  a color PostScript perspective plot of the gridded data set
225       magnetics.nc, using the CPT  mag_intens.cpt,  draped  over  the  relief
226       given  by the file topography.nc, with Mercator map width of 6 inch and
227       tickmarks every  1  degree,  with  intensities  provided  by  the  file
228       topo_intens.nc, and looking from the SE, run
229
230              gmt grdview topography.nc -JM6i -Gmagnetics.nc -Cmag_intens.cpt \
231                          -Qs -p140/30 -Itopo_intens.nc > draped3D.ps
232
233       Given  topo.nc  and the Landsat image veggies.ras, first run grd2rgb to
234       get the red, green, and blue grids, and then drape this image over  the
235       topography and shade the result for good measure. The commands are
236
237              gmt grd2rgb veggies.ras -Glayer_%c.nc
238              gmt grdview topo.nc -JM6i -Qi -p140/30 -Itopo_intens.nc \
239                         -Glayer_r.nc -Glayer_g.nc -Glayer_b.nc > image.ps
240

REMARKS

242       For the -Qs option: PostScript provides no way of smoothly varying col‐
243       ors within a polygon, so colors can only vary from polygon to  polygon.
244       To  obtain  smooth  images  this  way you may resample the grid file(s)
245       using grdsample or use a finer grid size when running gridding programs
246       like  surface  or nearneighbor. Unfortunately, this produces huge Post‐
247       Script files. The alternative is to use the -Qi option, which  computes
248       bilinear  or  bicubic  continuous  color  variations within polygons by
249       using scanline conversion to image the polygons.
250

SEE ALSO

252       gmt, grd2rgb, gmtcolors, grdcontour, grdimage, grdsample, nearneighbor,
253       psbasemap, pscontour, pstext, surface
254
256       2019, P. Wessel, W. H. F. Smith, R. Scharroo, J. Luis, and F. Wobbe
257
258
259
260
2615.4.5                            Feb 24, 2019                       GRDVIEW(1)
Impressum