DragonFly On-Line Manual Pages

Search: Section:  


GRDVIEW(1)                   Generic Mapping Tools                  GRDVIEW(1)

NAME

grdview - Create 3-D perspective grayshaded/colored image or mesh from a 2-D grid file

SYNOPSIS

grdview relief_file -Jparameters [ -B[p|s]parameters ] [ -Ccptfile ] [ -Eazim/elev[+wlon/lat[/z]][+vx0/y0] ] [ -Gdrapefile | -Ggrd_r,grd_g,grd_b ] [ -Iintensfile ] [ -Jz|Zparameters ] [ -K ] [ -L[flags] ] [ -Nlevel[/color] ] [ -O ] [ -P ] [ -Qtype[g] ] [ -Rwest/east/south/north[/zmin/zmax][r] ] [ -Ssmooth ] [ -T[s][o[pen]] ] [ -U[just/dx/dy/][c|label] ] [ -V ] [ -Wtype/pen ] [ -X[a|c|r][x- shift[u]] ] [ -Y[a|c|r][y-shift[u]] ] [ -Zzlevel ] [ -ccopies ]

DESCRIPTION

grdview reads a 2-D grid 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 grid file. relief_file 2-D gridded data set to be imaged (the relief of the surface). (See GRID FILE FORMAT below.) -J Selects the map projection. Scale is UNIT/degree, 1:xxxxx, or width in UNIT (upper case modifier). UNIT is cm, inch, or m, depending on the MEASURE_UNIT setting in .gmtdefaults4, but this can be overridden on the command line by appending c, i, or m to the scale/width value. When central meridian is optional, default is center of longitude range on -R option. Default standard parallel is the equator. For map height, max dimension, or min dimension, append h, *, or - to the width, respectively. More details can be found in the psbasemap man pages. CYLINDRICAL PROJECTIONS: -Jclon0/lat0/scale (Cassini) -Jcyl_stere/[lon0/[lat0/]]scale (Cylindrical Stereographic) -Jj[lon0/]scale (Miller) -Jm[lon0/[lat0/]]scale (Mercator) -Jmlon0/lat0/scale (Mercator - Give meridian and standard parallel) -Jo[a]lon0/lat0/azimuth/scale (Oblique Mercator - point and azimuth) -Jo[b]lon0/lat0/lon1/lat1/scale (Oblique Mercator - two points) -Joclon0/lat0/lonp/latp/scale (Oblique Mercator - point and pole) -Jq[lon0/[lat0/]]scale (Cylindrical Equidistant) -Jtlon0/[lat0/]scale (TM - Transverse Mercator) -Juzone/scale (UTM - Universal Transverse Mercator) -Jy[lon0/[lat0/]]scale (Cylindrical Equal-Area) CONIC PROJECTIONS: -Jblon0/lat0/lat1/lat2/scale (Albers) -Jdlon0/lat0/lat1/lat2/scale (Conic Equidistant) -Jllon0/lat0/lat1/lat2/scale (Lambert Conic Conformal) -Jpoly/[lon0/[lat0/]]scale ((American) Polyconic) AZIMUTHAL PROJECTIONS: -Jalon0/lat0[/horizon]/scale (Lambert Azimuthal Equal-Area) -Jelon0/lat0[/horizon]/scale (Azimuthal Equidistant) -Jflon0/lat0[/horizon]/scale (Gnomonic) -Jglon0/lat0[/horizon]/scale (Orthographic) -Jglon0/lat0/altitude/azimuth/tilt/twist/Width/Height/scale (General Perspective). -Jslon0/lat0[/horizon]/scale (General Stereographic) MISCELLANEOUS PROJECTIONS: -Jh[lon0/]scale (Hammer) -Ji[lon0/]scale (Sinusoidal) -Jkf[lon0/]scale (Eckert IV) -Jk[s][lon0/]scale (Eckert VI) -Jn[lon0/]scale (Robinson) -Jr[lon0/]scale (Winkel Tripel) -Jv[lon0/]scale (Van der Grinten) -Jw[lon0/]scale (Mollweide) NON-GEOGRAPHICAL PROJECTIONS: -Jp[a]scale[/origin][r|z] (Polar coordinates (theta,r)) -Jxx-scale[d|l|ppow|t|T][/y-scale[d|l|ppow|t|T]] (Linear, log, and power scaling) -Jz Sets the vertical scaling (for 3-D maps). Same syntax as -Jx.

OPTIONS

