Curtis Cooper writes:
My research is in computational fluid dynamics (specifically, the
meteorologies of planetary atmospheres). Working contour and vector plots
in matplotlib would make it possible for me to make 2D meteorological maps
of atmospheric layers, etc.
I noticed for the first time in the goals page that contour plots are
being worked on, apparently by STSci. I have been considering
implementing these two plot types as sets of line collections, but now
that I know contour plots are being worked on, and vector plots are
simpler to implement (in 2D), I will work on making vector plots. The
mathematics is fairly straightforward. I just need to learn how to use
the class library.
About contour plots, however, I have a couple of questions. How is it
being implemented? I was about to try to write a marching squares
contouring routine, although it might have been painfully slow in Python.
Does anyone have experience with this?
We are trying to adapt the C contour program that is used by gist
(and can be found in the contour routine used by xplt in scipy).
It would be best to look at the source for the precise description
of the algorithm it uses (note though that gist apparently uses
two different pieces of contour code for its contour tasks. The
one we are looking to adapt, mainly because it appears much easier
to isolate from the gist environment is the gcntr.c version).
I would be amazed if one could find a pure Python algorithm to do
contouring that was fast enough. Our current plan is to use these
C routines to generate the contour segments, and do the plotting
from within Python (as well as any contour labeling).
If you have expertise in this area you may be able to do it better
and faster than we can. Currently it is being worked on part time
so we aren't able to do it as fast as we would like. I'm hoping that we
will have at least a basic version (e.g., no labeling) in a couple
If you want me to send or point you to the source code we are
using as the basis, let me know.