NCL Website header
NCL Home> Application examples> gsn_csm graphical interfaces || Data files for some examples

Example pages containing: tips | resources | functions/procedures

Vectors (high-level graphical interfaces)

Vector Plot Templates







Additional Examples:

Use the vcLineArrowThicknessF to make the vectors thicker.

vector_1.ncl: Creates a vector plot over SST contours. gsnScalarContour = True, means that a scalar contour plot will also be drawn. The default is False, which colors the vectors by the scalar map (see example 4).

vcRefMagnitudeF = 5.0, Defines the reference vector magnitude. Use this to adjust the size of the vectors.

vcRefLengthF = 0.045, Defines the length of the reference vector.

gsn_csm_vector_scalar_map is the plot interface that draws a vector plot over a scalar contour plot.

cnLinesOn = False, Turns off the contour lines.

cnLineLabelsOn = False, Turns off the contour line labels.

vcGlyphStyle = "CurlyVector", Turns on the curly vectors.

vector_2.ncl: Add an overlay of wind magnitude contours.
vector_3.ncl: Draw vectors on a global map with a time stamp at the bottom.

gsn_csm_vector_map is the plot interface that draws vectors over a map.

vcMinDistanceF = 0.017, Thins the vectors.
vcRefAnnoOrthogonalPosF = -1.0, Moves the reference vector up.

infoTimeStamp is a utility for creating a time stamp at the bottom of the figure. The arguments are the workstation, the size of the text, and the right string. The left string is automatically generated and includes the time and date of the plots' creation.

vector_4.ncl: Color vectors by a scalar field.
vector_5.ncl: A vector pressure/height plot.

gsn_csm_pres_hgt_vector is the plot template that draws vectors over a pressure height plot. Note that vcMapDirection must be set to False in order for the vectors to be pointing in the right direction. In V6.2.0, this resource will be set to False by default for the gsn_csm_pres_hgt_vector function.

There is another example of this template: example 7 in the pressure/height vs latitude applications page.

vector_6.ncl: Draws vectors with with automatic default clipping, and then with clipping turned off.

To turn off vector clipping, set the resource vpClipOn to False.

This example also shows how to change the thickness of the vectors. This is done by setting the vcLineArrowThicknessF resource to the desired multiple of default thickness. For example, setting it to 2.5 makes the vectors two-and-a-half times as thick.

vector_7.ncl: This example shows how to position the vector arrows differently using the resource vcPositionMode. The default is "ArrowCenter". You can also use "ArrowHead" or "ArrowTail".

Polymarkers are added to each plot using gsn_add_polymarker
so you can see locations of the vector coordinates.

Like vector_6.ncl, this example shows how to adjust the vector thickness.

overlay_11.ncl: This example shows how to overlay vectors on top of a filled contour plot, where the contours are masked by a geographical area and the vectors are not. The masking is accomplished by setting:

  mpres@mpDataBaseVersion   = "MediumRes"
  mpres@mpMaskAreaSpecifiers = (/"China:states","Taiwan"/)

The mask area specifier names are part of the predefined group names available in the "MediumRes" map database.

This script was written by Yang Zhao (CAMS) (Chinese Academy of Meteorological Sciences).

polyg_23.ncl: This script shows how to add single vectors (arrows) to a plot, using an "arrow" function contributed by Arindam Chakraborty.

This function uses gsn_add_polyline under the hood, which means you can use gsLineXXXX resources to customize the arrows.

vector_8.ncl: This example shows how to draw three types of vectors: line vectors, curly vectors, and wind barb vectors, and how to color the vectors based on magnitude. Use the vcGlyphStyle resource to change the type of the vectors being drawn. To color the vectors based on magnitude, set vcMonoLineArrowColor to False.
vector_9.ncl: This example shows how setting vcMinMagnitudeF has no effect on curly vectors; one way you can reduce the magnitude is by using the where function.