NCAR Graphics
Contouring and Mapping Tutorial

Tutorial Home                                           Next Chapter

Version 2.0

May 1993


Copyright © 1987-2000 University Corporation for Atmospheric Research
The use of this Software is governed by a License Agreement.


NCAR Graphics is a registered trademark of the University Corporation for Atmospheric Research.

All brand and product names are trademarks or registered trademarks of their respective holders. Reference to a company or product name does not imply approval or recommendation of that company or product to the exclusion of others.

Published by: National Center for Atmospheric Research, Scientific Computing Division, P.O. Box 3000, Boulder, CO 80307-3000. The National Center for Atmospheric Research is operated by the University Corporation for Atmospheric Research and is sponsored by the National Science Foundation. Any opinions, findings, and conclusions or recommendations expressed in this publication are those of the authors and do not necessarily reflect the views of the National Science Foundation.



Adrianne Middleton-Link

Technical writer/editor

Brian Bevirt


Jacque Marshall

Document production

Christine Guzy, coordinator
Jacque Marshall

Technical reviewers

Ethan Alpert, SCD

Donna Beller, CGD

Michael Böttinger, Deutsches Klimarechenzentrum GMBH

Ginger Caldwell, SCD

Lee Carter, SCD

Diane Chace, Fleet Numerical Oceanography Center

Fred Clare, SCD

Dennis Colarelli, SCD

Nancy Dawson, SCD

Jim Eenigenburg, U.S. Forest Service

Keith Eggleston, Northeast Regional Climate Center

Gabor Fichtinger, Center for High Performance Computing, University of Texas at Austin

Christine Guzy, SCD

Mary Haley, SCD

Ken Hansen, SCD

Evelyn Hesse, Fleet Numerical Oceanography Center

Dave Kennison, SCD

Jeff Kuehn, SCD

Kirk Maasch, Quaternary Institute, University of Maine

Jacque Marshall, SCD

Pete Morreale, SCD

Tom Parker, SCD

Juli Rew, SCD

Tim Scheitlin, SCD

Dennis Shea, CGD

Susan Smith, SCD

Shirley Stephan, Lawrence Livermore National Laboratory

Paula Theophilus, SAIC

Michael Timlin, CIRES

The author especially wants to thank Dave Kennison of NCAR's Scientific Visualization staff. Dave has provided extensive technical support, explanations, and suggestions for this tutorial.

Thanks to Christine Guzy for pioneering many new techniques for electronically producing all the graphics in this book and demonstrating new ways to publish NCAR Graphics output. This work was made possible by ongoing technical support from Fred Clare, Dave Brown, John Clyne, and Dave Kennison of the Scientific Visualization Group. Thanks to Martha Lankton of NCAR Graphic Services for her help in printing this manual.

The instructional design principles used in this manual were planned by Adrianne Middleton-Link, Jeff Kuehn, and Brian Bevirt; the design was executed and refined by Brian Bevirt and Jacque Marshall. This particular design is derived primarily from seminars and books by Edmond H. Weiss, Ph.D.

Special thanks to Jacque Marshall for using Adobe Illustrator to create all the illustrations in this document that were not produced with the NCAR Graphics package. Jacque has also developed and and refined the templates for this design using Microsoft Word and FrameMaker.

Conventions used in this document


Bold type indicates filenames, pathnames, directories, UNIX command names, and UNIX command line options. The files that provide examples for this tutorial are sometimes specified by their exact filename, and other times the usage is more informal. Examples:

Italic type indicates a variable where you provide the substitution. For example:


Fortran code segments and error messages are shown in Courier ("typewriter") font:

  CALL GRIDAL (K-1, 0, N-1, 0, 1, 1, 5, 0., 0.)
In the synopsis of Fortran code segments, lowercase letters represent a specific value that must be used in the code. These strings conform to the Fortran naming convention for declaring variable types as INTEGER or REAL. Examples:

  CALL CPSETR ('CIT', cit)
  CALL CPGETI ('LIU', liu)
  CALL CPSETI ('RWC', irwc)
When a line of Fortran code is longer than the width of the column, the continued line is indicated with a plus sign (+) in Fortran column 6. Example:

  4       IF (IDLS .NE. 1 .AND. IDRS .NE. 1 .AND.
         + IDLS .NE. 3 .AND. IDRS .NE. 3 .AND.
         + IDLS .NE. 11 .AND. IDRS .NE. 11 .AND.
         + IDLS .NE. 79 .AND. IDRS .NE. 79 .AND.
         + IDLS .NE. 99 .AND. IDRS .NE. 99 .AND.
         + IDLS .NE. 104 .AND. IDRS .NE. 104 .AND.
         + IDLS .NE. 107 .AND. IDRS .NE. 107 .AND.
         + IDLS .NE. 163 .AND. IDRS .NE. 163) NPTS=0
  5       RETURN
  6       END

SCD documentation and consulting

Ordering information

For ordering information, please contact NCAR Graphics ordering information at (303) 497-1201 or or

