NCL Website header
NCL Home > Documentation > Manuals > Reference

Introduction to NCL

The NCAR Command Language is a programming language

NCL is a complete programming language. It has many features common to modern programming languages: it has types, variables, operators, expressions, conditional statements, loops, and functions and procedures. Because it is a programming language, users are required to have some level of experience using a programming language. However, many tasks such as converting file formats and creating graphical output do not require advanced programming skills.

In addition to common programming features, NCL also has features that are not found in other programming languages. These additional features handle the manipulation of metadata, the configuration of the output graphics, the import of data from a variety of data formats, and an algebra that supports array operations.

NCL comes with many useful built-in functions and procedures for processing and manipulating data. There are statistical functions as well as advanced mathematical functions like spherical harmonics.

The primary design goals for NCL were to allow convenient access to data in a variety formats, allow for processing of the data, and allow for the creation of output graphics. NCL is not meant to be a replacement for programming in other structured languages; it is meant to provide an integrated environment where data can be selected, manipulated, and visualized interactively without requiring compilation. In fact, NCL supports calling C and Fortran external routines, which makes NCL infinitely configurable.

NCL can operate in three modes. The first mode of operation is as an interactive command line interpreter where every statement is executed immediately after the user enters a command or expression. The second mode of operation is as a batch command interpreter where an entire NCL script is read in at one time and executed. The third mode is intended to facilitate the batch production of large quantities of output visualizations either for data exploration or video production.

Learning to use NCL

NCL has three distinct areas. The first is file I/O. NCL has unique syntax that supports directly referencing variables in data files. Not only can the whole variable be read or written to, but portions of data can be accessed as well using NCL's file variable subscripting rules. Unique syntax for accessing additional file variable information, called metadata, is also useful. This additional information is often grid coordinate information, units, missing values, etc.

Second, there are the data processing features of NCL. The difficulty in learning this area is dependent on the complexity of the user's data processing requirements. Differences between fields on identical grids and averages are fairly straightforward, and many examples exist. However, learning to write efficient NCL data processing code requires a fair amount of understanding of the language.

Finally, there is the graphics component. The syntax for the graphics commands are simple, but the use of them can be complex. NCL uses the NCAR Graphics High Level Utilities Library (HLUs) to configure graphical output. Some discussion of how to create plots is given in this document, but the bulk of the information necessary to configure plots is in the HLU documentation.