PyNGL Home > Functions > Graphics routines

Ngl.contour_map

Creates and draws a contour plot over a map.

Prototype

map = Ngl.contour_map(wks, data, res=None)

Arguments

wks

The identifier returned from calling Ngl.open_wks.

data

The data to contour. data can be a two-dimensional NumPy array or NumPy masked array (ny x nx), or a one-dimensional array that is accompanied by one-dimensional coordinate arrays of the same length (see description below).

res=None

An (optional) instance of the Resources class having PyNGL resources as attributes.

Return value

map

A PlotId of the plot created is returned.

Description

This function creates and draws contours over a map on the given workstation and advances the frame. Plot options (resources) can be set via the res variable.

In order to overlay contours on a map plot, you must tell the contour plot where on the map it is being overlaid (in latitude/longitude degrees). You can do this via the sfXArray/sfYArray resources, or the sfXCStartV/sfXCEndV/sfYCStartV/sfYCEndV resources.

If data is one-dimensional, then sfXArray and sfYArray must be set and be the same length as data (see the examples below).

As of version 1.3.0, if data is a masked array, then any values equal to the fill value will not be plotted. If data is not a masked array and it contains missing values, then set the resource sfMissingValueV to the missing value.

Note that PyNGL internally sets some contour and labelbar resources for you, depending on how other resources are set. See the list of default settings for more information.

See Also

Ngl.contour, Ngl.nice_cntr_levels

MapPlot resources
Contour resources
LabelBar resources
ScalarField resources
Title resources
TickMark resources
Transformation resources
View resources
Transform resources
PlotManager resources
Special "ngl" resources

Examples

For examples on contouring two-dimensional data, see examples ngl05p.py (output) and ngl09p.py (output).

For an example on contouring random data (i.e. data represented by X, Y, and Z values), see seam.py (output).

For an example on using masked arrays, see overlay1.py (output).