University Corporation for Atmospheric Research
SCD/NCAR Graphics Orders
P.O. Box 3000
Boulder, CO 80307-3000 (USA)

How to get consulting help

If you have questions about using NCAR Graphics, contact your NCAR Graphics site representative. If you do not know who your site representative is and cannot find out from other users or the package installer at your site, you can call the NCAR Graphics Information Line at (303) 497-1201 to obtain the name of your representative. In its sole discretion, NCAR provides limited consulting support on usage and installation on an "as available" basis only. (Please refer to your Software License Agreement for a complete definition of "support.")

Table of contents

NCAR Graphics Contouring and Mapping Tutorial

Intro 1. A short introduction
Purpose of this tutorial
Design of this tutorial
Other resources to use with this manual
Intro 1.1 Understanding the layout of tutorial modules
Intro 1.2 Details about how information is presented in this manual
Reference guides throughout
Basic concepts explained first
Instructions for performing tasks

Using Areas

Ar 1. What is Areas?
Ar 1.1 Table of Areas user entry points
Initialization and support routines
Action routines
Query routine
Parameter setting and retrieving routines
Debugging routine
Ar 1.2 Table of Areas parameters
Ar 1.3 Areas definitions: Edges
Ar 1.4 Areas definitions: Groups of edges
Ar 1.5 Areas definitions: Left and right
Ar 1.6 Areas definitions: Areas, area identifiers, and area maps
Ar 1.7 Areas definitions: Masks and areas defined by more than one edge group
Ar 1.8 What calls do I need to get my Areas plot?
Ar 1.9 Areas parameters: What they do and how to use them
Ar 2. Initializing Areas
Ar 2.1 Set up area map
Ar 2.2 Adding edges to an area map
Ar 2.3 Preprocess area map: Overview
Ar 2.3.1 Preprocess area map: Breaking up edges
Ar 2.3.2 Preprocess area map: Removing coincident and dangling edges
Ar 2.3.3 Preprocess area map: Reconciling area information
Ar 3. Producing results using Areas
Ar 3.1 Obtaining area ids and group ids
Ar 3.2 Masking and drawing lines through an area map
Ar 3.3 Writing a masking or line-drawing routine
Ar 3.4 Filling areas
Ar 3.5 Writing an area-fill routine
Ar 4. Debugging Areas
Ar 4.1 Debugging options: Setting parameters
Ar 4.2 Debugging options: Drawing parts of the area map
Ar 5. Areas parameter descriptions

Using Ezmap

Mp 1. What is Ezmap?
Mp 1.1 Table of Ezmap user entry points
Single-call entry point
Map initialization routines
Latitude, longitude, and limb line drawing routines
Labeling routine
Map drawing and control routines
Positioning routines
Point and line routines
Color function
Inverse transformation routine
Parameter routines
Mp 1.2 Table of Ezmap parameters
Mp 1.3 Table of Ezmap map projections
Mp 1.4 Description of projections: Conic
Mp 1.5 Description of projections: Azimuthal
Mp 1.6 Description of projections: Cylindrical
Mp 1.7 Producing a quick and dirty plot
Mp 1.8 What calls do I need to get my Ezmap plot?
Mp 1.9 Ezmap parameters: What they do and how to use them
Mp 2. Getting set up
Mp 2.1 Positioning the plot in the frame
Mp 2.2 Choosing your map projection
Mp 2.3 Choosing your map projection: Satellite view
Mp 2.4 Choosing map outlines to be drawn
Mp 2.5 Setting limits for the projection
Mp 2.6 Setting map line colors
Mp 2.7 Controlling Ezmap lines
Mp 2.8 Controlling geographic and political outlines
Mp 2.9 Rectangular and elliptical perimeters
Mp 2.10 Saving and retrieving Ezmap parameters
Mp 3. Simple maps
Mp 3.1 Initializing Ezmap
Mp 3.2 Grids: Drawing latitude and longitude lines
Mp 3.3 Grids: Dash patterns
Mp 3.4 Labeling
Mp 3.5 Drawing political and geographic outlines
Mp 3.6 A shortcut
Mp 4. Producing maps with masking or filled areas
Mp 4.1 Color and area identifiers in Ezmap
Mp 4.2 Ezmap group identifiers
Mp 4.3 Initialize Ezmap with Areas
Mp 4.4 Labeling
Mp 4.5 Grid lines with masking
Mp 4.6 Grid lines with masking: Writing a masking routine
Mp 4.7 Filling areas
Mp 4.8 Filling areas: Writing a fill routine
Mp 5. Points, lines, and inverse transformations
Mp 5.1 Projecting a point onto the map
Mp 5.2 Inverse transformations
Mp 5.3 Drawing lines on a simple map
Mp 5.4 Drawing a great circle between two points
Mp 5.5 Adding lines to an area map
Mp 5.6 Drawing lines masked by an area map
Mp 6. Table of Ezmap area identifiers
Mp 7. Ezmap parameter descriptions

Using Conpack

