Graphics: NCL - The Basics



Once you have installed the NCL libraries, there are two important steps you need to take before creating graphics:

1. Setting an environment variable, and
2. creating the .hluresfile file.

 

Environment Variable


Set the environment variable NCARG_ROOT to the location where you installed the NCL libraries. Typically (for cshrc shell):

setenv NCARG_ROOT /usr/local/ncl

 

.hluresfile


Create a file called .hluresfile in your $HOME directory. This file controls the color / background / fonts and basic size of your plot. For more information regarding this file, see: http://www.ncl.ucar.edu/Document/Graphics/hlures.shtml.

NOTE: This file must reside in your $HOME directory and not where you plan on running NCL.

Below is the .hluresfile used in the OnLine Tutorial example scripts. If a different color table is used, the plots will appear different. Copy this to your .hluresfile, or download it to your $HOME directory.

*wkColorMap : BlAqGrYeOrReVi200
*wkBackgroundColor : white
*wkForegroundColor : black
*FuncCode : ~
*TextFuncCode : ~
*Font : helvetica
*wkWidth : 900
*wkHeight : 900

 

NOTE: If you see an image similar to the one on the left, your .hluresfile has not been created correctly, or it is in the wrong location. You should see an image similar to the one on the right.

wkColorMap, as set in your .hluresfile can be overwritten in any ncl script with the use of the function “gsn_define_colormap”, so you do not need to change your .hluresfile if you just want to change the color map for a single plot.



Create NCL Scripts