Troubleshooting NCL

This module discusses various tools for figuring out what went wrong with an NCL program execution.

Syntax errors

Most syntax error messages should be self-explanatory. Since NCL is an interpreted language, syntax errors will not be reported until they are encountered. However, if you want to have an entire NCL script checked for syntax errors before execution, you can enclose the entire script in a begin and end statement. That is, put a begin at the beginning of the script and an end at the end. This will make the entire script into an NCL block. Since blocks are not executed until they are checked for syntax, the entire NCL script will be checked for syntax before proceeding.

Using the NCL print procedure

There is no high-level debugger for NCL like dbx. Most of the time, the error messages issued by NCL will be enough to figure out what the problem is. If not, you may want to use the NCL print procedure.

The procedure print can be used to print, on the standard output unit, values of any NCL variable or data structure. When printing arrays, you may want to take advantage of the ability to easily select subsets of the array. This is discussed in the NCL array subscripting module.

If you just want to print an informational message, you can pass a string literal to print. For example:

print("Execution got to this point")

Changed values not reflected in a plot

If you assign a value to an HLU resource in a resource file and that change is not reflected in your plot, make sure that you have not assigned a value to the resource in an NCL create statement, or in an NCL setvalues statement. Values set in a create or setvalues statement will take precedence over those set in a resource file.

Really stumped?

The NCAR Graphics consulting staff is available via e-mail at Installation consulting is available at You can also send comments to us by simply clicking on the Feedback icon (the one with the ear) in the control panel that appears in every documentation module.

User Guide Control Panel

NG4.1 Home, Index, Examples, Glossary, Feedback, UG Contents, UG WhereAmI?

$Revision: 1.7 $ $Date: 1998/06/15 22:08:58 $