Cp 1. What is Conpack?
Cp 1.1 Table of Conpack user entry points
Conpack initialization and data support routines
Background routine
Labeling routines
Contour line drawing routines
Parameter access routines
Cp 1.2 Table of Conpack parameters
Cp 1.3 Producing a "quick and dirty" plot
Cp 1.4 More complex black and white plots
Cp 1.5 What calls do I need to get my Conpack plot?
Cp 1.6 Conpack parameters: What they do and how to use them
Cp 2. Backgrounds for your plots
Cp 2.1 Generating a background
Cp 2.2 Drawing a contour perimeter
Cp 2.3 Setting X/Y axis values for a contour background
Cp 2.4 Changing perimeter options
Cp 2.5 Labeling X/Y axis values for a contour background
Cp 2.6 Contour perimeter: Size, shape, and location using Conpack
Cp 2.7 Contour perimeter: Size, shape, and location using SET
Cp 3. Initializing Conpack
Cp 3.1 Data types
Dense gridded data
Sparse gridded data
Irregularly spaced gridded data
Nongridded data
Missing data
Non-Cartesian data
Cp 3.2 Dense gridded data
Cp 3.3 Sparse gridded data
Cp 3.4 Irregularly spaced gridded data
Cp 3.5 Nongridded data
Cp 3.6 Missing or special data
Cp 3.7 Non-Cartesian data
Cp 3.8 Non-Cartesian data: Latitude/longitude data
Cp 3.9 Non-Cartesian data: Polar coordinates
Cp 3.10 Non-Cartesian data: Other data types
Cp 3.11 Contouring non-rectangular domains
Cp 3.12 Setting minimal workspace
Cp 4. Contour line basics
Cp 4.1 Contour line basics
Cp 4.2 Drawing contour lines
Cp 4.3 Four methods of contour level selection
Cp 4.4 Default contour level selection
Cp 4.5 Default contour level selection: Default intervals and labels
Cp 4.6 Default contour level selection: Fixed contour intervals and labels
Cp 4.7 Modifying Conpack-chosen levels: Picking levels
Cp 4.8 Modifying Conpack-chosen levels: Changing the levels
Cp 4.9 Setting n equally spaced contour levels
Cp 4.10 Choosing your own contour levels
Cp 4.11 Line attributes: Line dash patterns
Cp 4.12 Line attributes: Line thickness
Cp 4.13 Line attributes: Line color
Cp 4.14 Line attributes: Turning contour line drawing off and on
Cp 5. Filling contour levels
Cp 5.1 Area identifiers in Conpack
Cp 5.2 Group identifiers in Conpack
Cp 5.3 Initialize Conpack with Areas
Cp 5.4 Adding label boxes to the area map
Cp 5.5 Masking areas: Label boxes
Cp 5.6 Masking areas: Box masking routines
Cp 5.7 Filling contour levels
Cp 5.8 Filling contour levels: Writing a fill routine
Cp 6. Contour line labels
Cp 6.1 Annotating your plots
Cp 6.2 Forcing labels to be chosen
Cp 6.3 Selecting lines for labels: Default method
Cp 6.4 Selecting lines for labels: Labeling every nth line
Cp 6.5 Selecting lines for labels: Labeling specific lines
Cp 6.6 Three methods of label placement
Cp 6.7 Label placement: Default method
Cp 6.8 Label placement: Regular scheme
Cp 6.9 Label placement: Penalty scheme
Cp 6.9.1 Label placement: Penalty scheme---Gradient term
Cp 6.9.2 Label placement: Penalty scheme---Crossing contours
Cp 6.9.3 Label placement: Penalty scheme---Tight curves
Cp 6.9.4 Label placement: Penalty scheme---Label spacing
Cp 6.10 Label attributes: Angle and orientation
Cp 6.11 Label attributes: Color
Cp 6.12 Label attributes: Label text options
Cp 7. General labels
Cp 7.1 Overview of labeling in Conpack
Cp 7.2 Titles
Cp 7.3 Numeric control: Significant digits
Cp 7.4 Numeric control: Formatting
Cp 7.5 Numeric control: Exponents
Cp 7.6 Label attributes: Angles
Cp 7.7 Label attributes: Size
Cp 7.8 Label attributes: Constant field and information text
Cp 7.9 Label attributes: High/low text
Cp 7.10 Label attributes: Color
Cp 7.11 Label box attributes: Outline and fill
Cp 7.12 Label box attributes: Line width
Cp 7.13 Label box attributes: Size
Cp 7.14 Label placement: Constant field and information labels
Cp 7.15 Label placement: High/low
Cp 7.16 Constant field found flag
Cp 8. Overlaying filled contours on a map
Cp 8.1 Initialization
Cp 8.2 Masking areas: Label boxes and land masses
Cp 8.3 Filling specific contour and geographic areas
Cp 8.4 Filling areas: Polar projection
Cp 9. Advanced topics
Cp 9.1 Smoothing contours
Cp 9.2 Hachuring: Indicating slope on a contour plot
Cp 9.3 Cell arrays
Cp 9.4 Making a movie
Cp 10. Conpack parameter descriptions


Tutorial Home                                           Next Chapter