.TH GRDVIEW l DATE
#ifdef SI
#define UNIT cm
#define LEN_1	1.5
#define LEN_2	20
#define LEN_3	0.05
#define LEN_4	2.5
#define SCALE \fB\-Jm\fP2.5
#else
#define UNIT inch
#define LEN_1	0.5
#define LEN_2	50
#define LEN_3	0.02
#define LEN_4	1
#define SCALE \fB\-Jm\fP1
#endif
.SH NAME
grdview \- Create 3-D perspective grayshaded/colored image or mesh from a 2-D grd file
.SH SYNOPSIS
\fBgrdview\fP \fIrelief_file\fP \fB\-J\fP\fIparameters\fP 
[ \fB\-B\fP\fItickinfo\fP ] [\fB\-C\fP\fIcptfile\fP] [ \fB\-D\fP\fIndec\fP ] [ \fB\-E\fP\fIview_az/view_el\fP ] 
[ \fB\-F\fP\fIred/green/blue\fP ] [ \fB\-G\fP\fIdrapefile\fP] [ \fB\-I\fP\fIintensfile\fP] [ \fB\-K\fP ] 
[ \fB\-M\fP\fImeshpen\fP] [ \fB\-N\fP\fIlevel\fP[/\fIr/g/b\fP]] [ \fB\-O\fP ] [ \fB\-P\fP ] 
[ \fB\-Q\fP\fItype\fP ] [ \fB\-R\fP\fIwest/east/south/north/zmin/zmax\fP[\fIr\fP] ] [ \fB\-S\fP\fIsmooth\fP ] 
[ \fB\-U\fP[\fI/dx/dy/\fP][\fIlabel\fP] ] [ \fB\-V\fP ] [ \fB\-W\fP\fIcontourpen\fP ] [ \fB\-X\fP\fIx-shift\fP ] 
[ \fB\-Y\fP\fIy-shift\fP ] [ \fB\-Z\fP\fIzlevel\fP ] [ \fB\-c\fP\fIcopies\fP ]
.SH DESCRIPTION
\fBgrdview\fP reads a 2-D gridded file and produces a 3-D perspective plot by 
drawing a mesh, painting a colored/grayshaded surface made up of polygons, or by scanline conversion of these polygons
to a rasterimage.  Options include draping a data set on top of a surface, plotting of contours on top of the
surface, and apply artificial illumination based on intensities provided in a separate grd file.
.TP
\fIrelief_file\fP
2-D gridded data set to be imaged (the relief of the surface).
#include "explain_-j.txt"
#include "explain_-Jz.txt"
.SH OPTIONS
No space between the option flag and the associated arguments.
#include "explain_-b.txt"
.TP
.B \-C
name of the color palette file.  Must be present if you want (1) mesh plot with
contours (\fB\-Qm\fP), or (2) shaded/colored perspective image (\fB\-Qs\fP or \fB\-Qi\fP).
.TP
.B \-D
Sets number of decimals used to specify color/gray in PostScript output. Makes smaller output file
at the expense of less color resolution.  E.g., 3 gives 1000, 2 gives 100, and 1 gives 10 choices each
or r, g, and b, values [3].
.TP
.B \-E
Sets the view point by specifying azimuth and elevation in degrees. [Default is 180/90]
.TP
.B \-F
Sets the color used for Frame and annotation. [Default is black]
.TP
.B \-G
Drape the image in \fIdrapefile\fP on top of the relief provided by \fIrelief_file\fP. [Default is \fIrelief_file\fP].
Note that \fB\-Jz\fP and \fB\-N\fP always refers to the \fIrelief_file\fP.  The \fIdrapefile\fP only provides
the information pertaining to colors.
.TP
.B \-I
Gives the name of a grdfile with intensities in the (-1,+1) range. [Default is no illumination].
#include "explain_-K.txt"
.TP
.B \-M
Sets the pen attributes used for the mesh. [Default: width = 1, color = 0/0/0, texture = solid] 
.TP
.B \-N
Draws a plane at this z-level.  If the optional r/g/b is provided, the frontal facade between
the plane and the data perimeter is colored.
#include "explain_-O.txt"
#include "explain_-P.txt"
#include "explain_-R.txt"
This option may be used to indicate the range used for the 3-D axes [Default is
region given by the \fIrelief_file\fP].  You may ask for a larger
\fIw/e/s/n\fP region to have more room between the image and the axes.  A smaller region
than specified in the \fIrelief_file\fP will result in a subset of the grid.
.TP
.B \-Q
Select one of three settings: 1. Specify \fBm\fP for mesh plot [Default], and optionally append /r/g/b for a different mesh paint [white].
2. Specify \fBs\fP for surface plot, and optionally append \fBm\fP to have mesh lines drawn on top of surface.
3. Specify \fBi\fP for image plot, and optionally append the effective dpi resolution for the rasterization [100].
This option will apply a simple clippath to avoid overwriting the background (since the resulting image is rectangular).
Depending on the projection this may backfire; if so turn clipping off by using upper case \fBI\fP.
For any of these choices, you may force a monochrome image by appending \fBg\fP.  Colors are then
converted to shades of gray using the (television) YIQ transformation.
.TP
.B \-S
Smooth the contours before plotting (see \fBgrdcontour\fP) [Default is no smoothing]
#include "explain_-U.txt"
#include "explain_-V.txt"
.TP
.B \-W
Draw contour lines on top of surface or mesh (not image).  Append pen attributes used for the contours.
[Default: width = 3, color = 0/0/0, texture = solid].
#include "explain_-XY.txt"
.TP
.B \-Z
Sets the z-level of the basemap [0].
#include "explain_-c.txt"
.SH EXAMPLES
To make a mesh plot from the file hawaii_grav.grd and drawing the contours
given in the color palette file hawaii.cpt on a Lambert map
at LEN_1 UNIT/degree along the standard parallels 18 and 24, with vertical scale LEN_2 mgal/UNIT, and
looking at the surface from SW at 30 degree elevation, try 
.br
.sp
grdview hawaii_grav.grd \fB\-Jl\fP18/24/LEN_1 \fB\-C\fPhawaii.cpt \fB\-Jz\fPLEN_3 \fB\-Q\fPm \fB\-N\fP-100 \fB\-E\fP225/30 \fB\-W\fP > hawaii_grav_image.ps
.br
.sp
To create a illuminated color perspective plot of the gridded data set image.grd, using the color
palette file color.rgb, with linear scaling at 10 UNIT/x-unit
and tickmarks every 5 units, with intensities provided by the file intens.grd, and looking from the SE, try
.br
.sp
grdview image.grd \fB\-Jx\fP10.0 \fB\-C\fPcolor.rgb \fB\-Q\fPs \fB\-E\fP135/30 \fB\-I\fPintens.grd  > image3D.ps
.br
.sp
To make the same plot using the rastering option with dpi = 50, try
.br
.sp
grdview image.grd \fB\-Jx\fP10.0 \fB\-C\fPcolor.rgb \fB\-Q\fPi50 \fB\-E\fP135/30 \fB\-I\fPintens.grd  > image3D.ps
.br
.sp
To create a color \fIPostScript\fP perspective plot of the gridded data set magnetics.grd, using the color
palette file mag_intens.cpt, draped over the relief given by the file topography.grd, with Mercator scaling at LEN_4 UNIT/degree
and tickmarks every 1 degree, with intensities provided by the file topo_intens.grd, and looking from the SE, try
.br
.sp
grdview topography.grd SCALE \fB\-G\fPmagnetics.grd \fB\-C\fPmag_intens.cpt \fB\-Q\fPs \fB\-E\fP140/30 \fB\-I\fPtopo_intens.grd  > draped3D.ps
.SH BUGS
For the \fB\-Q\fPs option:  \fIPostScript\fP provides no way of smoothly varying colors within a polygon, so colors can only
vary from polygon to polygon.  To obtain smooth images this way you may resample the grdfile(s) using \fBgrdsample\fP or
use a finer grid size when running gridding programs like \fBsurface\fP or \fBnearneighbor\fP.  Unfortunately,
this produces huge \fIPostScript\fP files.  The alternative is to use the \fB\-Q\fPi option, which
computes quasi-bilinear continuous color variations within polygons by using scanline conversion to image the polygons.  However,
when using \fB\-Q\fPi, the \fB\-B\fP option is deactivated; plot axes separately as a psbasemap overlay.
.br
.sp
Header must be plotted separately using \fBpstext\fP.
.SH SEE ALSO
gmt, grdcontour, grdimage, nearneighbor, psbasemap, pscontour, pstext, surface
#include "refs.i"
