Algorithmic display tool
What the tool is and how to invoke it
This module discusses a tool for displaying various features of
the Natgrid algorithm. This tool is available only with the
NCAR Graphics
distribution.
The tool is an executable
called "nnalg". If you are using
NCAR Graphics and have properly set NCARG_ROOT, "nnalg" will
be in your search path.
"nnalg" takes a single argument which is the name of a special
file created by the Fortran subroutine
NATGRIDS
or the C function c_natgrids. This
file contains data appropriate for displaying various features of the
Natgrid algorithm. By default, this file is not created. In
order to create it, you need to set the value of the control parameter
adf to 1. You can additionally
override the
default file name of "nnalg.dat" by using the parameter
alg.
Example 8 shows an example of how
to create a data file with a user-specified name.
To invoke "nnalg", simply type the command:
nnalg data_file
where "data_file" is a file that has been created by
the Fortran subroutine NATGRIDS
or the C function c_natgrids.
By editing the data file, you have many options for what is displayed
and how the plot appears. All of these options
are discussed below.
What can be displayed
The features that can be displayed are:
- The input data points
- The
natural neighbor circumcircles
and their centers
- The Delaunay
triangulation, derived from the natural neighbor circumcircles
- The Voronoi polygons
- The first order
natural neighbors of a given input point (or points)
- The second
order natural neighbors of a given input point (or points)
The first four items in the above list are displayed in the default
case. The plot in Example 8
illustrates plotting these four items.
Note that there is a very interesting relationship between the natural
neighbor circumcircles, the Delaunay triangulation, and the Voronoi
polygons: the aggregate of the triangles created within each
circumcircle form a Delaunay
triangulation; lines connecting the circumcircle centers that are
perpendicular to the edges in the Delaunay triangulation form the
Voronoi polygons.
Where the plot will be displayed
Using the file example8.dat for reference,
the first non-comment line in the
integer flags section controls where the output will be dispatched
upon executing nnalg example8.dat. By default the plot will
be displayed in an X11 window that is created at execution time. The
other choices you have are producing an NCAR CGM file (with name
"gmeta"), or a PostScript file (with name "gmeta1.ps").
The integer flags section of
example8.dat controls what gets plotted.
The comments there are intended to be self-explanatory.
The pseudo data
are internally calculated as extreme points that lie on a
least-squares plane
fitted to the original data. The pseudo data points are used for
extrapolation. If you choose to
display them, what you will usually get is the interesting part of the
plot squeezed into a tiny area with only the pseudo points being
meaningfully displayed.
The color information section
of example8.dat allows you to assign colors
to various plot components, as described.
The scale factors section
of example8.dat allows you to scale various
aspects of the plot, as described.
Changing the plot view window
The user coordinate specification section
of example8.dat allows you to change what part
of the plot you want to look at. The default setting of all zeros tells
nnalg to compute data minimums and maximums and look at an area slightly
larger than that.
In the non-default case,
the four numbers in the user coordinate specification
line control what part of the plot you want to look at. The numbers
specify, in user coordinates, the minimum X coordinate value, the maximum
X coordinate value, the minimum Y coordinate value, and the maximum Y
coordinate value, respectively, of the viewing window. If any single
value is changed, then no default applies and all four values will be used
to determine the extent of the viewing area.
Plotting first and second
order natural neighbors
Sometimes it is of interest to see what input data points are
being used to calculate an interpolated value. These points are
the natural neighbors. This could shed light
on why an interpolated value might appear to be different from what is
expected. This is particularly important for interpolated values near the
convex hull of a dataset
where the convex hull differs significantly from
the bounding polygon.
Example 9 takes
you through a sequence of plots illustrating the
plotting of first and second order natural neighbors.
home |
contents |
defs |
params |
procedures |
exmpls |
index