Color filled contours with cylindrical equidistant map

cecfc_ex01: Defaults


load "plots.ncl"

opt = 0

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

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

cecfc( opt, wks, fld )




The default plot window is determined by the extent of the coordinates of the variable fld. If there are coordinates associated with the variable U in the data file then NCL automatically extracts and "attaches" these coordinates to fld. If the coordinate data for U is missing then the grid index values are used and NCL will issue a warning like
warning:Dimension (0) has not been defined
In this case the data will not be properly aligned on the map which will have the intersection of the equator and the prime meridian in the lower left hand corner. The way to fix this problem is either to fix the data file so that it contains the appropriate coordinate information, or to add the coordinates in the NCL script. Here is an example of doing that assuming that the variables lat and lon contain the appropriate grid latitude and longitude values. Note that the function cecfc assumes that fld is a 2D variable with longitude values in the most rapidly varying dimension.
fld!0 = "lat"
fld&lat = lat
fld!1 = "lon"
fld&lon = lon
In the current example there is no data at the poles, nor is there a longitude wrap point. This results in the window not extending to the poles or including the prime meridian on the right hand side. These features are added to the plot by specifying the appropriate window and adding data for the wrapped longitude point. See cecfc_ex02.


The main title for the plot comes from the long_name attribute of the variable fld. This was automatically gotten from the input data file at the time the zonal wind slice was extracted. No units are present on the plot because the attribute units is missing from the zonal wind variable in the input data. The default is to draw the units string under the colorbar (or on top if the colorbar is vertical).

The easiest way to modify (or add if the attributes are missing from the data file) the main plot or colorbar titles is to add the appropriate attributes to the variable fld as follows:

fld@long_name = "U@300mb, NCEP, July Avg (1979-95)"
fld@units = "m s:S2:-1"
A more complete customizing of the plot titles is demonstrated in example cecfc_ex02.

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. But the default method for setting the color indices maps the entire range of contour bins (the bins are the intervals implied by the chosen contour level values) into the entire range of possible colormap indices. There is a plot attribute to make the bins surrounding the zero contour level map to the center of the range of colormap indices. This is demonstrated in cecfc_ex02.
Return to NCL Script Index