Contour plotting on a non-rectangular grid

Contour plotting on a non-rectangular grid

Post by Troy A Ba » Wed, 14 Apr 1993 07:19:42

I'm trying to generate contour plots of Mach number and pressure
distribution around an airfoil.  The problem is that the grid at which
the points are defined is not rectangular.  In other words, I've got
an output file of the form:

X(1,1) Y(1,1) M(1,1)
X(1,2) Y(1,2) M(1,2)
X(i,j) Y(i,j) M(i,j)
X(imax,jmax) Y(imax,jmax) M(imax,jmax)

Does anyone know of either A) a PC based program that will do this (at
this point, it doesn't matter if it's PD, shareware, or commercial), or
B) an algorithm that will do this and can be implemented in Fortran 77
with GKS?

Any and all help is greatly appreciated.  Please respond via email
and I will post a summary if there's enough interest.  Thanks.

| Troy A. Baer       | "Too much love will kill you,                |

|    |  It'll drain the power that's in you,        |

|         |  And the pain will drive you crazy,          |
+--------------------+  You're the victim of your crime."           |
| What opinions?     |  -- Brian May, "Too Much Love Will Kill You" |
| Engineer's maxim:  When in doubt, get a bigger hammer. | For rent |


Contour plotting on a non-rectangular grid

Post by Len Mak » Wed, 14 Apr 1993 12:29:05

