NCL > Application examples > Basic examples

VectorPlot example 9

How to do a vector animation using vectors and color contours of wind, temperature, and pressure

This example can be created using HLU function calls or NCL. It plots wind vectors colored by temperature over a pressure field contour plot. The names of the source files for this example are vc09c.c, vc09f.f, and vc09n.ncl.

View this animation.

View zoomed version of this animation.

Discussion

This module discusses how to create this plot using NCL or HLU C or FORTRAN calls. A resource file is included with this example, and it is called vc09.res. This file is used to change the default resource settings for the plot.

A detailed discussion of how this example works appears in its source code.

Creating the plot using HLUs

The HLU C program that generates this plot is called vc09c.c.

Creating the plot using HLU FORTRAN library calls

The HLU FORTRAN program that generates this plot is called vc09f.f.

Creating the plot using NCL

The NCL script that generates this plot is called vc09n.ncl.

The data

The data for this plot is from several netCDF files called Ustorm.cdf, Vstorm.cdf, Pstorm.cdf, and Tstorm.cdf.

The data files are located in your NCAR Graphics data directory in a subdirectory called "cdf". You can get the name of the data directory by typing "ncargpath data" at your shell prompt. If you have netCDF installed on your system, then you can change directory to where the netCDF files reside and type "ncdump -h file.cdf" to view the header information for this data file.

How to run this example

This example can be created using a C program (vc09c.c), a FORTRAN program (vc09f.f), or an NCL script (vc09n.ncl). The example is installed in the following locations:

  • $NCARG_ROOT/lib/ncarg/hluex/vectorplot/vc09c.c
  • $NCARG_ROOT/lib/ncarg/hluex/vectorplot/vc09f.f
  • $NCARG_ROOT/lib/ncarg/nclex/vectorplot/vc09n.ncl
The netCDF data files are installed in the following directory:

  • $NCARG_ROOT/lib/ncarg/data/cdf
You can copy this example and run it by typing "ng4ex vc09c", "ng4ex vc09f", or "ng4ex vc09n". A copy of the source file and resource file will be placed in your current working directory. The source code will be automatically compiled, linked, and run for you. You must have the netCDF library installed on your system in order to compile the C or FORTRAN version of this example.