Color filled contours with cylindrical equidistant map

cecfc_ex02: Customize window, titles, color indices

load "plots.ncl"

opt = 0

f1 = addfile( "NCEP/press/", "r" )
fldin = f1->U(0,{300.},:,:)
fld = addWrap( fldin )

dev = "ps"
dev@wkColorMap = rgbColorMap( opt, "BlRe.rgb" )
wks = workstation( dev )

opt@plWindowF = (/ 0., 360., -90., 90. /)
opt@plMainTitle = "NCEP/NCAR reanalysis"
opt@plMainTitle2 = "July ensemble avg, 1979-1995"
opt@plPlot1TitleL = "U"
opt@plPlot1TitleC = "300 mb"
opt@plPlot1TitleR = "(m s:S2:-1  )"
opt@plCenterZeroCI = True
opt@cnMinLevelValF = -10.
opt@cnMaxLevelValF = 45.
opt@cnLevelSpacingF = 5.
opt@lbLabelStride = 1

cecfc( opt, wks, fld )



This script modifies the basic plot produced in cecfc_ex01.


The function addWrap is used to add the wrap point in longitude. Since there is no data at the poles the only way to extend the window to include them is to do so explicitly via the plWindowF attribute.


The main titles drawn at the top of the page are specified using the attributes plMainTitle, and plMainTitle2. The positions of these titles can be adjusted with the attributes plMainTitleYoffF, and plMainTitle2YoffF, and the font sizes can be adjusted with plMainTitleFontHeightF, and plMainTitle2FontHeightF.

The titles on top of the plot are specified using the attributes plPlot1TitleL, plPlot1TitleC, and plPlot1TitleR. The positions of these titles can be adjusted with the attribute plPlotTitleYoffF, and the font size can be adjusted with plPlotTitleFontHeightF.

Colormap Indices

The colormap BlRe.rgb is chosen so that the positive zonal winds (westerlies) can be represented in red shades and the negative zonal winds (easterlies) can be represented in blue shades. To take advantage of this the attribute plCenterZeroCI is set to True which causes the bins surrounding the zero contour level to be mapped to the center of the range of colormap indices. This is done in function setFillColors and the algorithm probably still needs a little tuning. One could also try tuning the colormap if the center colors are just a bit off.

Setting Contour Level Values

Contour level values are set by specifying contourPlotClass resources. In this example cnMinLevelValF sets the minimum contour value, cnMaxLevelValF sets the maximum contour value, and cnLevelSpacingF sets the spacing between contours.

Adjusting Colorbar Labels

The colorbar in this example is produced using a labelBarClass object. The function drColorbar draws the colorbar and when there are more than 8 contour levels the stride for drawing labels is set to 2. In the current example we set this back to 1 using the labelBarClass resource lbLabelStride.

Return to NCL Script Index