★ Overview of flow visualization in IDL
posted Wed 19 Mar 2008 by Michael Galloy under IDLI’ve been thinking about flow visualization recently, so I thought I would summarize what I know currently about the current state of making plots of vector fields in IDL.
VELOVECT
routine
VELOVECT
makes the standard grid of arrows representing each point in a 2D vector field. For example, try:
IDL> restore, filepath('globalwinds.dat', subdir=['examples','data'])
IDL> velovect, u, v, x, y
This should produce a plot like
I think there are much better ways to visualize flow, but this is an easy way.
iVector iTool
IVECTOR
is the interactive, iTools version of VELOVECT
. It has an option to do wind barbs as well as arrows. It takes u
, v
, x
, and y
parameters like VELOVECT
:
IDL> restore, filepath('globalwinds.dat', subdir=['examples','data'])
IDL> ivector, u, v, x, y
It looks like
PARTICLE_TRACE
routine
PARTICLE_TRACE
is not a graphics routine, but computes a polygonal mesh describing the path of a particle through a 2D or 3D vector field. To see an example, try this main-level program. The example simply follows three particles and overplots the particles onto the output from VELOVECT
. Run it with the following command:
IDL> .run particle_trace_example
This should produce output like
VEL
routine
VEL
selects random starting points and plots the particles path through a 2D vector field. For example,
IDL> restore, filepath('globalwinds.dat', subdir=['examples','data'])
IDL> vel, u, v, nvecs=1200
should give ouptut like
Unfortunately, VEL
does not accept graphics keywords (I had to edit the screen capture just to change the background to white) or even x and y vectors to specify the coordinate system.
PLOT_FIELD
routine
PLOT_FIELD
is similar to VEL
, but with fewer options.
FLOW3
routine
“Draws lines” representing a 3D vector field. It does not accept graphics keywords or x-, y-, or z-axis values. I had a rough time getting any reasonable output with this routine. Here is the best I could manage with some data I had:
STREAMLINE
STREAMLINE
can take the polygonal mesh output from PARTICLE_TRACE
> and create a ribbon along with particle’s path. For instance, given a data array and some seeds, the following will produce a ribbon specified with outVerts
and outConn
:
IDL> particle_trace, data, seeds, verts, conn, normals
IDL> streamline, verts, conn, normals, outVerts, outConn
I have been able to get output from this, but I haven’t been happy with it:
UPDATE: The SHOW_STREAM
demo program is a better example of using STREAMLINE
in combination with PARTICLE_TRACE
or VECTOR_FIELD
(thanks Doug Dirks for letting me know about this!). You can find it in
filename = filepath('show_stream.pro',
subdir=['examples', 'doc', 'objects'])
It starts up XOBJVIEW
to display the results:
Other methods
There are other methods not in IDL’s libraries for visualizing flow. The below plot, from a paper comparing the effectiveness of different vector field visualizations by Laidlawg et al., shows six common methods. GRID is the type of plot available from VELOVECT
and IVECTOR
. JIT is available through VEL
, PLOT_FIELD
, or using PARTICLE_TRACE
without appropriate seeds. I wrote an article about LIC and have a slow implementation. LIT, OSTR, and GSTR are not available from the IDL library. I think OSTR would be a good technique to tackle next (after I finally get that LIC DLM completed).
April 11th, 2008 at 7:26 am
[…] the line-integral convolution (LIC) implementation as a DLM and cleaned it up a bit (see other articles for background). More work is needed, but it can give useful results now. The movie at the right […]
April 14th, 2008 at 2:49 pm
Thank you Sir. Very useful resource
January 28th, 2009 at 3:32 pm
Nice overview. I think there is a bug in your particle_trace example:
sz = size(verts, /structure)
while (i lt sz.dimensions[1]) do begin
This should loop over the connections, not the # of vertices:
while (i lt n_elements(conn)) do begin
When I was using some of my data to test out the example, I ran into some trouble– either some streamlines were missed, or it would go out of bounds in the
conn
array.January 28th, 2009 at 3:47 pm
I agree, the particle_trace_example.pro was incorrect. I have fixed it and uploaded the new version.
Thanks!
March 22nd, 2011 at 12:44 pm
Hi all,
I am trying to use the particle_trace function in IDL, but I have no idea how to define my units. I have a particle that I want to move for an h, and my velocity units are km/s, so I used a max_stepsize=3600, max_iterations = default.
Any help regarding the units of max_stepsize will be greatly appreciated,
Thanks in advanced,
Inia
February 4th, 2014 at 9:00 am
[…] hope you found this overview. I also have some IDL code to implement LIC (line integral convolution) […]
November 24th, 2015 at 9:01 am
[…] wrote an overview almost eight years ago about IDL’s basic routines to visualize a vector field. Not much has […]