Vectors, A Vector Field Plotting Utility
David I. Brown
NCAR, P.O. Box 3000
Boulder, Colorado 80307-3000
Table of Contents
1.0 PREFACE
2.0 INTRODUCTION
3.0 SUBROUTINES
3.1 VVECTR (U,V,P,IAM,VVUDMV,WRK)
3.2 VVGETC (CNM,CVL)
3.3 VVGETI (CNM,IVL)
3.4 VVGETR (CNM,RVL)
3.5 VVINIT (U,LU,V,LV,P,LP,M,N,WRK,LW)
3.6 VVRSET
3.7 VVSETC (CNM,CVL)
3.8 VVSETI (CNM,IVL)
3.9 VVSETR (CNM,RVL)
3.10 VVUDMV (XCS,YCS,NCS,IAI,IAG,NAI)
3.11 VVUMXY (X,Y,U,V,UVM,XB,YB,XE,YE,IST)
4.0 OBSOLETE SUBROUTINES
4.1 EZVEC (U,V,M,N)
4.2 FX (X,Y)
4.3 FY (X,Y)
4.4 MXF (X,Y,U,V,SFX,SFY,MX,MY)
4.5 MYF (X,Y,U,V,SFX,SFY,MX,MY)
4.6 VELVCT (U,LU,V,LV,M,N,FLO,HI,NSET,LENGTH,ISPV,SPV)
4.7 VELVEC (U,LU,V,LV,M,N,FLO,HI,NSET,ISPV,SPV)
5.0 PARAMETERS
6.0 ERROR MESSAGES
7.0 EXAMPLES
INDEX
1.0 PREFACE
The vector field plotting utility described here was originally
written in the early 1970's and has previously been known as
VELVCT. Over the years, a number of enhancements have been made, but
the basic capabilities and interface have not changed much. In the
fall of 1992 a more extensive revision was undertaken. Both the
interface and functionality of the package underwent a major
upgrade. There were several goals: first, make the package work more
like other utilities in the NCAR Graphics toolkit suite; second, make
it easier to use in combination with the other utilities; third, allow
easier access to standard coordinate system mappings, including
especially the EZMAP transformations; and fourth, improve the
information content of the final plot. Most of these goals have been
at least partially realized in the current version of the package,
although, as usual, not all the envisioned improvements could be
accomplished in the time allotted to the task. Since it might be
confusing to retain the name of a now obsolete entry point as the
utility name, and moreover, as it now seems unwise to share the
package name with any entry point name, the new name for the NCAR
Graphics vector plotting utility is simply Vectors.
2.0 INTRODUCTION
This document describes the NCAR Graphics utility, known as
Vectors, designed to allow a user to plot vector
fields given two arrays containing the components of the vectors on a
uniform grid in a user-defined coordinate system. In addition, the
user may pass in another array of scalar data defined over the same
grid space independent of but presumably related in some fashion to
the vector data. The utility will then color each vector based on the
scalar value at the same grid point. Alternatively, the user can
choose to color the vectors based on the vector magnitude at the grid
point.
The old utility name, VELVCT, originated as a contraction of 'Velocity
Vector'. Beginning with NCAR Graphics Version 3.2, all new routines,
whether user-entry points or not, are six characters long and begin
with the key letters, 'VV', again standing for 'Velocity Vector'
though of course any 2-dimensional vector field may serve as input to
the package. The old entry points are still supported through a
compatibility version of the VELVCT subroutine, and some, though not
all, of the features provided by the new routines are available to
these entry points by appropriately setting the compatibility mode
internal parameter.
This section is intended to give an overall view of Vectors and
selected aspects of its design; it covers some details, but, in
general, one should refer to the sections SUBROUTINES and PARAMETERS for detailed descriptions of
subroutines and parameters mentioned. (Parameters are mentioned by
name; all the names are of the form XXX, where XXX is a
three-character mnemonic.) The section ERROR
MESSAGES describes error messages written by Vectors. The section
EXAMPLES describes the examples available
for Vectors.
It is assumed that the reader is familiar with NCAR Graphics in
general and has some knowledge of (or can find and read the
documentation for) the utilities AREAS and EZMAP.
2.1 Vectors User-Entry Point Routines
The code to draw a vector field plot (unless using the obsolete
entries points discussed at the end of this section) must include a
call to the routine VVINIT followed at some point by a call to
VVECTR. Before and after the VVINIT call several internal parameter
setting routines may be used to alter the behavior of the vector
plotting code. Some of these parameters must be set before the call to
VVINIT in order to have any (or the correct) effect. In other cases,
however, the user can query the information VVINIT has acquired about
the target data sets using a parameter getting routine, and then
dynamically adjust the parameter to best fit the requirements of the
data, before calling VVECTR.
All the internal parameters have default values; only those which are
to have values different from the default need to be set. The user may
call routines to set the values of parameters as follows:
- VVRSET resets all internal parameters to their default values.
- VVSETC assigns a value of type CHARACTER to a parameter.
- VVSETI assigns a value of type INTEGER to a parameter.
- VVSETR assigns a value of type REAL to a parameter.
In general, once a parameter is given a value by a call to one of
these routines, it retains that value until a similar call resets
it. Thus, many of the parameter-setting calls do not need to be
repeated for each new vector field plot.
The user may retrieve the value of an internal parameter at any time
by calling one of the parameter getting routines:
- VVGETC returns a parameter value of type CHARACTER.
- VVGETI returns a parameter value of type INTEGER.
- VVGETR returns a parameter value of type REAL.
Once you have set required parameters and called VVINIT, drawing the
vector field plot is simply a matter of calling the main entry point
VVECTR.
VVINIT performs the initialization required for VVECTR to interpret
the data properly. The dimensions of the data arrays are copied to
internal variables. Depending on the current value of certain internal
parameters, the grid space indices are mapped into the X,Y
data coordinate system. The mapping from the user
coordinate space to the normalized device coordinate
(NDC, sometimes also known as fractional coordinate)
space is also established using either the routine GETSET, if a
previously established mapping is to be used, or the routine SET, if
Vectors needs to set up the mapping. Note, however, that the
mapping from the data to user coordinate system is left
indeterminate at this point. This is because you may choose from
several pre-defined mappings, such as an EZMAP projection, or
implement a user-defined mapping to implement this
transformation. VVINIT and, for that matter, VVECTR have (almost) no
knowledge of the mapping being performed.
VVINIT then processes the vector component arrays to find the maximum
and minimum vector magnitudes. If a scalar array is to be processed,
it extracts the maximum and minimum scalar data values. If the user is
coloring the vectors and has not predefined a set of threshold values,
the routine sets up an array of values linearly spaced between the
maximum and minimum (scalar data or vector magnitude) values. The user
is responsible for setting up the color table and defining the number
and progression of the colors to be used. If a zero field condition is
discovered, a flag is set, causing VVECTR not to attempt to draw any
vectors.
After the VVINIT call the user can retrieve the maximum and minimum
vector magnitudes and/or scalar data values and based on their value,
alter the appearance of the plot by enlarging the maximum size vector,
constraining the smallest vector to be rendered at some fraction of
the largest vector, or by choosing to eliminate vectors less than some
magnitude. The color threshold values could also be examined and
possibly modified.
You are now free to call VVECTR, causing the vectors to be rendered
according to the established set up. If a border around the plot is
desired, call PERIM(1,0,1,0). Finally, to advance the frame, call the
SPPS routine FRAME.
Vectors contains two user-modifiable routines that are not
invoked directly by the user, but by Vectors itself. The
default versions of these routines contain very simple code that may
handle a basic case, but little more. These routines are as
follows:
- VVUMXY is called when the internal parameter MAP is set to a value
other than zero, one, or two. These three values are pre-defined
mappings, and are handled within the private code of
Vectors. Briefly, the three mappings are 0, Identity
mapping, 1, EZMAP projection, and 2, polar to rectangular. If MAP is
set to any other value, VVUMXY (Velocity Vector - User Map XY) is
invoked, allowing the user to define a custom mapping from
data coordinates to NDC space. Note that, unlike
similar routines in CONPACK, this mapping routine is required to
return the location of both ends of the vector in normalized device
coordinates. If the mapping is non-linear, like the EZMAP projections,
then a technique that effectively maps the instantaneous tangent angle
must be used to map the vector direction.
- VVUDMV is the default name of an externally defined function
passed as a parameter to VVECTR. It is only required when the you want
to draw the vectors masked by an area map generated by the routines in
the AREAS utility. VVUDMV is responsible for deciding which pieces of
a vector to draw according to its area identifier. The default version
of the routine draws all vector segments that have positive valued
area identifiers.
Three Vectors routines are supplied to provide
compatibility with pre-Version 3.2 codes. You may choose from a
variety of compatibility options by setting the compatibility mode
parameter CPM appropriately; this offers considerable flexibility in
making the transition to the new version of the utility.
- VELVCT, the pre-Version 3.2 principal entry point, has been
rewritten to act as a front end to the VVINIT/VVECTR
interface. Depending on the setting of the CPM parameter the input
parameter options and/or the common block variables initialized in the
block data subprogram, VELDAT, may be used to set the corresponding
internal parameters. The CPM parameter also controls whether the old
FX,FY and MXF,MYF vector mapping routines are used instead of the
current mapping routine, VVMPXY. When CPM is set to its default value,
the results of a Vectors call are quite close to what they
would have been pre-Version 3.2,
- EZVEC is a front end to VELVCT and is unchanged from its
pre-Version 3.2 state. It is a simple interface for standard
situations, when detailed control of the plot is not required.
- VELVEC is an older version of VELVCT, now also a front end to it,
and also unchanged for Version 3.2. It differs from the VELVCT call
only in that it contains one less input parameter in its calling
sequence.
2.2 Using Vectors
If the intent is to draw the vector field plot using relatively few
computer resources, the following sequence of calls will suffice:
- Call parameter-setting routines.
- Call VVINIT to initialize the vector field plot.
- Call VVECTR to draw the vectors.
- If a border around the plot is desired, call PERIM(1,0,1,0)
- Call FRAME to advance the plotter frame.
Assuming that step 1 is null and that all default parameter values are
used, the resulting plot will look similar to what would have been
drawn by VELVCT prior to Version 3.2 of NCAR Graphics.
2.3 Coordinate Systems in Vectors
In order to understand the process of transforming the data contained
in the vector component input arrays into arrows of particular length
and direction at various positions on an output plot, it would be
helpful to differentiate unambiguously each stage of the
transformation pipeline within the context of the coordinate systems
defined by NCAR Graphics. In this discussion, the following terms are
used:
- The indices of the input vector component arrays define the
grid coordinate system. It is bounded by the ranges from 1 to
the value of M (argument to VVINIT) along the first dimension,
conventionally the X axis; and from 1 to the value of N (argument to
VVINIT) along the second dimension, conventionally the Y axis.
- The internal parameters XC1, XCM, YC1, and YCN provide a linear
mapping from grid coordinates to the data coordinate
system. Data coordinates provide the natural context for the
data. For instance, a set of wind vector data might use longitudinal
coordinates values for XC1 and XCM; latitudinal values for YC1 and
YCN.
- The internal parameter MAP specifies a mapping, possibly
non-linear, from data to user coordinates. A call to the
SPPS routine, SET, establishes the boundaries of this coordinate
space. If the last argument to SET does not specify a log-scaled axis,
and neither axis is mirror-imaged, user coordinates are
equivalent to GKS world coordinates. When user and
world coordinates are not equivalent, Vectors
accounts for the difference in its mapping routines, although it never
uses world coordinates explicitly. The term "window" is
used rather loosely to refer to the boundaries of either of these
coordinate systems. The intended system is hopefully clear from the
context.
- From the point of view of Vectors, the final transformation
is the mapping from user coordinates to the NDC system,
also known as the fractional coordinate system. The boundaries
of NDC space are also established by the SET call, and must
fall within the range 0.0 to 1.0. They define a "viewport" into the
drawable area of the plotting surface. This transformation may be
affected by the setting of the internal parameter TRT.
- Vectors uses one other system for the specification of
items, such as graphics text strings or minimum arrow size, that
should retain a constant size and position relative to the plot as a
whole. This system has no real name, but is referred to in this
document as "fraction of the viewport width", or occasionally, where
appropriate, "viewport height".
Note that two other coordinate systems used in the VELVCT code prior
to Version 3.2, the integer plotter and metacode
coordinate system, have been retained only in the compatibility
routines; they are not required for any of the low-level rendering
routines used currently.
Given the default values of the parameters XC1, XCM, YC1 and YCN, the
mapping from grid to data coordinate space is an
identity transformation. That is, the data coordinate space
extends from (1.0,1.0) to (REAL(M), REAL(N)). However, you may assign
any desired boundaries to the data coordinate system by setting
XC1, XCM, YC1 and YCN to values of your choice. For satisfactory
results this choice needs to be consistent with the user
coordinate boundaries established by the SET call and the mapping
established by the MAP parameter. In general, the location of an array
element A(I,J) in data coordinate space is given as:
Xdata = XC1 + (I - 1)*(XCM - XC1)/(M - 1)
Ydata = YC1 + (J - 1)*(YCN - YC1)/(N - 1)
where (XC1,YC1) is the lower boundary of the data coordinate
space and (XCM,YCN) is the upper boundary.
If the parameter MAP has values between 0 and 2 Vectors handles
the mapping from data space to user and NDC space
internally, using the routine VVMPXY. If MAP has any other value the
user-modifiable routine VVUMXY is called to perform a mapping defined
by the user. Unlike the analogous CONPACK routine, CPMPXY, which has
data coordinate inputs and user coordinate outputs, the
Vectors mapping routines have data coordinate inputs
but NDC outputs. This is because not only position but the
direction of the vector require mapping; to ensure consistent mapping
of the direction it is necessary to output both ends of the vector in
a uniform Cartesian coordinate system. The user coordinate
system cannot meet this test because it could be log-scaled or because
a Y axis unit might not equal an X axis unit.
The mappings handled internally by Vectors are as follows:
- If MAP is set to 0, the data to user space mapping
is an identity. However, if the SET call specifies log-scale axes, or
axes in which an X axis unit is not equal in size to a Y axis unit,
the mapping of the vector direction from user to NDC
space is affected by the setting of the transformation type parameter,
TRT.
- If MAP is set to 1, the data coordinate system is assumed
to define a bounded surface on the globe, with degrees of longitude
extending along the X axis and degrees of latitude along the Y
axis. XC1, XCM, YC1, and YCN, specified in degrees, establish the
boundaries. You cannot use this mapping without first calling routines
in the EZMAP utility to set up a map transformation. Since EZMAP
performs the required SET call, the Vectors SET parameter must
be set to 0 -- no SET call. The Vectors mapping routine uses an
iterative technique involving small differential offsets that relies
on multiple calls to the EZMAP routine, MAPTRA, to map the vector
direction at each grid point.
- When MAP is set to 2, the data coordinates are treated as
representing a polar coordinate space. The first dimension (X Axis) is
mapped to the radial axis, and the second dimension (Y Axis) is mapped
to the angular component. With this in mind you must set XC1, XCM,
YC1, and YCN to appropriate values. The transformation type parameter,
TRT, allows for different interpretations of the vector field data,
depending on whether you consider the mapping as polar locations for
an essentially cartesian space or whether you treat the space itself
as intrinsically radial.
When a user-defined mapping is required, you can modify the user
routine, VVUMXY. If the Vectors routines are loaded from a
binary library, you can usually replace the library version just by
compiling the routine and explicitly linking its object with the NCAR
Graphics library.
2.4 The SET Call
The mapping into the plotter frame depends on the boundaries of the
user coordinate space and the viewport defined in NDC
space. If the user coordinates are not log-scaled and
neither axis is mirrored user coordinates and GKS world
coordinates are the same. In this case, it is possible to define the
user/world coordinate boundaries (also known as the window) and
map them to the viewport using GKS calls. However, since the SPPS
routine SET performs the same task and works under all conditions
recognized by NCAR Graphics, only its use is described here.
A call to the SPPS routine SET has the form
CALL SET (VPL,VPR,VPB,VPT,WDL,WDR,WDB,WDT,LL)
All arguments are REAL except for LL, which is an INTEGER. The first
four arguments must all be between 0 and 1, inclusive; they define a
rectangular area on the plotter frame known as the "viewport". The
next four arguments define the boundaries of the user
coordinate space (the "window"). The final argument indicates whether
the mapping of user coordinates into the viewport is to be
linear or logarithmic in X and Y. See the documentation of the SPPS
utility for further details.
By default, Vectors calls SET. However, by setting the
parameter SET to zero, you may prevent Vectors from doing this;
in that case, one must do the call for oneself or depend on some other
utility (such as EZMAP) to have done it.
If Vectors calls SET, it always uses LL = 1, requesting a
linear-linear mapping from the window to the viewport. The viewport is
positioned as specified by the current values of the parameters VPL,
VPR, VPB, VPT, and VPS. The first four of these specify the boundaries
of a "viewport area", in which the viewport is to be centered and made
as large as possible; the final one determines how the shape of the
viewport is to be chosen. You could, for example, render several plots
within a single plotter frame by setting these parameters to define
separate non-overlapping areas for each plot.
By default, the user coordinate boundaries are set equal to the
data coordinate boundaries, which, in turn, default to the
grid coordinate boundaries (1: M, 1: N) unless the parameters
XC1, XCM, YC1, YCN have non-default values. You may override this
behavior by setting parameters WDL, WDR, WDB, and WDT to non-default
values, explicitly specifying the values used to define the window in
the SET call. Normally you would modify the window setting parameters
only when the parameter MAP has a non-default value, but
Vectors is still expected to perform the SET call. Whereas the
viewport area may be set to any part of the plotter frame, without
fear of losing the plot, you must be careful setting WDL, WDR, WDB,
and WDT, or the region of interest is not likely to match up with the
viewport.
When MAP is set to 1, specifying an EZMAP projection, you should give
the SET parameter a value of 0, since EZMAP must take charge of the
SET call to perform the requested map transformation. If you want to
adjust the viewport size or position in this case, do it using the
EZMAP call MAPPOS.
When MAP is set to 2, specifying a polar coordinate mapping, you may
choose either to leave the SET parameter defaulted and set the
user coordinate boundary parameters WDL, WDR, WDB, and WDT
appropriately, or else to set the SET parameter to zero and make your
own call to the SET routine.
Note that, as long as the parameter MAP is zero, a SET call performed
by Vectors will define the window in such a way as to be
consistent with the ranges of the X and Y coordinates it generates. If
MAP is set non-zero, then you will probably need to set XC1, XCM, YC1,
and YCN to transform the grid coordinates into the range of
data coordinates expected by Vectors' mapping
routine. The call to SET must specify user coordinate
boundaries commensurate with the range generated by the data
coordinate to user coordinate transformation; if Vectors
is to do the call, then you will need to set WDL, WDR, WDB, and WDT to
accomplish this.
2.5 Arrow Length, Spacing, and Position
A common problem with using discrete vector arrows to represent a
vector field is that as the size of the dataset increases, the vectors
become too crowded and the rendering ceases to be intelligible. This
problem may be further compounded when the vector field is passed
through a non-linear transformation, such as a map projection, that
causes many data points to become bunched together in small regions of
the plot. The arrows must either become so small that it is difficult
to distinguish between them, or they overlap and degenerate into an
amorphous mass. Although there is no absolute cure for this problem,
Vectors provides a number of features to help you present the data as
coherently as possible.
2.5.1 Reference length and magnitude
The length of each vector arrow is determined in relation to a vector
reference magnitude that may be specified by the parameter VRM and a
vector reference length that may be specified, as a fraction of the
viewport width, by the parameter VRL. Vectors belonging to the dataset
whose magnitude is equal to the reference magnitude are drawn at the
reference length. By default, if VRM is set to 0.0, the reference
magnitude is the maximum magnitude in the vector field, but it may be
set to any arbitrary value. The default reference length is determined
dynamically based on the viewport and the size of the dataset along
each dimension.
Note that prior to version 4.0.1 of NCAR Graphics, the reference
magnitude was required to be greater than or equal to the largest
vector magnitude in the dataset, and was set using the vector high
cutoff parameter, VHC. For compatibility with older versions, if VRM
has its default value of 0.0, you can still control the reference
magnitude using VHC. The advantage of using VRM is that you can choose
a "nice" value for the reference magnitude without worrying if any
vector magnitudes in the dataset might exceed its value. The arrow in
the Maximum Vector legend now actually represents the reference
magnitude and need not necessarily be the actual maximum magnitude.
2.5.2 Minimum length and magnitude
By default the size of each vector differs from the reference length
by the ratio of its magnitude to the reference magnitude. In practice,
a common result of this strictly proportional representation is that
low magnitude vectors become too small to be rendered with full
detail, particularly on low resolution devices. As a result, their
direction, especially, becomes difficult to decipher. Vectors
provides a parameter, VFR, that allows you to specify, as a fraction
of the reference length, a minimum vector arrow length. When this
resource is set to a value greater than 0.0, the smallest magnitude
vector is rendered at the specified fraction of the reference length,
and intermediate magnitude vectors are rendered at proportionally
intermediate lengths. Setting VFR to 1.0 causes all vector arrows to
be drawn at the reference length.
The parameter VLC specifies the minimum magnitude a vector must have
in order to qualify for drawing. You can use it to eliminate low
velocity vectors in order to concentrate attention on the dominant
features of a vector field. However, note that VLC also has another
role. When it has a value less than 0.0 and VFR is non-zero, its absolute value
specifies the vector magnitude that is rendered at the minimum length
specified by VFR.
2.5.3 Ensuring uniform arrow sizing over a series of plots
In order to ensure that within a series of plots of related data a
particular length always represents the same vector magnitude, you
must always first set the reference magnitude using parameter VRM (or
alternately VHC) explicitly. Otherwise, whatever magnitude happens to be
the maximum in each plot will be rendered at the reference length. In
addition, if you set VFR to a non-zero value, you should be careful to
set VLC to a value less than zero. Otherwise the length that VFR specifies will
be used to represent whatever magnitude happens to be the minimum in
each plot. If you do not want any low magnitude vectors actually
eliminated, simply set VLC to a small negative
number that is less than the smallest magnitude in any of your data sets.
2.5.4 Controlling the spacing between vector arrows
There are two ways to reduce the crowding of a too densely populated
vectorplot. One is to specify array increments greater than unity
along one or both dimensions of the data using the parameters XIN
and/or YIN. This method has the effect of reducing the density
uniformly throughout the data space, and may be the most appropriate
if your plot is overly dense throughout. The second way is to set the
parameter VMD to a value representing, as a fraction of the viewport
width, the minimum distance you want to allow between the locations of
neighboring vector arrows. This method requires that you supply a work
array to VVINIT and VVECTR but it ensures that the minimum distance
between vectors is maintained even after arbitrary non-linear
transformations, like many map projections, from data to NDC space.
2.5.5 Arrow Position
Using the VPO parameter, you can control whether the tail, the head,
or the center of vector arrow is positioned at the location of the
grid point in data space.
2.6 Arrow Styles
Vectors supports three arrow styles: a simple line-drawn arrow, drawn
only using a polyline; a filled arrow with an optional edge line and a
highly configurable shape; and, a wind barb style, which
supports traditional wind barbs glyphs. Each style has its own set of
parameters, although there are other parameters that apply, under
appropriate conditions, to all styles. By default, Vectors uses
line-drawn arrows. Set the parameter AST to 1 in order to activate
filled arrows or to 2 to activate wind barbs.
2.6.1 Line-drawn arrows
Line-drawn vector arrows have a fixed shape which the user cannot
modify. However, you can control the minimum and maximum size of the
vector arrowhead using parameters AMN and AMX. This allows you to
ensure that the arrowheads remain recognizable for small-magnitude
vectors while not becoming excessively large for high-magnitude
vectors.
You can set the thickness of the polylines used to render line-drawn
arrows using the LWD parameter. You may notice that as the lines are
made thicker the arrows begin to take on a rather fuzzy look. This is
an unavoidable consequence of using thick lines, (at least where there
is no control of the line join method), and one of the motivations for
the development of filled vector arrows.
2.6.2 Filled arrows
Vectors draws filled vector arrows using a solid filled area
with an edge outline. Filled arrows have several advantages over
line-drawn arrows:
- The edges can be sharply defined no matter how wide you make the
arrow body or head.
- There is more area available to apply colors to the arrow and
therefore the colors are more visible.
- You have much greater control over the shape of the vector
arrows.
- Since the edge can be drawn in a separate color from the fill, you
can distinguish the individual vector arrows more easily in areas
where the vectors overlap, or where the fill has a similar color to
the background color.
Naturally filled arrows have a few drawbacks as well:
- They take a bit longer to draw.
- If the vector arrows overlay other graphics, such as a contour
plot, the filled arrows may obscure too much of the information
underneath.
- Since there are more parameters to adjust, you may find yourself
spending more time figuring out how they work and what looks best for
your data.
Either the filled area or the edge or both may be colored individually
based on the values in the TVL threshold level array. Assuming
individual coloring is enabled (see following section) the arrow color
mode parameter ACM determines how the colors apply to the arrow fill
and edges. When not colored individually the fill color is determined
by the current GKS fill color index and the edge color by the current
GKS line color index. Appropriate settings of the ACM parameter can
cause either the fill or the edge not to be drawn.
The AFO parameter specifies whether the edge should be drawn first
with the fill on top or vice versa. Drawing the fill on top ensures
that the full extent of the filled area appears, even when the vector
arrow is very small. However, in this case you should ensure that the
linewidth parameter LWD is given a value greater than 1.0. Otherwise
the edges will appear broken and poorly formed.
Seven parameters control the shape of filled vector arrows. Four of
these specify the shape of an arrow drawn at the reference length:
- AWR specifies the width of the arrow body.
- AXR specifies the distance from the tip of the arrowhead to its
trailing point along the axis of arrow body.
- AYR specifies the distance from the arrow body's side to the
trailing point of the arrowhead in a direction perpendicular to the
arrow body axis.
- AIR specifies the distance from the tip of the arrowhead to the
interior point where the arrowhead meets the arrow body.
Each of these parameters is expressed as a fraction of the reference length.
The other three parameters, AWF, AXF, and AYF, set minimum sizes for
AWR, AXR, and AYR, respectively. They are specified as fractions of
the parameter with which they are associated. So, for example, if you
set AWF to 0.25, the width used for the minimum length arrow will be
equal to 0.25 * AWR * the reference length in NDC. The widths used for
intermediate length arrows will be sized proportionally between the
minimum width and the reference width. This implies that if you set
AWF to 1.0, the arrow width will remain constant for all filled
arrows, no matter what their length. Setting any of these parameters
to 0.0 causes their associated arrow dimension to vary in strict
proportion to the arrow length.
2.6.3 Wind barbs
Wind barb glyphs consist of a shaft parallel to the vector
direction, and zero or more pennants and/or ticks spaced
along the shaft starting at the end nearest the direction
from which the flow is coming. However, if the magnitude of the
velocity is less than 2.5, a circle replaces the shaft. Half
ticks represent 5 units of magnitude, full ticks represent 10 units,
and pennants represent 50 units. By convention, the units are
knots. The pennants are drawn using a filled polygon, while the ticks,
the shaft, and the calm circle are all rendered with polylines.
Wind barbs differ from the other arrow styles in several respects:
- Wind barbs maintain a basically uniform length for all
magnitudes; this length is set using the vector reference length
parameter VRL.
- Since the length does not vary, the minimum vector fractional length
parameter, VFR, is ignored.
- When using the wind barb style, a circle appears at the locations
of zero-magnitude vectors. With other arrow styles, nothing is drawn
at these locations.
- Like filled arrows, wind barbs are a composite of line and fill
elements, but wind barbs force the fill to be drawn using the same
color as the lines.
- Masking to an areamap has not been implemented for wind barbs.
Otherwise, the wind barb style shares the capabilities of the other
styles, including the ability to be individually colored based on
values in the TVL threshold level array.
As with line elements in all the arrow styles, the linewidth of
wind barb line elements is set using the LWD parameter. When not using
multi-colored vectors, specify the wind barb color by setting the GKS
polyline color index. There are five parameters that are specific to
the wind barb arrow style:
- WBA sets the angle of the wind barb ticks in degrees clockwise
from the vector direction. It also sets the angle of the hypotenuse of
the the wind bar pennant triangles.
- WBT sets the wind barb tick size as a fraction of the overall wind barb
length. It also sets the length of the hypotenuse of the wind barb pennant
triangles.
- WBD sets the distance between ticks as a fraction of the overall
wind barb length. The distance between pennants is set to one half this
distance.
- WBC sets the diameter of wind barb calm circles as a fraction of the
overall windbarb length.
- WBS is a scaling factor that is applied to the magnitude of each
vector prior to computing the number of barbs and pennants for each wind
barb. However, it does not currently affect the vector magnitude
reported in the minimum or maximum vector legend.
2.7 Color Threshold Level Control
A major addition to Vectors for Version 3.2 is the ability to
color the vectors either based on the values in an associated scalar
data array or based on the vector's magnitude. When a related scalar
field, such as temperature or pressure, serves as the basis for
determining the color of a set of wind vector data using a suitably
graduated color palette, patterns may emerge that would be hard to
observe when viewing the data sets separately.
Vectors will not set up a color palette. You must call the GKS routine
GSCR to assign RGB values for each color index you intend to use. An
example in the examples section includes code for a sample color
palette that varies from blue at one end of the scale to red at the
other. Currently, a maximum palette of 255colors is allowed. As in all
of NCAR Graphics, the color indices used can range from 1 to 255, with
index 0 reserved for the background color. You are also responsible
for setting up the GKS color index array used by Vectors to determine
the color to use for data within a certain range. For example,
assuming (1) a palette of 14 colors is desired, (2) the desired RGB
values have previously been stored in a 3 x n array called
"RGB", and (3) a consecutive series of GKS indices starting at N + 1
is to be used (where N is a previously initialized value between 0 and
255 - 14) you could accomplish both these tasks in a single simple
loop:
DO 100 I=1,14,1
CALL GSCR (1,I+N,RGB(1,I),RGB(2,I),RGB(3,I))
CALL VVSETI('PAI -- Parameter Array Index', I)
CALL VVSETI('CLR -- GKS Color Index', I+N)
100 CONTINUE
The setting of the color threshold value control parameter, CTV,
determines how Vectors handles the selection of color threshold
values. If you want Vectors to choose the threshold values, set
CTV to a positive value: 1 to color by vector magnitude or 2 to color
by scalar array. Set the number of levels parameter NLV to select the
number of threshold levels (and the number of colors, with a maximum
of 255) to use. When Vectors chooses the threshold levels, it
finds the maximum and minimum values in the data, then simply divides
the range into NLV equally spaced divisions. The resulting NLV
threshold values are stored into the threshold level array, TVL. The
first value stored is the minimum data value plus one division
increment while the last value is the maximum data value itself. As
each vector is processed its color is chosen by finding the first
entry in the threshold level array greater than or equal to the data
value associated with the vector, retrieving the array subscript for
this entry, and then setting the GKS polyline color index to the value
in the color index array, CLR, accessed by the same
subscript. Assuming as above that 14 levels are desired, the following
code would tell Vectors to choose the color levels based on
data in the scalar array:
CALL VVSETI('NLV - Number of Threshold Levels', 14)
CALL VVSETI('CTV - Color Threshold Value Control', 2)
To set up the threshold level array yourself, make CTV negative: -1 to
color by vector magnitude or -2 to color by scalar array value. When
CTV is less than or equal to 0, Vectors will not touch the
values in the TVL array. Set NLV as before to the number of levels
desired, then set the first NLV members of the threshold array to the
desired threshold values, keeping in mind from the preceding
description how Vectors chooses the color index based on the
threshold array values. A basic rule to observe is that the threshold
values should increase monotonically as the array subscripts
increase. Note also that if the vector's associated data value is
larger than all the values in the threshold value array, it will be
assigned the color subscripted by the index for the maximum data
value. Again assuming 14 colors and also that the desired threshold
values are stored in an array called "TVALS", the following code would
set up the threshold array and inform Vectors not to modify its
contents:
CALL VVSETI('NLV - Number of Threshold Levels', 14)
CALL VVSETI('CTV - Color Threshold Value Control', -2)
DO 200 I=1,14,1
CALL VVSETI('PAI -- Parameter Array Index', I)
CALL VVSETR('TVL -- Threshold Value Array', TVALS(I))
200 CONTINUE
You can also use the color threshold control parameter to retain a
threshold array set up by a previous plot (within the same program
execution). Suppose you have a program to create several plots using
scalar arrays with varying maximum and minimum values. When
Vectors picks the threshold values, the color associated with a
particular data value may change from plot to plot. To ensure that a
given data value is associated with the same color for the complete
series of plots, pick one plot (preferably the one with the greatest
range) and by setting CTV to a positive value, allow Vectors to
set up the threshold array. For the subsequent plots, set CTV
negative. All plots will then use the same threshold array, and
therefore the colors will be associated with identical ranges of
data.
2.8 Other Color Facilities
Besides the implementation of vector coloring according to a related
scalar data field or vector magnitude discussed earlier, there are
several other points to make about the way the Vectors utility
supports the use of color in NCAR Graphics plots.
First you should note that even if you do not take advantage of
multiple colors for vectors (the color threshold value control
parameter, CTV is set to 0), it is still possible to adjust the color
of the vector field as a whole simply by setting the GKS polyline
color index at any point before the call to VVECTR.
Basic text elements, such as the Zero Field text block, are by default
colored using the current text color index. You may override this
behavior by setting the color parameter associated with the text
element to a value greater than or equal to 0, causing the parameter
value to be used as the GKS color index for the text. In addition, the
maximum and minimum vector text blocks have an additional option that
can only be activated when the vectors are colored according to
magnitude. When the option is active, the text and the vector arrow
both are colored using the color associated with that magnitude of
vector within the plot.
By default, Vectors draws the optional vector magnitude labels
using the same color index as the vector arrow with which each one is
associated. However, here again, you may assign a positive or zero
value to the parameter LBC to give the labels a uniform color of your
choice, or assign a value less than zero to the parameter if you want
them to be drawn using the current GKS text color index.
2.9 Masked Vector Overlays Using an Area Map
At times you may need to overlay a vector field on a plot created by
another NCAR Graphics utility, such as Conpack. There may be certain
areas, such as the boxes containing contour level labels, where you do
not want the vector arrows to appear. Beginning with Version 3.2, the
Vectors utility supports vector masking based on the contents of a
area map previously established using routines from the Areas
utility. Most of the information required to use the area map routines
is documented elsewhere, either in the descriptions of the Conpack
utilities that work with area maps or in the actual documentation of
the Areas utility itself. You create the area map and the underlying
plot just as you normally would. Then, in order to create the vector
overlay, you would need to take the following steps:
- Insert an EXTERNAL declaration for the user-defined subroutine
that actually draws the masked vectors. The name of the subroutine
must be passed to the VVECTR call. If the default version of the
subroutine supplied with the Vectors utility can suffice, the
statement would simply be:
EXTERNAL VVUDMV
- Call VVSETI to set the MSK parameter to a positive value: 1 for
high-precision masking, greater than 1 for low precision masking.
- Make any other necessary calls to the parameter setting
routines. In particular you would probably want to tell Vectors
not to do a SET call, since Vectors should work in the same
coordinate space as the underlying plot used to create the area
map. The data coordinate parameters, XC1, XCM, YC1, and YCN and the
MAP parameter also need to be set to coincide appropriately with the
underlying plot.
- Call VVINIT as usual.
- Call VVECTR, passing the previously created area map and the
external drawing subroutine in the argument list.
2.10 Special Values
If the datum at a particular grid point is unavailable or unreliable,
a "special" value, typically a value outside the possible range of
valid data, may be assigned to the array element associated with the
grid point in question. Since Vectors has at least two and
perhaps three separate arrays as input, it uses several parameters to
control processing of special value data points. Each of the three
input arrays may have its own separately defined special value. The
parameters USV, VSV, and PSV are used to set the special values for
the U vector component array, the V vector component array, and the P
scalar data array, respectively.
Two more parameters control the way Vectors handles the special
values. The parameter SVF handles special value processing for the
vector component arrays. You may choose from several different methods
for deciding whether to draw a vector, given that either one or both
of the component array elements may contain a special value. The
special color parameter SPC determines the fate of a vector that would
otherwise be drawn, but whose associated scalar array data element has
a special value. Depending on the setting of SPC, Vectors may
eliminate the vector from the plot, or draw it using a special color
of your choice, probably outside the palette of colors used to render
the range of legitimate scalar data.
2.11 Supplementary Text
You may control the size, justification, color, visibility, and, where
appropriate, the content and location of several supplementary text
objects in order to improve the appearance and informativeness of a
Vectors plot.
- The Maximum Vector text block consists of an horizontal arrow,
sized the same as the vector with the maximum magnitude in the
plot. Centered directly above the arrow is a numeric string expressing
the value of this magnitude in exponential format. Below the arrow an
explanatory text string, "Maximum Vector" by default, appears. The
default location of this text block is underneath the plot viewport
just to the right of center.
- The Minimum Vector text block is similar to the Maximum Vector
block, except that, naturally enough, it contains a representation of
the minimum magnitude vector. This block is located, by default,
underneath the plot viewport and left of center.
- The Zero Field text block contains a message ("Zero Field", by
default), printed whenever the field contains no vectors that can be
rendered. By default, this block is located in the center of the plot
viewport.
- If vector labeling is activated, Vectors will output a
text string near each vector and oriented in the same direction, that
represents the magnitude of each individual vector. By default the
values are scaled and rounded in such a way that they can all be
represented by a 3 digit integer string. Since the text must be quite
small on a normal sized plot if the graphic content is to remain
intelligible, this option is primarily intended for debugging.
- Although not part of the graphics plot itself, you may obtain
supplementary information about the operation of Vectors and
the data sets employed by setting the vector statistics parameter, VST
to 1. Information about the number of vectors plotted, maximum and
minimum vector magnitudes, and, when relevant, maximum and minimum
scalar data values, will be written to the default output unit.
2.12 Vectors' Grid Window
Note that the grid window for Vectors is not the same as the
grid window for AUTOGRAPH, since the former is expressed with respect
to the plotter frame and the latter is expressed with respect to the
AUTOGRAPH "graph window". There is an easy conversion from one to the
other, however. If AGFL, AGFR, AGFB, and AGFT specify the AUTOGRAPH
graph window and AGDL, AGDR, AGDB, and AGDT specify the AUTOGRAPH grid
window and CGDL, CGDR, CGDB, and CGDT specify the Vectors grid window,
then the following relationships ensure coincidence of the AUTOGRAPH
and Vectors grid windows:
CGDL=AGFL+AGDL*(AGFR-AGFL)
CGDR=AGFL+AGDR*(AGFR-AGFL)
CGDB=AGFB+AGDB*(AGFT-AGFB)
CGDT=AGFB+AGDT*(AGFT-AGFB)
Note what happens when AGFL and AGFB are 0's and AGFR and AGFT are
1's, which is the default situation; in that case CGDL=AGDL,
CGDR=AGDR, CGDB=AGDB, and CGDT=AGDT.
2.13 GKS Considerations
Certain assumptions are made by Vectors about the state of GKS,
as follows:
- Like all the utilities in NCAR Graphics, Vectors assumes
that GKS has been opened and that the desired workstations have been
opened and activated. The statement
CALL OPNGKS
calls the SPPS routine OPNGKS, the GKS equivalent of which is
CALL GOPKS (6,0)
CALL GOPWK (1,2,1)
CALL GACWK (1)
creating a single metacode workstation associated with FORTRAN unit
2.
- Similarly, at the end of one's program, the workstations must be
deactivated and closed and then GKS must be closed. The statement
CALL CLSGKS
calls the SPPS routine CLSGKS, the GKS equivalent of which is
CALL GDAWK (1)
CALL GCLWK (1)
CALL GCLKS
- It is assumed that the aspect source flags for various quantities
are set to "individual". (NCAR GKS does this by default, but other
packages may not.) To make sure that all the aspect source flags are
set correctly, use the following code:
DIMENSION IASF(13)
...
DATA IASF / 13*1 /
...
CALL GSASF (IASF)
- Color-setting by Vectors is done by executing calls to the
GKS routines GSPLCI and GSTXCI, with user-defined color indices as
arguments. The association of these color indices with colors on the
workstations must have been defined previously by the user. This
should be done by calling the GKS routine GSCR. The statement
CALL GSCR (IW,IC,RC,GC,BC)
defines, for workstation IW, color index IC, with RGB components RC,
GC, and BC. To be consistent with the SPPS routines OPNGKS and CLSGKS,
use IW = 1. The value of IC may be any non-negative integer. By
default, color index 0 is associated with the color black, which is
defined by (RC,GC,BC) = (0.,0.,0.) and is used as the background
color, while color index 1 is associated with the color white, which
is defined by (RC,GC,BC) = (1.,1.,1.).
3.0 SUBROUTINES
All Vectors routines added for NCAR Graphics Version 3.2 and later
have six-character names beginning with the letters 'VV'. Current user
entry points and user-modifiable routines are described in detail in
alphabetical order in this section. Obsolete routines appear in the
section following entitled OBSOLETE
SUBROUTINES.
3.1 VVECTR (U,V,P,IAM,VVUDMV,WRK)
This routine manages the coordinate system mapping, color setting,
auxiliary text output, and drawing of the vector field plot, according
to the specifications established by the parameter setting routines
and the initialization routine, VVINIT.
3.1.1 Usage
A call to VVINIT must precede the first call to VVECTR, and is again
required any time the vector or scalar array data changes, any of the
coordinate control parameters are modified, or the number of color
threshold levels is modified when Vectors is given the
responsibility of setting up the color threshold value array. However,
the user may modify text elements or any of the rendering control
parameters, and if assuming responsibility for setting up the color
threshold array, may also modify the color array parameters, in
between multiple invocations of VVECTR.
Arguments to VVINIT establish the sizes of the two or three data
arrays. VVINIT places these values into common block variables where
they become available to VVECTR. Therefore no size arguments need
appear in the VVECTR argument list. When there is no scalar data
array, and area masking is not enabled, all but the first two
arguments to VVECTR may have dummy values and the invocation would be
something like:
CALL VVECTR(U,V,IDM,IDM,IDM,IDM)
where IDM is an arbitrary variable, INTEGER or REAL, that need not
have been initialized. However, any time the color threshold control
parameter, CTV has an absolute value of 2, the auxiliary scalar data
array is expected, and the P scalar array variable needs to be
specified.
The masking capability supported by Vectors allows the user to
overlay vector fields on top of graphics produced by other utilities,
such as CONPACK contour plots, without encroaching on areas, like
label boxes, that should appear in the foreground, uncovered. Normally
the area map should be generated and used in the normal way (as
described in the AREAS and CONPACK documentation) before calling any
routines in the Vectors utility. When the parameter MSK has a
non-zero value, masking is enabled and a previously created area map
must be passed to VVECTR. VVECTR examines the map, returning an error
if the map is invalid or there are more area groups than
Vectors can handle, currently 64. Otherwise it only uses the
map as a member of the argument list when invoking one of the Areas
routines, ARDRLN or ARGTAI. The user must also pass in a
user-definable masked drawing subroutine. A simple version of this
subroutine, named VVUDMV, is supplied with the Vectors utility,
and may suffice for basic masked drawing operations. There is a
separate entry describing the usage and argument list for this
subroutine in this section.
The last argument in the calling sequence, WRK, is used only when the
parameter VMD (Vector Minimum Distance) is given a value greater than
0.0. In this case, Vectors uses the array to keep track of the
location of each vector in NDC space so that the distances between
vectors can be compared. Based on these comparisons, Vectors
eliminates some vectors such that the remaining vectors are separated
by at least the specified distance. Otherwise the WRK argument is
ignored, and may be passed a dummy argument value.
3.1.2 Arguments
U (REAL 2 dimensional array, dimensioned as specified in last
call to VVINIT, input): By default, assumed to contain the first
dimensional axis components of the vector field. However, if PLR is
non-zero, it is treated as containing the vector magnitudes.
V (REAL 2 dimensional array, dimensioned as specified in last
call to VVINIT, input): By default, assumed to contain the second
dimensional axis components of the vector field. However, if PLR is
non-zero, it is treated as containing the vector angles.
P (REAL 2 dimensional array, dimensioned as specified in last
call to VVINIT, input): Array of scalar data that may be used to color
the vectors. The grid points are assumed to coincide with the grid
points of the U and V arrays. Required only if CTV has an absolute
value of 2; otherwise this argument is ignored and may be assigned a
dummy value.
IAM (INTEGER array, unknown dimension, input): Area
map array previously established by calls to routines in the Areas
utility. It is not examined or modified by Vectors. Required only if
MSK is set to a non-zero value; otherwise it is ignored and may be
assigned a dummy value.
VVUDMV (EXTERNAL subroutine, input): User-definable masked
drawing subroutine. See the entry, "VVUDMV", in this section for a
discussion of the usage and argument list required for this
subroutine. Required only if MSK is set to a non-zero value; otherwise
it is ignored and may be assigned a dummy value.
WRK (REAL array, dimensioned as specified in last call to
VVINIT, input/output): Work array required only if the parameter VMD
is set to a value greater than 0.0. Otherwise may be set to a dummy
value.
3.2 VVGETC (CNM,CVL)
This routine is used to get the current value of a parameter of type
CHARACTER
3.2.1 Usage
Use the statement
CALL VVGETC (CNM,CVL)
at any time to retrieve in CVL the current character value of the
parameter whose name is CNM.
3.2.2 Arguments
CNM (CHARACTER, input) is the name of a parameter whose
character value is to be retrieved. Only the first three characters of
CNM are examined. The three characters may either be entirely upper or
entirely lower case; mixed case is not recognized. It is recommended
that the rest of the character string be used to improve the
readability of the code. For example, instead of just 'MXT', use 'MXT
- Maximum Vector Text String'.
CVL (CHARACTER, output) is a variable in which the value of the
parameter specified by CNM is to be returned.
3.3 VVGETI (CNM,IVL)
This routine is used to get the current value of a parameter of type
INTEGER.
3.3.1 Usage
Use the statement
CALL VVGETI (CNM,IVL)
at any time to retrieve in IVL the current integer value of the
parameter whose name is CNM. If that parameter is an array, the array
element specified by the current value of the parameter PAI will be
the one retrieved.
3.3.2 Arguments
CNM (CHARACTER, input) is the name of a parameter whose integer
value is to be retrieved. Only the first three characters of CNM are
examined. The three characters may either be entirely upper or
entirely lower case; mixed case is not recognized. It is recommended
that the rest of the character string be used to improve the
readability of the code. For example, instead of just 'PLR', use 'PLR
- Polar Input Mode'.
IVL (INTEGER, output) is a variable in which the value of the
parameter specified by CNM is to be returned.
3.4 VVGETR (CNM,RVL)
This routine is used to get the current value of a parameter of type
REAL.
3.4.1 Usage
Use the statement
CALL VVGETR (CNM,RVL)
at any time to retrieve in RVL the current real value of the parameter
whose name is CNM. If that parameter is an array, the array element
specified by the current value of the parameter PAI will be the one
retrieved.
3.4.2 Arguments
CNM (CHARACTER, input) is the name of a parameter whose real
value is to be retrieved. Only the first three characters of CNM are
examined. The three characters may either be entirely upper or
entirely lower case; mixed case is not recognized. It is recommended
that the rest of the character string be used to improve the
readability of the code. For example, instead of just 'DMX', use 'DMX
- Device Maximum Vector Size'.
RVL (REAL, output) is a variable in which the value of the
parameter specified by CNM is to be returned.
3.5 VVINIT (U,LU,V,LV,P,LP,M,N,WRK,LW)
VVINIT performs initialization tasks required before VVECTR may be
called to plot a vector field, including copying array size
information into internal common block variables, establishing
coordinate system mappings and boundaries, determining the maximum and
minimum vector magnitudes and scalar array values, and, if required,
setting up the color threshold value array.
3.5.1 Usage
Call VVINIT before the first invocation of VVECTR and again any time
you modify the contents of the input data arrays. You may precede a
VVINIT call with any number of calls to the Vectors parameter setting
routines (VVSETC, VVSETI, or VVSETR). After the VVINIT call, you may
still change certain parameters before calling VVECTR. (Consult the
section, PARAMETERS, for further
information on this point.)
Set up the two vector component arrays prior to calling VVINIT. To
permit multiple purpose use of the array space, the VVINIT argument
list includes both the actual size and an assumed size for the first
dimension of each input array. Due to FORTRAN array ordering
conventions, only the assumed size needs to be specified for the
second dimension. (Note: when using the C bindings, mentally exchange
all references to first and second dimensions in this discussion.) The
arguments LU, LV, and LP contain the actual size of the first
dimensions of arrays U, V, and P respectively. Since the grid
locations for each of the data arrays are assumed to coincide, a
single argument, M, represents the assumed size of the first dimension
for all the arrays. Similarly, the argument, N, is the assumed size of
the second dimension. The only requirement for the actual second
dimension size is that it be greater than or equal to N for each
array.
The array specified by the WRK argument and its associated size
specifier, LW, are used only when the parameter VMD (Vector Minimum
Distance) is given a value greater than 0.0. In this case, Vectors
uses the array to keep track of the location of each vector in NDC
space so that the distances between vectors can be compared. Based on
these comparisons, Vectors eliminates some vectors such that the
remaining vectors are separated by at least the specified distance. If
VMD is less than or equal to 0.0, you may assign an arbitrary dummy
value to WRK, but you should set LW to the integer value 0.
3.5.2 Arguments
U (REAL 2-dimensional array, dimensioned LU x
n: n >= N, input): By default, assumed to contain
the first dimensional Cartesian components of the vector
field. However, if PLR is non-zero, it is treated as containing the
vector magnitudes.
LU (INTEGER, input): Actual value of the first dimension of
array U.
V (REAL 2-dimensional array, dimensioned LV x
n: n >= N, input): By default, assumed to contain
the second dimensional Cartesian components of the vector
field. However, if PLR is non-zero, it is treated as containing the
vector angles.
LV (INTEGER, input): Actual value of the first dimension of
array V
P (REAL 2-dimensional array, dimensioned LP x
n: n >= N, input): Array of scalar data that may
be used to color the vectors. The grid points are assumed to coincide
with the grid points of the U and V arrays. Required only if CTV has
an absolute value of 2; otherwise this argument is ignored and may be
assigned a dummy value.
LP (INTEGER, input): Actual value of the first dimension of
array P
M (INTEGER, input): Number of contiguous elements along the
first dimensional axis containing data to be processed in each of the
arrays U, V, and P (if used).
N (INTEGER, input): Number of contiguous elements along the
second dimensional axis containing data to be processed in each of the
arrays U, V, and P (if used).
WRK (REAL, array dimensioned n: n >= LW,
input/output): Work array required only if the parameter VMD is set to
a value greater than 0.0. If required must be dimensioned greater or
equal to 2 * M * N. Otherwise may be set to a dummy value.
LW (INTEGER, input): Assumed size of the array WRK. If the
parameter VMD is set to a value greater than 0.0, must be set to a
value less than or equal to the dimension of the WRK array, but
greater than or equal to 2 * M * N. Otherwise, this argument should be
assigned the integer value 0.
3.6 VVRSET
Resets all parameters to their initial default values.
3.6.1 Usage
To reset all parameters to their default values:
CALL VVRSET
There are no arguments.
3.6.2 Arguments
None.
3.7 VVSETC (CNM,CVL)
This routine is called to set the value of a parameter of type
CHARACTER.
3.7.1 Usage
Use the statement
CALL VVSETC (CNM,CVL)
to give the parameter whose name is CNM the character value CVL.
3.7.2 Arguments
CNM (CHARACTER, input) is the name of a parameter to be given a
character value. Only the first three characters of CNM are
examined. The three characters may either be entirely upper or
entirely lower case; mixed case is not recognized. It is recommended
that the rest of the character string be used to improve the
readability of the code. For example, instead of 'ZFT', use 'ZFT -
Zero Field Text String'.
CVL (CHARACTER, input) is an expression, the value of which is
to be given to the parameter specified by CNM.
3.8 VVSETI (CNM,IVL)
This routine is called to set the value of a parameter of type INTEGER.
3.8.1 Usage
Use the statement
CALL VVSETI (CNM,IVL)
to give the parameter whose name is CNM the integer value IVL. If that
parameter is an array, the element specified by the current value of
PAI will be the one changed.
3.8.2 Arguments
CNM (CHARACTER, input) is the name of a parameter to be given
an integer value. Only the first three characters of CNM are
examined. The three characters may either be entirely upper or
entirely lower case; mixed case is not recognized. It is recommended
that the rest of the character string be used to improve the
readability of the code. For example, instead of 'VPO', use 'VPO -
Vector Positioning Mode'.
IVL (INTEGER, input) is an expression, the value of which is to
be given to the parameter specified by CNM.
3.9 VVSETR (CNM,RVL)
This routine is called to set the value of a parameter of type
REAL.
3.9.1 Usage
Use the statement
CALL VVSETR (CNM,RVL)
to give the parameter whose name is CNM the real value RVL. If that
parameter is an array, the element specified by the current value of
PAI will be the one changed.
3.9.2 Arguments
CNM (CHARACTER, input) is the name of a parameter to be given a
real value. Only the first three characters of CNM are examined. The
three characters may either be entirely upper or entirely lower case;
mixed case is not recognized. It is recommended that the rest of the
character string be used to improve the readability of the code. For
example, instead of 'VFR', use 'VFR - Minimum Vector Fractional
Length'.
RVL (REAL, input) is an expression, the value of which is to be
given to the parameter specified by CNM.
3.10 VVUDMV (XCS,YCS,NCS,IAI,IAG,NAI)
This routine is the user-definable external subroutine used to draw
masked vectors. The default version of the routine draws any polyline
all of whose area identifiers are greater than or equal to zero.
3.10.1 Usage
'VVUDMV' is the name given to the default version of the masked vector
drawing routine, and it is also the name given to the argument through
which the external subroutine is passed to VVECTR. However, you may
use any acceptable FORTRAN identifier as the name of a user-defined
version of the routine. The substitute routine must have an argument
list equivalent to the default version of VVUDMV. Also, whether or not
the default version is used, the subroutine that calls VVECTR should
contain an external declaration of the routine, such as:
EXTERNAL VVUDMV
If the MSK parameter is set to the value 1, specifying high precision
masking, Vectors sends one set of X and Y polyline coordinate
arrays to the area masking routine, ARDRLN, for each vector
arrow. ARDRLN subdivides the polyline into pieces such that each
smaller polyline has a single area identifier with respect to each
area identifier group, then makes a call to VVUDMV for each polyline
piece. While the default version of VVUDMV only checks to see that
none of the area identifiers are negative, a user-defined version
could perform more complicated decision processing based on knowledge
of the meaning of specific area identifier groups and/or area
identifier values. Note that, before invoking VVUDMV, ARDRLN modifies
the user coordinate space by making the following calls:
CALL GETSET(VPL,VPR,VPB,VPT,WDL,WDR,WDB,WDT,LLG)
CALL SET(VPL,VPR,VPB,VPT,VPL,VPR,VPB,VPT,1)
These calls temporarily turn the user to NDC mapping
into an identity, allowing the user to call any of the routines,
CURVE, CURVED, or the GKS routines GPL or GFA (for filled vector
arrows) to render the polygon piece, without worrying about a possible
non-identity mapping between user and world
coordinates. If MSK has a value greater than 1, specifying low
precision masking, Vectors calls the routine ARGTAI to get the
area identifiers with respect to the area identifier groups for a
single point that locates the base position of the
vector. Vectors then calls the VVUDMV routine itself, passing
the coordinate arrays for a complete vector arrow. Thus, a vector
arrow whose base position is within an area to be masked can be
eliminated, but an arrow whose base position is nearby, but outside, a
masked area may intrude into the area. Also, in this case, since
faster rendering is the goal, Vectors does not convert the
coordinate arrays into normalized device coordinates and do the
identity SET call. Therefore, the user should use only CURVE or CURVED
to render the polyline, unless there is no possibility of a
non-identity user to world coordinate mapping.
VVUDMV contains a separate block of code that handles masked drawing
of filled vectors (parameter AST set to 1). However, the default code
is unable to determine how to close open polygon fragments
correctly. Therefore it completely eliminates vectors that partially
protrude into a masked region when high precision masking is
specified.
The current version of Vectors supports masked drawing with up
to 64 area groups. Vectors will exit with an error message if
an area map with more than 64 groups is passed to it.
3.10.2 Arguments
XCS (REAL array, assumed size NCS, input): Array of X
coordinates of the points defining the polyline with the given set of
area identifiers.
YCS (REAL array, assumed size NCS, input): Array of Y
coordinates of the points defining the polyline with the given set of
area identifiers.
NCS (INTEGER, input): Number of points; assumed size of the X
and Y coordinate arrays, XCS and YCS.
IAI (INTEGER array, assumed size NAI, input): Array of area
identifier values. Each value represents the area identifier with
respect to the area group in the area group array with the same array
index.
IAG (INTEGER array, assumed size NAI, input): Array of
area-identifier groups.
NAI (INTEGER, input): Number of area identifier groups. The
current version of Vectors supports up to 64 area groups.
3.11 VVUMXY (X,Y,U,V,UVM,XB,YB,XE,YE,IST)
The user may modify this routine to define a custom mapping of vectors
from a data coordinate system aligned with the natural
boundaries of the vector field to the uniform normalized device
coordinate (NDC) system suitable for generating a plot on an
output device. It has same parameters as the internal Vectors
routine, VVMPXY, used for the predefined mappings employed when the
MAP parameter has a value between 0 and 2.
3.11.1 Usage
The user does not call VVUMXY. Vectors calls it only when the
parameter MAP has a value other than 0, 1, or 2, the mappings handled
by Vectors internally. Note that unlike other user-modifiable
mapping routines in NCAR Graphics, such as CPMPXY, that map a single
point into the user coordinate system, this routine returns two
points, representing both ends of the vector, scaled for magnitude, in
the normalized device coordinate (NDC) system. The
NDC system is used for output because, as a coordinate system
guaranteed to be rectangular and uniform, it serves as a convenient
reference system to help map both vector magnitude and direction
correctly. The term uniform, as used in this discussion, means
that an arbitrary numerical increment along either the X or Y axis has
the same length given any offset from the coordinate system
origin. The user coordinate system does not qualify, because it
may be log-scaled, or the X units may have a different size from the Y
units.
In order to implement a custom mapping, you must pick a unique mapping
code (a positive integer greater than 2), and then modify VVUMXY to
recognize and respond to the chosen code. In the standard distribution
of NCAR Graphics, this routine resides in the file, 'vvumxy.f'. VVUMXY
has access to a common block called VVMAP that contains a number of
variables used to record the current transformation state. In order to
accommodate a variety of mapping implementations, VVMAP provides more
information than normally required. Consider the values stored in
VVMAP as strictly read-only. One essential member of this common block
is IMAP, which contains the value currently assigned to the MAP
parameter.
When implementing a non-linear mapping, an iterative differential
technique will most likely be required. Look at the routine, VVMPXY,
in 'vvmpxy.f', which handles the pre- defined mappings, for examples
of the method. Both the default transformation (MAP set to 0), in order to account for
possible log scaling of the user coordinate axes, and also the Ezmap
projection (MAP set to 1) use such a
technique. Basically the idea is that the vector components must be
proportionally reduced in size enough that an effectively
"instantaneous" angle can be calculated, although they must not become
so small that the calculation is adversely affected by the floating
point precision available for the machine. Additionally, checks must
be put in place to prevent the increment from stepping off the edge of
the coordinate system space. The pre-defined mappings step in the
opposite direction to find the angle whenever an increment in the
original direction would fall off the edge.
For more information, see the section titled Coordinate Systems in Vectors.
3.11.2 Arguments
X (REAL, input) Location of the vector along the first
dimensional axis in the data coordinate system. When MAP is 0,
this is the X Axis. If MAP is 1, it is the longitudinal axis, and if
MAP is 2, it is the radial axis. For other values of MAP, those that
cause VVUMXY to be invoked, the interpretation is up to the author of
the mapping routine.
Y (REAL, input) Location of the vector along the second
dimensional axis in the data coordinate system. When MAP is 0,
this is the Y Axis. If MAP is 1, it is the latitudinal axis, and if
MAP is 2, it is the angular axis. For other values of MAP, those that
cause VVUMXY to be invoked, the interpretation is up to the author of
the mapping routine.
U (REAL, input) U component of the vector. If TRT is set to 1,
the direction of the U component is tangent to the direction of the
first dimensional axis in the data coordinate system at the
location of the vector. If TRT is set to 0, and MAP has a value of 0
or 2, the direction of the U component is parallel to the horizontal
(X axis) in NDC space.
V (REAL, input) V component of the vector. If TRT is set to 1,
the direction of the V component is normal to the direction of the
first dimensional axis in the data coordinate system at the
location of the vector. If TRT is set to 0, and MAP has a value of 0
or 2, the direction of the V component is parallel to the vertical (Y
axis) in NDC space.
UVM (REAL, input) Magnitude of the U and V components,
SQRT(U*U+V*V). Although this value could be calculated within the
routine, it is more efficient for the calling routine to supply the
value as an argument, since it is needed for other purposes at a
higher level.
XB (REAL, output) Location of the vector starting point along
the horizontal (X axis) in NDC space, before adjustment based
on the value of the vector positioning parameter, VPO.
YB (REAL, output) Location of the vector starting point along
the vertical (Y axis) in NDC space, before adjustment based on
the value of the vector positioning parameter, VPO.
XE (REAL, output) Location of the vector ending point along the
horizontal (X axis) in NDC space, before adjustment based on
the value of the vector positioning parameter, VPO.
YE (REAL, output) Location of the vector ending point along the
vertical (Y axis) in NDC space before adjustment based
on the value of the vector positioning parameter, VPO.
IST (REAL, output) Status of the vector mapping operation: 0
indicates success, negative values indicate that the mapping failed;
positive values are reserved and should not be used by the implementor
of a mapping routine.
4.0 OBSOLETE SUBROUTINES
4.1 EZVEC (U,V,M,N)
EZVEC is a simpler front-end to the VELVCT interface. It may be used
to plot a vector field in a single call.
4.1.1 Usage
U and V are 2-dimensional vector component arrays, whose first
dimensions must be equal to the value of M, and whose second
dimensions must equal or exceed the value of N. Given an appropriate
setting of the compatibility mode parameter, CPM, many of the VELVCT
argument list options are accessible by making calls to
VVSETx routines before invoking EZVEC. When creating new
code, however, users are strongly encouraged to make use of the
VVINIT/VVECTR interface.
4.1.2 Arguments
U (REAL 2-dimensional array, dimensioned M x
n: n >= N, input) By default, assumed to contain
the first-dimensional Cartesian components of the vector
field. However, if PLR is non-zero, it is treated as containing the
vector magnitudes.
V (REAL 2-dimensional array, dimensioned M
xn: n >= N, input) By default, assumed to contain
the second-dimensional Cartesian components of the vector
field. However, if PLR is non-zero, it is treated as containing the
vector angles.
M (INTEGER, input) Actual size of the first dimension of arrays
U and V.
N (INTEGER, input) Assumed size of the second dimension of
arrays U and V.
4.2 FX (X,Y)
Given the X and Y coordinates of a point in the grid coordinate
system, the function FX returns the X coordinate of the point in user
coordinate space.
4.2.1 Usage
The user does not invoke the function, FX, directly. In older versions
of NCAR Graphics, the user modified the functions, FX and FY, in order
to implement custom mappings from grid coordinates to
user coordinates. These functions were used throughout NCAR
Graphics, not just in the Vectors utility. For compatibility
with existing code, calls to any of the Vectors primary entry
points predating Version 3.2 (EZVEC, VELVCT, or VELVEC), by default
use FX and FY to map from grid to user
coordinates. However, by appropriately setting the compatibility mode
parameter, CPM, the user can choose whether the FX and FY functions or
the new VVMPXY routine is invoked when using any of the primary entry
points supported by Vectors.
Unlike the Version 3.2 mapping routine VVMPXY, whose input coordinates
are in the data coordinate system, FX takes input in the
grid coordinate system. Therefore, any required conversions
into the data coordinate system must be performed within the
function prior to the mapping into user coordinates. The
common block VVMAP, available for inclusion within the FX routine,
supplies the information necessary to perform the conversion into
data coordinate space, as well as for the mapping from
data to user coordinates. The default version of FX
simply performs an identity mapping from grid to
user coordinate space.
4.2.2 Arguments
X (REAL, input): The X coordinate of a vector location in the
grid coordinate system.
Y (REAL, input) The Y coordinate of a vector location in the
grid coordinate system.
4.3 FY (X,Y)
Given the X and Y coordinates of a point in the grid coordinate
system, the function FY returns the Y coordinate of the point in user
coordinate space.
4.3.1 Usage
The user does not invoke the function, FY, directly. In older versions
of NCAR Graphics, the user modified the functions, FX and FY, in order
to implement custom mappings from grid coordinates to
user coordinates. These functions were used throughout NCAR
Graphics, not just in the Vectors utility. For compatibility
with existing code, calls to any of the Vectors primary entry
points predating Version 3.2 (EZVEC, VELVCT, or VELVEC), by default
use FX and FY to map from grid to user
coordinates. However, by appropriately setting the compatibility mode
parameter, CPM, the user can choose whether the FX and FY functions or
the new VVMPXY routine is invoked when using any of the primary entry
points supported by Vectors.
Unlike the Version 3.2 mapping routine VVMPXY, whose input coordinates
are in the data coordinate system, FY takes input in the
grid coordinate system. Therefore, any required conversions
into the data coordinate system must be performed within the
function prior to the mapping into user coordinates. The
common block VVMAP, available for inclusion within the FX routine,
supplies the information necessary to perform the conversion into
data coordinate space, as well as for the mapping from
data to user coordinates. The default version of FX
simply performs an identity mapping from grid to user coordinate
space.
4.3.2 Arguments
X (REAL, input): The X coordinate of a vector location in the
grid coordinate system.
Y (REAL, input): The Y coordinate of a vector location in the
grid coordinate system.
4.4 MXF (X,Y,U,V,SFX,SFY,MX,MY)
MXF is a user-modifiable function that, given one endpoint of a vector
in both grid and metacode coordinates, returns the X
coordinate of the other endpoint in the metacode coordinate
system.
4.4.1 Usage
The user does not invoke the function, MXF, directly. However, any
time that the compatibility mode parameter CPM is set such that the FX
and FY routines are used to map the first endpoint of the vector, the
functions MXF and MYF are used to determine the second endpoint. First
FX and FY are invoked to determine the vector location in user
coordinates, then this point is converted into metacode
coordinates; MXF is passed the coordinates of the point both in
grid space and in metacode space, along with the
vector components and a scale factor used to convert the vector
magnitude into a length in the metacode coordinate
system.
If the mapping from data to user and from user to
metacode coordinates is linear MXF is not hard to use: the
default version simply multiplies the U component of the vector (the
component parallel to the X grid axis) by the scale factor, SFX, and
adds it to the X coordinate of the first point in metacode
coordinates, MX. This value is returned as the function
value. However, if the mapping is anywhere non-linear, the vector
directional angle may change across the transformation, and an
iterative differential technique must be employed to map the second
endpoint of the vector. If creating a new mapping, the user is
strongly urged to use the user-modifiable routine VVUMXY, rather than
attempting to work with MXF and MYF.
4.4.2 Arguments
X (REAL, input): The X coordinate of a vector location in the
grid coordinate system.
Y (REAL, input) The Y coordinate of a vector location in the
grid coordinate system.
U (REAL, input) The U component of the vector at the data point
specified by arguments X and Y.
V (REAL, input) The V component of the vector at the data point
specified by arguments X and Y.
SFX (REAL, input) Scale factor used to convert the vector
magnitude to a length in metacode coordinates.
SFY (REAL, input) Scale factor used to convert the vector
magnitude to a length in metacode coordinates. In the current
implementation this value is the same as the value of SFX.
MX (INTEGER, input) X coordinate of the vector location in
metacode coordinates.
MY (INTEGER, input) Y coordinate of the vector location of the
vector in metacode coordinates.
4.5 MYF (X,Y,U,V,SFX,SFY,MX,MY)
MXF is a user-modifiable function that, given one endpoint of a vector
in both grid and metacode coordinates, returns the X
coordinate of the other endpoint in the metacode coordinate
system.
4.5.1 Usage
The user does not invoke the function, MYF, directly. However, any
time that the compatibility mode parameter CPM is set such that the FX
and FY routines are used to map the first endpoint of the vector, the
functions MXF and MYF are used to determine the second endpoint. First
FX and FY are invoked to determine the vector location in user
coordinates, then this point is converted into metacode
coordinates; MYF is passed the coordinates of the point both in
grid space and in metacode space, along with the
vector components and a scale factor used to convert the vector
magnitude into a length in the metacode coordinate
system.
If the mapping from data to user and from user to
metacode coordinates is linear MYF is not hard to use: the
default version simply multiplies the V component of the vector (the
component parallel to the Y grid axis) by the scale factor, SFY, and
adds it to the Y coordinate of the first point in metacode
coordinates, MY. This value is returned as the function
value. However, if the mapping is anywhere non-linear, the vector
directional angle may change across the transformation, and an
iterative differential technique must be employed to map the second
endpoint of the vector. If creating a new mapping, the user is
strongly urged to use the user-modifiable routine VVUMXY, rather than
attempting to work with MXF and MYF.
4.5.2 Arguments
X (REAL, input): The X coordinate of a data point in the
grid coordinate system.
Y (REAL, input) The Y coordinate of a data point in the
grid coordinate system.
U (REAL, input) The U component of the vector at the data point
specified by arguments X and Y.
V (REAL, input) The V component of the vector at the data point
specified by arguments X and Y.
SFX (REAL, input) Scale factor used to convert the vector
magnitude to a length in metacode coordinates.
SFY (REAL, input) Scale factor used to convert the vector
magnitude to a length in metacode coordinates. In the current
implementation this value is the same as the value of SFX.
MX (INTEGER, output) X coordinate of the vector location in
metacode coordinates.
MY (INTEGER, output) Y coordinate of the vector location in
metacode coordinates.
4.6 VELVCT (U,LU,V,LV,M,N,FLO,HI,NSET,LENGTH,ISPV,SPV)
VELVCT plots a vector field, given two 2-dimensional vector component
arrays, U and V. Certain characteristics of the plot may be controlled
by adjusting the values given to the input arguments. Other less
frequently changed characteristics may be affected by modifying
VELDAT, the BLOCK DATA routine that initializes members of the common
blocks VEC1 and VEC2. In addition, depending on the value given to the
compatibility parameter, CPM, many options may be controlled by
setting internal parameters using VVSETx routines.
4.6.1 Usage
Beginning with version 3.2 of NCAR Graphics, the VELVCT entry point
has been recoded as a front end to the VVINIT/VVECTR interface to
Vectors. The compatibility mode parameter, CPM, controls the degree to
which a call to the Version 3.2 VELVCT emulates the older
call. Appropriate settings of CPM can separately answer each the
following three questions regarding the level of emulation:
- Should FX, FY, MXF, and MYF rather than VVMPXY perform the mapping
to user coordinates?
- Should the input arguments FLO, HI, NSET, LENGTH, ISPV, SPV
override the current values of the corresponding Vectors'
internal parameters?
- Should the values contained in the common blocks VEC1 and VEC2
override the current values of corresponding Vectors' internal
parameters?
Given the default value of CPM, all these questions are answered in
the affirmative, and a call to VELVCT gives a reasonably faithful
emulation of the older version's behavior. However, even in this case,
it is possible to use the parameter-setting routines to control the
behavior of features that have no counterpart in the older version of
VELVCT, as long as the feature is accessible without calling the new
interface. For instance, you could control the vector linewidth by
setting the LWD parameter, although you could not draw vectors masked
to an area map because doing so requires direct invocation of VVECTR
with the proper input arguments.
The following two tables show how the VELVCT input arguments and
VEC1/VEC2 common block members map into internal parameters currently
supported by Vectors:
| Input Argument | Internal Parameter |
| FLO | VLC (VLC is set to -FLO if FLO is positive, 0.0 otherwise) |
| HI | VHC (VHC is set to -HI if HI is positive, 0.0 otherwise) |
| NSET | SET (NSET = 0 is approximately equivalent to SET = 1) |
| LENGTH | VRL (LENGTH in Plotter Address Units is converted to VRL
as a fraction of the viewport width) |
| ISPV | SVF |
| SPV(1) | USV |
| SPV(2) | VSV |
| Common Block Member | Internal Parameter |
| EXT | VPS |
| ICTRFG | VPO |
| ILAB | LBL |
| IOFFD | DPF |
| RMN | AMN (RMN in metacode coordinates is converted to AMN
as a fraction of the viewport width) |
| RMX | AMX (RMX in metacode coordinates is converted to
AMX as a fraction of the viewport width) |
| SIZE | LBS (Character size in metacode coordinates is converted
to LBS as a fraction of viewport width.) |
| INCX | XIN |
| INCY | YIN |
| | MNT (When common blocks VEC1 and VEC2 override parameter
settings, MNT is always set to ' ', indicating that the minimum vector
text block is not to be displayed.) |
| IOFFM | MXT (If IOFFM is non-zero, MXT is set to ' '. indicating
that the maximum text block is not to be displayed. Otherwise MXT is
set to the string 'MAXIMUM VECTOR' |
| IOFFM | MXX (If IOFFM is 0, MXX is set to a computed value that,
as a fraction of the viewport width, specifies a point 0.05 in NDC
left of the right hand edge of the plotter frame.) |
| IOFFM | MXY (If IOFFM is 0, MXY is set to a computed value that,
as a fraction of the viewport height, specifies a point 0.005 in NDC
up from the bottom edge of the plotter frame.) |
| IOFFM | MXP (If IOFFM is 0, MXP is set to -2, indicating that the
text block should be lower-right justified. |
Note that the emulation of the maximum vector text block differs from
the older implementation in that it now uses high-quality text.
4.6.2 Arguments
U (REAL 2-dimensional array, dimensioned LU x
n: n >= N, input): By default, assumed to
contain the first-dimensional Cartesian components of the vector
field. However, if PLR is non-zero, it is treated as containing the
vector magnitudes.
LU (INTEGER, input): Actual value of the first dimension of
array U.
V (REAL 2-dimensional array, dimensioned LV x
n: n >= N, input): By default, assumed to contain
the second-dimensional Cartesian components of the vector
field. However, if PLR is non-zero, it is treated as containing the
vector angles.
LV (INTEGER, input): Actual value of the first dimension of
array V.
M (INTEGER, input): Number of contiguous elements along the
first dimensional axis containing data to be processed in each of the
arrays, U and V.
N (INTEGER, input): Number of contiguous elements along the
second dimensional axis containing data to be processed in each of the
arrays, U and V.
FLO (REAL, input) Minimum vector magnitude allowed to be
displayed in the plot.
HI (REAL, input) Maximum vector magnitude allowed to be
displayed in the plot. If set to 0.0 there is no upper limit
imposed.
NSET (INTEGER, input) Flag that controls how and when the SET
call is invoked. If NSET is 0, VELVCT establishes the viewport and the
window to properly scale plotting instructions to the standard
configuration. PERIM is called to draw a border. If NSET is greater
than zero, VELVCT assumes that the user has established the window and
viewport in such a way as to properly scale the plotting instructions
generated by VELVCT. PERIM is not called. If NSET is less than zero,
VELVCT places the contour plot within the limits of the user's current
window and viewport. PERIM is not called.
LENGTH (INTEGER, input) The length in plotter address units
(PAUs) used to render the vector with the greatest magnitude that is
eligible for plotting. A vector is eligible for plotting if it is less
than or equal to the value of HI, unless HI is 0.0 in which case all
vectors are eligible. If LENGTH is set to 0.0, the length selected is
one half the diagonal length of a grid cell assuming a linear mapping
of the grid coordinate space into the viewport.
ISPV (INTEGER, input) Flag to control the special value
feature. 0 means that the feature is not in use. 1 means that if the
value of U(I,J)=SPV(1) the vector will not be plotted. 2 means that if
the value of V(I,J)=SPV(2) the vector will not be plotted. 3 means
that if either U(I,J)=SPV(1) or V(I,J)=SPV(2) then the vector will not
be plotted. 4 means that if U(I,J)=SPV(1) and V(I,J)=SPV(2), the
vector will not be plotted.
SPV (REAL array, dimensioned 2, input) An array of length 2
which gives the value in the U array and the value in the V array
which denote special values. This argument is ignored if ISPV=0. The
default values are 1.0E12.
4.7 VELVEC (U,LU,V,LV,M,N,FLO,HI,NSET,ISPV,SPV)
The VELVEC call is identical to the VELVCT call except that there is
no LENGTH parameter to allow adjustment of the realized length of the
maximum vector magnitude.
4.7.1 Usage
VELVEC is used identically to VELVCT except that there is no provision
for adjusting the realized length of the maximum vector magnitude.
4.7.2 Arguments
The arguments to VELVEC are identical in use to the corresponding
arguments in the VELVCT call.
5.0 PARAMETERS
The behavior of Vectors is controlled by parameters stored in
internal common blocks accessible to its routines that require access
to them.
5.1 Parameter Names
Each of the parameters of Vectors is identified by a
three-character mnemonic name. For example, NLV is the name of the
parameter specifying the number of colors and threshold levels used to
color the vector field and MSK is the name of a parameter used as a
flag to allow the user to specify that the vectors are or are not to
be drawn masked to an area map.
5.2 Parameter Types
Each parameter is intrinsically of type CHARACTER, INTEGER, or REAL,
but the type of the parameter is not implied by the form of its name;
one must read the description of the parameter to determine its
type.
5.3 Parameter Defaults
Each parameter has a default value which is intended to yield a
reasonable, useful, default behavior. To modify the behavior of
Vectors routines, one changes the values of the appropriate
parameters at the appropriate time.
5.4 Parameter Access
The value of a parameter may be set using one of the three routines
VVSETC, VVSETI, and VVSETR. Each of these routines has as its first
argument a character string beginning with the three-character name of
the parameter and as its second argument an expression of the type
implied by the last character of the routine name ("C" for
"CHARACTER", "I" for "INTEGER", or "R" for "REAL"). Similarly, the
current value of a parameter may be retrieved using one of the three
routines VVGETC, VVGETI, and VVGETR, each of which has as its first
argument the name of the parameter and as its second argument a
variable of the type implied by the last character of the routine
name.
In general, once a parameter is given a particular value, it retains
that value until it is given a new value by the user. However, a
number of parameters are read-only to the user meaning that their
values may be retrieved by the VVGETx routines but an attempt
to set them using the VVSETx routines will result in an error. These
parameters are intended to provide the user with useful information
about the state of the program that may be helpful in determining how
to perform the next operation.
5.5 Parameter-Name Arguments
Only the first three characters of the parameter-name argument in
calls to the parameter access routines are examined. The user is
encouraged to add additional text in order to make the code more
understandable. For example, a call to set the number of color
threshold levels might read
CALL VVSETI ('NLV - Number of Threshold Levels',13)
Note that since the dimension of the parameter name variable is
defined as 'CHARACTER*(*)', there is no limit to the number of
characters used to comment the call.
5.6 Automatic Type Conversion
Normally, one would use VVSETI to set parameters of type INTEGER and
VVSETR to set parameters of type REAL. However, since automatic
conversion is done as necessary, this need not be the case. One could,
for example, use either of the two statements
CALL VVSETI ('USV - U Array Special Value',-9999)
CALL VVSETR ('USV - U Array Special Value',-9999.0)
to set the U array special value (which is intrinsically REAL) to
-9999.0. The first has the virtue of being two characters
shorter. Similarly, one could use either of the two statements
CALL VVSETI ('CTV - Color Threshold Levels',18)
CALL VVSETR ('CTV - Color Threshold Levels',18.)
to set the number of contour levels (which is intrinsically INTEGER)
to 18. (In this case, of course, the first of the two statements seems
to make better sense.) If a REAL parameter is to be given a
non-integral value (like 3.14159), then VVSETR must be used, of
course. Note that the argument passing rules of FORTRAN must still be
respected: an INTEGER argument passed to VVSETR will have the usual
"undefined" results.
5.7 Automatic Restriction of Parameter Values
Some parameters may take on any possible value of the proper
type. Others are restricted to a certain range. In some cases,
out-of-range parameters are simply constrained to some value within
the range. In other cases, where it seems dangerous to second-guess
what the user has in mind, an error is returned and the program
halts.
5.8 Parameter Arrays
Some of the parameters are actually arrays. For example, the parameter
CLR, which specifies a color index for each color threshold level, is
actually an array dimensioned to the value of the FORTRAN PARAMETER,
'IPLVLS', currently set to a value of 255. In order to access the Ith
element of such a parameter array, one must somehow specify the value
of the index I. This is done by creating one parameter, named PAI, to
serve as a "parameter array index". Thus, to set the color index of
the tenth threshold level to 12, one would use the following code:
CALL VVSETI ('PAI - Parameter Array Index',10)
CALL VVSETR ('CLR - Color Index',12)
5.9 Parameters Categorized
This section contains a list of all Vectors parameters
categorized by function along with a short descriptive phrase. It also
notes which of the categories may safely be set in between the call to
VVINIT and VVECTR. The section following is an alphabetical listing of
all parameters including a detailed description.
5.9.1 Global Control Parameters
These parameters provide miscellaneous global control of the
Vectors utility.
- PAI - Parameter Array Index - Integer
- CPM - Compatibility Mode - Integer
5.9.2 Coordinate System Control
These parameters (along with the mapping subroutine, VVMPXY or VVUMXY)
establish the mapping through a series of coordinate systems starting
with the array indices that define the basic grid and ending with the
Normalized Device Coordinates. Any non-default values must be set
prior to calling VVINIT.
- SET - SET Call Flag - Integer
- XIN - X Axis Array Increment (Grid) - Integer
- YIN - Y Axis Array Increment (Grid) - Integer
- XC1 - X Coordinate Value at Array Index 1 (World) - Real
- XCM - X Coordinate Value at Array Index M (World) - Real
- YC1 - Y Coordinate Value at Array Index 1 (World) - Real
- YCN - Y Coordinate Value at Array Index N (World) - Real
- WDL - Window Left Boundary (User) - Real
- WDR - Window Right Boundary (User) - Real
- WDB - Window Bottom Boundary (User) - Real
- WDT - Window Top Boundary (User) - Real
- VPL - Viewport Left Boundary (NDC or Fractional) - Real
- VPR - Viewport Right Boundary (NDC or Fractional) - Real
- VPB - Viewport Bottom Boundary (NDC or Fractional) - Real
- VPT - Viewport Top Boundary (NDC or Fractional) - Real
- VPS - Viewport Shape - Integer
- MAP - Map Transformation Code - Integer
- TRT - Transformation Type - Integer
5.9.3 Input Data Control
These parameters control the interpretation of the input data, and
allow the user to place restrictions on the range of data
represented. Any non-default values must be set prior to calling
VVINIT.
- SVF - Special Value Flag - Integer
- USV - U Array Special Value - Real
- VSV - V Array Special Value - Real
- PSV - P Array Special Value - Real
- SPC - Special Color - Integer
- PLR - Polar Input Mode - Integer
5.9.4 Color Control
These parameters are used to control the set up of the color threshold
array and the color index array. If CTV has a positive value, VVINIT
modifies NLV members of the TVL threshold array. Otherwise, these
parameters may be set between the call to VVINIT and VVECTR.
- CTV - Color Threshold Value Control - Integer
- NLV - Number of Color Levels - Integer
- CLR - Array of GKS Color Indices - Integer Array
- TVL - Array of Threshold Values - Real Array
5.9.5 Rendering Control
These parameters allow the user to make various adjustments to the
rendering of the vector field plot. Parameters in this category may be
set between the call to VVINIT and VVECTR. A number of parameters have
an effect only for a specific arrow style (line-drawn, filled or wind barb).
- MSK - Mask To Area Map Flag - Integer
- VRL - Vector Reference Length - Real
- VFR - Minimum Vector Fractional Length - Real
- VRM - Vector Reference Magnitude - Real
- VLC - Vector Low Cutoff Value - Real
- VHC - Vector High Cutoff Value - Real
- LWD - Vector Linewidth - Real
- VPO - Vector Positioning Mode - Integer
- AST - Arrow Style - Integer
- AMN - Arrow Head Minimum Size (line-drawn arrows only) - Real
- AMX - Arrow Head Maximum Size (line-drawn arrows only) - Real
- ACM - Arrow Color Mode (filled arrows only) - Integer
- AFO - Arrow Fill Over Arrow Lines (filled arrows only) - Integer
- AIR - Arrow Interior Reference Fraction (filled arrows only) - Real
- AWF - Arrow Width Fractional Minimum (filled arrows only) - Real
- AWR - Arrow Width Reference Fraction (filled arrows only) - Real
- AXF - Arrow X-Coord Fractional Minimum (filled arrows only) - Real
- AXR - Arrow X-Coord Reference Fraction (filled arrows only) - Real
- AYF - Arrow Y-Coord Fractional Minimum (filled arrows only) - Real
- AYR - Arrow Y-Coord Reference Fraction (filled arrows only) - Real
- WBA - Wind Barb Angle (wind barbs only) - Real
- WBC - Wind Barb Calm Circle Size (wind barbs only) - Real
- WBD - Wind Barb Distance Between Ticks (wind barbs only) - Real
- WBS - Wind Barb Scale Factor (wind barbs only) - Real
- WBT - Wind Barb Tick Size (wind barbs only) - Real
5.9.6 Supplementary Text Control Parameters
These parameters control the placement and appearance of various text
elements associated with a vector field plot produced by
Vectors. Parameters in this category may be set between the
call to VVINIT and VVECTR.
- LBL - Vector Label Flag - Integer
- DPF - Vector Label Decimal Point Control Flag - Integer
- LBS - Vector Label Character Size - Real
- LBC - Vector Label Color - Integer
- MNS - Minimum Vector Text Block Character Size - Real
- MNX - Minimum Vector Text Block X Coordinate - Real
- MNY - Minimum Vector Text Block Y Coordinate - Real
- MNP - Minimum Vector Text Block Positioning Mode - Integer
- MNC - Minimum Vector Text Block Color - Integer
- MNT - Minimum Vector Text String - Character* 36
- MXS - Maximum Vector Text Block Character Size - Real
- MXX - Maximum Vector Text Block X Coordinate - Real
- MXY - Maximum Vector Text Block Y Coordinate - Real
- MXP - Maximum Vector Text Block Positioning Mode - Integer
- MXC - Maximum Vector Text Block Color - Integer
- MXT - Maximum Vector Text String - Character* 36
- ZFS - Zero Field Text Block Character Size - Real
- ZFX - Zero Field Text Block X Coordinate - Real
- ZFY - Zero Field Text Block Y Coordinate - Real
- ZFP - Zero Field Text Block Positioning Mode - Integer
- ZFC - Zero Field Text Block Color - Integer
- ZFT - Zero Field Text String - Character* 36
- VST - Vector Statistics Output Flag
5.9.7 Read-Only Informational Parameters
These parameters may be used to retrieve information about the state
of the Vectors utility. The may be retrieved at any time, but
may not contain useful information at all stages of the processing.
- VMN - Minimum Displayed Vector Magnitude - Real
- VMX - Maximum Displayed Vector Magnitude - Real
- DMN - Minimum Vector Size (NDC) - Real
- DMX - Maximum Vector Size (NDC) - Real
- PMN - Minimum Scalar Array Value - Real
- PMX - Maximum Scalar Array Value - Real
5.10 Parameter Description
Parameter descriptions follow, in alphabetical order. Each description
begins with a line giving the three-character mnemonic name of the
parameter, the phrase for which the mnemonic stands, the intrinsic
type of the parameter, and an indication of whether or not it is an
array.
5.10.1 ACM - Arrow Color Mode -
Integer
ACM controls how color is applied to filled vector arrows. It applies
only when AST has the value 1. Its behavior also
depends on the setting of the parameter CTV. Assuming that CTV is set
to a non-zero value, implying that multi-colored vectors are desired,
ACM has the following settings:
| Value | Effect |
| -2 | Multi-colored fill; outline off |
| -1 | Fill off; multi-colored outline |
| 0 (default) | Multi-colored fill; mono-colored outline |
| 1 | Mono-colored fill; multi-colored outline |
| 2 | Multi-colored fill; multi-colored outline |
Mono-colored outlines use the current GKS polyline color
index. Mono-colored fill uses the current GKS fill color index. When
CTV is set to 0, both the fill and the outlines become mono-colored,
and therefore only modes -2, -1, and 0 remain distinguishable. The
default value is 0.
5.10.2 AFO - Arrow Interior Reference Fraction - Real
If AFO is set to 1, the perimeter outline of a filled vector arrow is
drawn first, underneath the fill. In this case, you must set the line
thickness parameter (LWD) to a value greater than unity in order for
the line to appear completely. The advantage of drawing the line
underneath is that the full extent of the fill appears, resulting in a
crisper, more sharply defined arrow; when the line is drawn on top of
the fill using a different color index, the fill color may be
partially or completely obscured, especially for small vector
arrows. AFO has an effect only when the parameter AST is set to 1.
The default value of AFO is 1.
5.10.3 AIR - Arrow Interior Reference Fraction - Real
AIR specifies the distance from the point of the arrowhead of a filled
vector arrow drawn at the reference length to the point where the
arrowhead joins with the line extending to the tail of the
arrow. Its value represents a fraction of the reference length. This
distance is adjusted proportionally to the X component of the
arrowhead size for vector arrows whose length