In article <>, (Troy A Baer) writes:
Hi Troy,
|> I'm trying to generate contour plots of Mach number and pressure
|> distribution around an airfoil.  The problem is that the grid at which
|> the points are defined is not rectangular.
|> Does anyone know of either A) a PC based program that will do this (at
|> this point, it doesn't matter if it's PD, shareware, or commercial), or
|> B) an algorithm that will do this and can be implemented in Fortran 77
|> with GKS?
I had a similar problem last year. At the time, I was asked, but "forgot" :{
to post any useful references. Most were in fact posted to the newsgroup,
but here goes (LONG).
 For general reference, I am aware of
        Burrough P.A. "Principles of Geographical Information Systems
 for Land Resources Assessment", Clarendon Press,Oxford(1986)
        Clarke K.C. "Analytical and Computer Cartography",
 Prentice-Hall (1990).               | Manager, User Support        |
CSIRO Division of Information Technology | CSIRO Supercomputing Facility|
723 Swanston Street, Carlton             | Tel: +61 3 282 2622          |
VIC 3053, Australia                      | Fax: +61 3 282 2600          |

Here are some better references to "how to do it" from the replies
 I received then:
Subject: Gridding algorithms - expreriences

Here is some information about gridding algorithms. Background for this is
a M.Sc. thesis made here in 1985 by Tuire Valli. She is currently working
at the Geological Survey of Finland, Espoo, Finland. Her results are
shortly and partly summarised as follows.

1. Kriging methods are theoretically superior, but working with real
aeromagnetic data gave disappointing results: the method is extremely
laborous and slow for big amounts of data and requires two phases: first,
estimation of the semivariogram from the input data, and second, estimation
of the grid values. If the input data has regional trends, the
semivariogram must be computed separately for each sub-area, which alone
makes the idea impractical. The sw code used was from Uniras company
(Denmark) and, to put it mildly, had some plenty of bugs (e.g. the trend
option didn't work at all).

2. If you have possibility to include gradient information of the data into
the interpolation algorithm, then the outcome will be much improved. This
is the case for our aeromagnetic data and hence, an interpolation method
which utilizes both the field and the derivative values (F, dF/dx and dF/dy
for every obsevation point) gave the best results for our real-life data.
The method is advantageous as the trends are automatically taken into
account through the derivative information. As far as I know, the method
has not yet been properly documented in English; the best source would be
the thesis. The method has been under development at the Geol Survey of
Finland since mid-70's, first by Mr. Juha Korhonen, geophysicist at the

3. By far the best results for synthetic test data were reached using the
smoothing spline -technique, developed at the Univ of Wisconsin-Madison,
Dept of Statistics since mid-70's. The idea is to take care of the errors
of your original data by allowing a user-selectable amount of smoothing to
be done before the application of the splines. The method works fine, but
the software would need upgrading and further testing for our own needs.
That was the reason to use synthetic and not the real data for testing. It
was Tuire's (and my as well) idea to continue work on this after her
graduation, but not much has been been accomplished since.

The run times for 10,000 points of input data were:
        Kriging 30 minutes CPU-time on VAX-785;
        gradient interpolation about 1.6 minutes on the same computer, and
        smoothing spline about 3 minutes on VAX-8600.

References (only to get you started if you find these relevant)

Clarc,I., 1979: Practical Geostatistics. Applied Sci Publ Ltd, England.

Haas & Viallix, 1976: Krigeage applied to geophysics. Geophysical
Prospecting Vol 24 pp 49-69.

Journel & Huijbregts, 1978:  Mining Geostatistics. Academic Press, London.

Reinsch, C.H., 1967: Smoothing by spline functions. Numerische Mathematik
Vol 10 pp 177-183

Reinsch, C.H., 1970: Smoothing by spline functions II. Numerische
Mathematik Vol 16 pp 451-454.

Valli, T., 1985: Estimation of magnetic field between flight lines. M.Sc.
thesis, Helsinki Univ of Technology, Lab of Engineering Geology and
Geophysics, Espoo, Finland. 76 p + app (in Finnish).

Wabha, G., 1979: How to smooth curves and surfaces with splines and
cross-validation. Tech Rep No 555, Univ of Wisconsin-Madison, Dept of

Wendelberger, J.G., 1981: The computation of Laplacian Smoothing Splines
with Examples. Tech Rep No 648, Univ of Wisconsin-Madison, Dept of

Good Luck!
Markku Peltoniemi
Helsinki Univ of Technology

From: (Chris Skelly)
Subject: gridding

offhand I can recommend two good reference books, none specific
to your problem although they might touch on them somewhat,

Ripley, Brian 1981, Spatial Statistics (or something very close
                                        to this)
Cressie, Noel, 1991, Statistics for spatial data analysis
   (again I'm not positive about the title, but I know its
     Wiley and Sons)

From: (Wes Bethel)
Subject: Gridding

>Help! Does anyone know of a good gridding program on the network (ie.
>anonamous ftp'able). Or is there a gridder burried in Khoros somewhere?

I have written several gridding modules for AVS.  These are available
via anon ftp from  The module names are "bivar", "trivar",
"scat 2d" and "scat 3d".    The four modules may be classified as
performing either 2 or 3 variable gridding (surfaces or volumes), and as
distance-based or function-based.  Each has its strengths and weaknesses.
These modules have been used a lot here to do exactly the type of work
you indicate you need to do.
You are certainly welcome to ftp these and hack them into Khoros.

Another option is to poke around at netlib (  The
function-based numerical code that I use was obtained from netlib and
ported into AVS.  You may find other stuff there that you like.

A final option is to wait for yet another user-supplied toolbox which will
accompany Khoros 2 and the geometry functionality.
The algorithms which will be available in K2 will do the
numerical-based gridding for two- and three-variable
functions as well as weighted-averages of nearby points,
also for two- and three-variable datasets.

Subject: Gridding algorithms

It would be interested for you to contact Oleg Musin in Moscow, Russia.
His group developed software, including a few approaches, for
calculating on regular x,y grid z-values. They told me that this is
most powerfull package for this kind of tasks. You can contact them
by e-mail. Their address is
internet!!uucp!!musin and fax
(095) 939-4407.
Michail Bogdanov
Oklahoma City, USA!owusa


In article <>, (David Watson) writes:

|> Briggs, I.C., 1974, Machine contouring using minimum curvature:
|> Geophysics, v.39, no.1, p. 39-48.
|> The methods described in this paper and over 500 other contouring
|> articles are discussed in "CONTOURING: A guide to the analysis and
|> display of spatial data", by David F Watson.(Pergamon Press 1992).  
|> It surveys, and categorizes, all (I think) published methods of
|> interpolation and surface fitting, and includes code for 18
|> interpolation methods.
----------------- cut line --------------------------
% \nopagenumbers
\vskip 1.5pc
\vskip 6pt
Akima, H., 1978, A method of bivariate interpolation and smooth surface fitting for irregularly distributed data points, ACM Trans.\ Math.\ Software, 4(2), \hbox{148--159.}

Bourke, P.D., 1987, A contouring subroutine, Byte, 12, \hbox{143--150.}

Cayley, A., 1859, On contour and slope lines, Philosophical Magazine, 18, \hbox{264--268.}

Foley, T.A., 1984, Three-stage interpolation to scattered data, Rocky Mountain J.\ Math., 14(1),

Panofsky, H.A., 1949, Objective weather-map analysis, J.\ Meteorology, 6, \hbox{386--392.}

Sawkar, D.G., Shevare, G.R., and Koruthu, S.P., 1987, Contour plotting for scattered data, Computers \& Graphics, 11(2), \hbox{101--104.}

Sibson, R., 1981, A brief description of natural neighbour interpolation, {\sevenit in} Interpreting multivariate data, {\sevenit ed}.\ V.\ Barnett, John Wiley, \hbox{21--36.}

Simons, S.L.Jr., 1983, Make fast and simple plots on a microcomputer, Byte, 8, \hbox{487--492.}

Watson, D.F., 1982, ACORD---Automatic contouring of raw data, Computers \& Geosciences, 8(1), \hbox{97--101.}

Watson, D.F., 1985, Natural neighbour sorting, The Australian Computer J., 17(4), \hbox{189--193.}

\noindent ...

read more »


Contour plotting on a non-rectangular grid

Post by GJDEM.. » Thu, 06 May 1993 01:53:38

 I am new to this system so please bear with me.  I am looking for some help in
 finding and setting up an FTP site to store GIF files of photos.  If you can b

can fill you in on the detail then.  Thanks.

   Greg Demetrick
    Syracuse University


1. Clip contours of rectangular grid or contour non-rectangular grid?

I am developing an application which will generate contours using a
set of x,y,z data (f(x,y) = z). There are design constraints, which
limit the valid x and y values so the region, which will contain
contours, is a non-rectangular sub-region (this region will have
curved and straight sides). I have two approaches to solving this

1. Define a rectangular grid of values, which completely encompass the
valid region (calculating values outside the valid region is not a
problem). Then clip the contours to fit within the valid region.

2. Calculate x,y,z data which is only within the valid region and
contour this data grid. The number of x values would vary depending on
the value of y.

The first option allows the use of almost any contour package but has
the added overhead of clipping the contours to fit the desired region.

The second option would require a special contour program design to
work with a very non-rectangular grid. In addition, it is not clear
how well the contour program could generate the contours close to the
constraint boundaries since it will only have data on one side of the

How do the professionals solve this problem. Any recommendations would
greatly be appreciated.


John Chauvin

2. Has Apple Lost the 3D Market

3. contour plot of non-rectangular ordering of data points

4. HELP - 3D Stock Model Advice Needed

5. Surface/contour plot in a non uniform x-y grid

6. Any Experience with ALPS Printer/Scanner Combo?

7. contouring of random/non-uniform grids to uniform grids

8. feather-expand question

9. Contours over a non-uniformly spaced grid in 2-D/FEM

10. splot-error: cannot contour non grid data!

11. Need to do contour plotting of irregular grid data

12. contour plot and grid data missing some points

13. contour plotting of non-uniform data (or randomly scattered data)