No space between the option flag and the associated arguments. -B Sets map boundary annotation and tickmark intervals; see the psbasemap man page for all the details. -C name of the color palette file. Must be present if you want (1) mesh plot with contours (-Qm), or (2) shaded/colored perspective image (-Qs or -Qi). For -Qs: You can specify that you want to skip a z-slice by setting red = -; to use a pattern give red = P|pdpi/pattern[:Fr/g/b[Br/g/b]]. -E Sets the viewpoint's azimuth and elevation (for perspective view) [180/90]. For frames used for animation, you may want to append * to fix the center of your data domain (or specify a particular world coordinate point with +wlon0/lat[/z]) which will project to the center of your page size (or specify the coordinates of the projected view point with +vx0/y0). -G Drape the image in drapefile on top of the relief provided by relief_file. [Default is relief_file]. Note that -Jz and -N always refers to the relief_file. The drapefile only provides the information pertaining to colors, which is looked-up via the cpt file (see -C). Alternatively, give three grid files separated by commas. These files must contain the red, green, and blue colors directly (in 0-255 range) and no cpt file is needed. The drapefile may be of higher resolution than the relief_file. -I Gives the name of a grid file with intensities in the (-1,+1) range. [Default is no illumination]. -K More PostScript code will be appended later [Default terminates the plot system]. -L Boundary condition flags may be x or y or xy indicating data is periodic in range of x or y or both, or flags may be g indicating geographical conditions (x and y are lon and lat). [Default uses "natural" conditions (second partial derivative normal to edge is zero).] If no flags are set, use bilinear rather than the default bicubic resampling when draping is required. -N Draws a plane at this z-level. If the optional color is provided, the frontal facade between the plane and the data perimeter is colored. See -Wf for setting the pen used for the outline. (See SPECIFYING COLOR below). -O Selects Overlay plot mode [Default initializes a new plot system]. -P Selects Portrait plotting mode [Default is Landscape, see gmtdefaults to change this]. -Q Select one of four settings: 1. Specify m for mesh plot [Default], and optionally append /color for a different mesh paint [white]. 2. Specify s for surface plot, and optionally append m to have mesh lines drawn on top of surface. 3. Specify i for image plot, and optionally append the effective dpi resolution for the rasterization [100]. 4. Specify c. Same as -Qi but will make nodes with z = NaN transparent, using the colormasking feature in PostScript Level 3 (the PS device must support PS Level 3). For any of these choices, you may force a monochrome image by appending g. Colors are then converted to shades of gray using the (television) YIQ transformation. -R xmin, xmax, ymin, and ymax specify the Region of interest. For geographic regions, these limits correspond to west, east, south, and north and you may specify them in decimal degrees or in [+-]dd:mm[:ss.xxx][W|E|S|N] format. Append r if lower left and upper right map coordinates are given instead of w/e/s/n. The two shorthands -Rg and -Rd stand for global domain (0/360 and -180/+180 in longitude respectively, with -90/+90 in latitude). Alternatively, specify the name of an existing grid file and the -R settings (and grid spacing, if applicable) are copied from the grid. For calendar time coordinates you may either give (a) relative time (relative to the selected TIME_EPOCH and in the selected TIME_UNIT; append t to -JX|x), or (b) absolute time of the form [date]T[clock] (append T to -JX|x). At least one of date and clock must be present; the T is always required. The date string must be of the form [-]yyyy[-mm[-dd]] (Gregorian calendar) or yyyy[-Www[-d]] (ISO week calendar), while the clock string must be of the form hh:mm:ss[.xxx]. The use of delimiters and their type and positions must be exactly as indicated (however, input, output and plot formats are customizable; see gmtdefaults). This option may be used to indicate the range used for the 3-D axes [Default is region given by the relief_file]. You may ask for a larger w/e/s/n region to have more room between the image and the axes. A smaller region than specified in the relief_file will result in a subset of the grid. -S Smooth the contours before plotting (see grdcontour) [Default is no smoothing]. -T Plot image without any interpolation. This involves converting each node-centered bin into a polygon which is then painted separately. Append s to skip nodes with z = NaN. This option is useful for categorical data where interpolating between values is meaningless. Optionally, append o to draw the tile outlines, and specify a custom pen if the default pen is not to your liking. As this option produces a flat surface it cannot be combined with -JZ or -Jz. (See SPECIFYING PENS below). -U Draw Unix System time stamp on plot. By adding just/dx/dy/, the user may specify the justification of the stamp and where the stamp should fall on the page relative to lower left corner of the plot. For example, BL/0/0 will align the lower left corner of the time stamp with the lower left corner of the plot. Optionally, append a label, or c (which will plot the command string.). The GMT parameters UNIX_TIME, UNIX_TIME_POS, and UNIX_TIME_FORMAT can affect the appearance; see the gmtdefaults man page for details. The time string will be in the locale set by the environment variable TZ (generally local time). -V Selects verbose mode, which will send progress reports to stderr [Default runs "silently"]. -Wc Draw contour lines on top of surface or mesh (not image). Append pen attributes used for the contours. [Default: width = 0.75p, color = black, texture = solid]. (See SPECIFYING PENS below). -Wm Sets the pen attributes used for the mesh. [Default: width = 0.25p, color = black, texture = solid]. You must also select -Qm or -Qsm for meshlines to be drawn. -Wf Sets the pen attributes used for the facade. [Default: width = 0.25p, color = black, texture = solid]. You must also select -N for the facade outline to be drawn. (See SPECIFYING PENS below). -X -Y Shift plot origin relative to the current origin by (x-shift,y- shift) and optionally append the length unit (c, i, m, p). You can prepend a to shift the origin back to the original position after plotting, or prepend r [Default] to reset the current origin to the new location. If -O is used then the default (x- shift,y-shift) is (0,0), otherwise it is (r1i, r1i) or (r2.5c, r2.5c). Alternatively, give c to align the center coordinate (x or y) of the plot with the center of the page based on current page size. -Z Sets the z-level of the basemap [Default is the bottom of the z- axis]. -c Specifies the number of plot copies. [Default is 1]. SPECIFYING PENS pen The attributes of lines and symbol outlines as defined by pen is a comma delimetered list of width, color and texture, each of which is optional. width can be indicated as a measure (points, centimeters, inches) or as faint, thin[ner|nest], thick[er|est], fat[ter|test], or obese. color specifies a gray shade or color (see SPECIFYING COLOR below). texture is a combination of dashes `-' and dots `.'. SPECIFYING COLOR color The color of lines, areas and patterns can be specified by a valid color name; by a gray shade (in the range 0-255); by a decimal color code (r/g/b, each in range 0-255; h-s-v, ranges 0-360, 0-1, 0-1; or c/m/y/k, each in range 0-1); or by a hexadecimal color code (#rrggbb, as used in HTML). See the gmtcolors manpage for more information and a full list of color names.

GRID FILE FORMATS

GMT is able to recognize many of the commonly used grid file formats, as well as the precision, scale and offset of the values contained in the grid file. When GMT needs a little help with that, you can add the suffix =id[/scale/offset[/nan]], where id is a two-letter identifier of the grid type and precision, and scale and offset are optional scale factor and offset to be applied to all grid values, and nan is the value used to indicate missing data. See grdreformat(1) and Section 4.17 of the GMT Technical Reference and Cookbook for more information. When reading a netCDF file that contains multiple grids, GMT will read, by default, the first 2-dimensional grid that can find in that file. To coax GMT into reading another multi-dimensional variable in the grid file, append ?varname to the file name, where varname is the name of the variable. Note that you may need to escape the special meaning of ? in your shell program by putting a backslash in front of it, or by placing the filename and suffix between quotes or double quotes. See grdreformat(1) and Section 4.18 of the GMT Technical Reference and Cookbook for more information, particularly on how to read splices of 3-, 4-, or 5-dimensional grids.

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 1.5 cm/degree along the standard parallels 18 and 24, with vertical scale 20 mgal/cm, and looking at the surface from SW at 30 degree elevation, run grdview hawaii_grav.grd -Jl 18/24/1.5c -C hawaii.cpt -Jz 0.05c -Qm -N-100 -E 225/30 -Wc > hawaii_grav_image.ps 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 cm/x-unit and tickmarks every 5 units, with intensities provided by the file intens.grd, and looking from the SE, use grdview image.grd -Jx 10.0c -C color.rgb -Qs -E 135/30 -I intens.grd > image3D.ps To make the same plot using the rastering option with dpi = 50, use grdview image.grd -Jx 10.0c -C color.rgb -Qi 50 -E 135/30 -I intens.grd > image3D.ps To create a color PostScript 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 map width of 6 inch and tickmarks every 1 degree, with intensities provided by the file topo_intens.grd, and looking from the SE, run grdview topography.grd -JM 6i -G magnetics.grd -C mag_intens.cpt -Qs -E 140/30 -I topo_intens.grd > draped3D.ps Given topo.grd and the Landsat image veggies.ras, first run gmt2rgb to get the red, green, and blue grids, and then drape this image over the topography and shade the result for good measure. The commands are gmt2rgb veggies.ras -G layer_%c.grd grdview topo.grd -JM 6i -Qi -E 140/30 -I topo_intens.grd -G layer_r.grd,layer_g.grd,layer_b.grd > image.ps

REMARKS

For the -Qs option: PostScript 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 grid file(s) using grdsample or use a finer grid size when running gridding programs like surface or nearneighbor. Unfortunately, this produces huge PostScript files. The alternative is to use the -Qi option, which computes bilinear or bicubic continuous color variations within polygons by using scanline conversion to image the polygons.

SEE ALSO

GMT(1), gmt2rgb(1), gmtcolors(5), grdcontour(1), grdimage(1), nearneighbor(1), psbasemap(1), pscontour(1), pstext(1), surface(1) GMT 4.5.14 1 Nov 2015 GRDVIEW(1)

Search: Section: