grdvector — GMT 5.1.1 documentation

### Navigation

- index
- next
- previous
- Project Home »
- GMT 5.1.1 documentation »
- GR »
- Search:

# grdvector

grdvector - Plot vector field from two component grids

## Synopsis

grdvector compx.nc compy.nc -Jparameters [ -A ] [ -B[p|s]parameters ] [ -Gfill ] [ -Ixinc[unit][=|+][/yinc[unit][=|+]] ] [ -K ] [ -N ] [ -O ] [ -P ] [ -Qparameters ] [ -R[unit]xmin/xmax/ymin/ymax[r] ] [ -S[i|l]scale ] [ -T ] [ -U[just/dx/dy/][c|label] ] [ -Wpen ] [ -X[a|c|f|r][x-shift[u]] ] [ -Y[a|c|f|r][y-shift[u]] ] [ -Z ] [ -ccopies ] [ -f[i|o]colinfo ] [ -p[x|y|z]azim/elev[/zlevel][+wlon0/lat0[/z0]][+vx0/y0] ] [ -t[transp] ]

Note: No space is allowed between the option flag and the associated arguments.

## Description

grdvector reads two 2-D grid files which represents the x- and y-components of a vector field and produces a vector field plot by drawing vectors with orientation and length according to the information in the files. Alternatively, polar coordinate components may be used (r, theta). grdvector is basically a short-hand for using 2 calls to grd2xyz and pasting the output through psxy -SV.

## Required Arguments

compx.nc
  Contains the x-component of the vector field.
compy.nc
  Contains the y-component of the vector field. (See GRID FILE FORMATS below.)

-Jparameters (more ...)
  Select map projection.

## Optional Arguments

-A
  Means grid files have polar (r, theta) components instead of Cartesian (x, y).

-B[p|s]parameters (more ...)
  Set map boundary intervals.
-C[cptfile]
  Use cptfile to assign colors based on vector length. Alternatively, supply the name of a GMT color master CPT [rainbow] and let grdvector automatically determine a 16-level continuous CPT from the grid’s z-range.
-Gfill
  Sets color or shade for vector interiors [Default is no fill].
-I
  Only plot vectors at nodes every x_inc, y_inc apart (must be multiples of original grid spacing). Append m for arc minutes or s for arc seconds. [Default plots every node].

-K (more ...)
  Do not finalize the PostScript plot.
-N
  Do NOT clip vectors at map boundaries [Default will clip].

-O (more ...)
  Append to existing PostScript plot.

-P (more ...)
  Select “Portrait” plot orientation.
-Qparameters
  Modify vector parameters. For vector heads, append vector head size [Default is 0, i.e., stick-plot]. See VECTOR ATTRIBUTES for specifying additional attributes.

-R[unit]xmin/xmax/ymin/ymax[r] (more ...)
  Specify the region of interest. Specify a subset of the grid.
-S[i|l]scale
  Sets scale for Cartesian vector length in data units per distance measurement unit [1]. Append c, i, or p to indicate the measurement unit (cm, inch,or point). Prepend l to indicate a fixed length for all vectors. For Geographic data, give scale in data units per km. Use -Si if it is simpler to give the reciprocal scale in measurement unit per data unit or km per data unit.
-T
  Means azimuth of Cartesian data sets should be adjusted for different scales in the x- and y-directions [Leave alone].

-U[just/dx/dy/][c|label] (more ...)
  Draw GMT time stamp logo on plot.

-V[level] (more ...)
  Select verbosity level [c].
-Wpen
  Set pen attributes used for vector outlines [Default: width = default, color = black, style = solid].

-X[a|c|f|r][x-shift[u]]

-Y[a|c|f|r][y-shift[u]] (more ...)
  Shift plot origin.
-Z
  Means the angles provided are azimuths rather than direction (requires -A).

-ccopies (more ...)
  Specify number of plot copies [Default is 1].

-f[i|o]colinfo (more ...)
  Specify data types of input and/or output columns.

-p[x|y|z]azim/elev[/zlevel][+wlon0/lat0[/z0]][+vx0/y0] (more ...)
  Select perspective view.

-t[transp] (more ...)
  Set PDF transparency level in percent.

-^
  Print a short message about the syntax of the command, then exits (NOTE: on Windows use just -).
+
  Print an extensive usage (help) message, including the explanation of any module-specific option (but not the GMT common options), then exits.
-?
  Print a complete usage (help) message, including the explanation of options, then exits.
--version
  Print GMT version and exit.
--show-datadir
  Print full path to GMT share directory and exit.

## Grid File Formats

By default GMT writes out grid as single precision floats in a COARDS-complaint netCDF file format. However, GMT is able to produce grid files in many other commonly used grid file formats and also facilitates so called “packing” of grids, writing out floating point data as 1- or 2-byte integers. To specify the precision, scale and offset, the user should 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. When reading grids, the format is generally automatically recognized. If not, the same suffix can be added to input grid file names. See grdreformat and Section Grid file format specifications 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. The ?varname suffix can also be used for output grids to specify a variable name different from the default: “z”. See grdreformat and Section Grid file format specifications of the GMT Technical Reference and Cookbook for more information, particularly on how to read splices of 3-, 4-, or 5-dimensional grids.

## Vector Attributes

Several modifiers may be appended to the vector-producing options to specify the placement of vector heads, their shapes, and the justification of the vector:

> +aangle sets the angle of the vector head apex [30].

> +b places a vector head at the beginning of the vector path [none].

> +e places a vector head at the end of the vector path [none].

> +g-|fill turns off vector head fill (if -) or sets the vector head fill [Default fill is used, which may be no fill].

> +l draws half-arrows, using only the left side [both].

> +nnorm scales down vector attributes (pen thickness, head size) with decreasing length, where vectors shorter than norm will have their attributes scaled by length/norm [arrow attributes remains invariant to length].

> +oplon/plat specifies the oblique pole for the great or small circles. Only needed for great circles if +q is given.

> +p[-][pen] sets the vector pen attributes. If pen has a leading - then the head outline is not drawn. [Default pen is used, and head outline is drawn]

> +q means the input angle, length is instead the start and stop opening angles of the arc segment relative to the point.

> +r draws half-arrows, using only the right side [both].

In addition, all but circular vectors may take these modifiers:

> +jjust determines how the input x,y point relates to the vector. Choose from beginning [default], end, or center.

> +s means the input angle, length is instead the x, y coordinates of the vector end point.

## Examples

To draw the vector field given by the files r.nc and theta.nc on a linear plot with scale 5 cm per data unit, using vector rather than stick plot, scale vector magnitudes so that 10 units equal 1 inch, and center vectors on the node locations, run

>     gmt grdvector r.nc theta.nc -Jx5c -A -Q0.1i+e+jc -S10i > gradient.ps

To plot a geographic data sets given the files com_x.nc and comp_y.nc, using a scale of 200 km per data unit, try

>     gmt grdvector comp_x.nc comp_y.nc -JH0/20c -Q0.1i+e+jc -S200 > globe.ps

## See Also

gmt, gmtcolors, grdcontour, psxy

### Navigation

- index
- next
- previous
- Project Home »
- GMT 5.1.1 documentation »
- GR »
- Search: