Introduction

The intent is to provide a collection of functions for producing high quality graphics that is easy to use and robust. Easy to use in the sense of requiring a minimum of user input, and robust in the sense of producing a reasonable picture no matter how little information is provided by the user in addition to the basic data. These requirements necessitate that a given function produce a fairly specific plot, i.e., a large number of decisions are made for each plot produced via setting values of the HLU resources. An important difference between the functions described here and most of the scripts that are available as templets for producing a particular plot style is that these functions set the required HLU resources dynamically. There are no hard coded axis labels or contour levels or colorfill indices as are common in script templates or resource files. All resources are set with dynamically determined defaults that may be overridden by the user to "tweek" (hopefully) the plot into presentation quality.

Using the Scripts

The sample scripts all begin by loading the file plots.ncl which you may obtain by clicking on the highlighted plots.ncl string to bring it up in a browser window, using the browser "save as..." option, and then editing out the HTML tags at the begining and end of the file. The plots.ncl file was last updated on Sat Dec 20 18:48:43 MST 1997

Any of the .rgb colormap files may be obtained by going to the section on colormaps which contains links to all the colormap files and following the same procedure as for plots.ncl.

A few HLU resources are set in the file .hluresfile in your home directory. To obtain the same plots as in the examples below the following resource values should be added to your .hluresfile:

*contourPlotClass.cnMaxDataValueFormat: .4^sg
*Font: helvetica
*cnLineLabelFont: helvetica
*cnHighLabelFont: helvetica
*cnLowLabelFont: helvetica
*cnInfoLabelFont: helvetica
*lbLabelFont: helvetica
*tmBorderThicknessF : 1.0
*tmXBMajorThicknessF : 1.0
*tmYLMajorThicknessF : 1.0
*tmXBLabelFont : 21
*tmXBLabelFontHeightF : .017
*tmXBLabelDeltaF : -.5
*tmYLLabelFont : 21
*tmYLLabelFontHeightF : .017
*tmYLLabelDeltaF : -.5
*tmXBMajorLengthF : .015
*tmXBMinorLengthF : .0075
*tmYLMajorLengthF : .015
*tmYLMinorLengthF : .0075
This software has been developed using the latest version of NCL (4.1beta) found on winterpark at /fs/scd/home1/ncargd/dev/IRIS_IRIX64_6_2_/bin/ncl. Earlier versions of NCL may or may not work with these scripts.

Dynamic Setting of HLU Resources

Each plot function must create several HLU objects in order to produce a complete plot. Each of these objects requires that certain HLU resources be set in order to obtain a particular plot type. The plot functions provide default values for all HLU resources that are required. Some of these defaults are arbitrarily chosen and others are dynamically chosen based on the input data. A check is always made to see if the user has specified the value of a resource before the default value is used. While there may be a hundred resources that can be set for an object, there are typically on the order of ten that need to be set in a particular way for a given plot type. However, in customizing a plot the user may wish to alter any of an objects resources. To allow for this once an object has been created a call is made to a routine that sets resources for that object and all the user resource specifications are checked to see if there are any relevant to that particular object. Here is a code segment that does this for a contourPlotClass object:
procedure setcnRes( opt, obj:graphic )

; Set contourPlotClass resources for the specified object.

; Input arguments:
; opt - a dummy arg used for specifying option attributes
; obj - contourPlotClass object.

begin
if ( isatt( opt, "cnFillColors" ) ) then
   setvalues obj
	"cnFillColors" : opt@cnFillColors
   end setvalues
end if
if ( isatt( opt, "cnMissingValFillColor" ) ) then
   setvalues obj
	"cnMissingValFillColor" : opt@cnMissingValFillColor
   end setvalues
end if
end
The resource setting routines are named setxxRes where xx is the 2 letter class designator used by the HLU class. Because there are thousands of resources for all the HLU classes the ability to change them all has not been implemented in the current set of setxxRes functions. Only the resources that have been needed for the plots produced to date have been added. If you require a resource that is currently missing then just modify the appropriate setxxRes function by adding the code segement:
if ( isatt( opt, "xxMissingResource" ) ) then
   setvalues obj
	"xxMissingResource" : opt@xxMissingResource
   end setvalues
end if
where xxMissingResource is replaced by the appropriate resource name.

Setting Color Resources

Named Colors

Currently NCL does not make any provision for named colors. So for example if you want to change the color of the continental outlines drawn on a map to red, then you must know the index corresponding to red in the workstation's colormap since this is the value accepted by the resource mpGeophysicalLineColor.

The function rgbColorMap has been set up to include a short list of fixed colors into the colormap in front of any user specified colormaps. The fixed colors are implemented by defining global variables, the name of the variable being the name of the color, and the value of the variable being the index in the colormap. These names may be used to refer to colors in any context where a color index is required. The currently implemented list of named colors is: WHITE, BLACK, PURPLE, INDIGO, MAGENTA, BLUE, NAVY, TEAL, AQUA, GREEN, CHARTREUSE, GOLD, YELLOW, ORANGE, RED, MISTY_ROSE, LIGHT_GREY, BEIGE, BISQUE, LAVENDER, AZURE.

Click HERE to view a colorbar containing all the fixed colors.


Return to NCL Script Index