When to use NCL rather than HLUs and/or LLUs

Introduction

This module discusses the benefits and limitations of using NCL and when it may be more appropriate to use high level and low level utilities for creating an NCAR Graphics application. Some of the strengths of NCL include its array manipulation capabilities and data I/O functions. However, if users are very familiar with the traditional NCAR Graphics interface, they may want to continue using the low level utilities until more functionality is added to the HLUs and the NCL.

User experience

New users are encouraged to learn and use the NCAR Command Language for creating contours, maps, and graphs. NCL has a simple grammar and uses most of the standard and familiar programming constructs found in common computer and scripting languages. Veteran users of the NCAR Graphics software, however, may want to continue to use the traditional C and Fortran interfaces rather than learn a new system of creating plots. As the software evolves and more functionality is added to the NCL and the HLUs, then traditional users will want to migrate to the new interfaces.

Data I/O

One of the strengths of NCL is its data I/O capabilities. NCL can be used to read several different formats of data using only a handful of NCL statements. On the other hand, if users want to import data using the HLU or LLU interface, then they will need to learn how to use the interface to the libraries for each data format they want to read and write.

So, for example, to read a NetCDF data file using NCL, users only need to use the NCL addfile statement to import netCDF data. On the other hand, a C or Fortran application that reads NetCDF data must contain the appropriate include files, link and load options, and correct sequence of statements to open and read the file.

Type conversions

Another advantage of using NCL over other interfaces is that NCL automatically performs resource type conversion so that it is not necessary, as with the HLUs, to use a different function to set resources depending on the resource type.

So, for example, to set the text font height to a float value and the text font color to an integer index value using the HLU C interface, you would use two different HLU commands.

     NhlRLSetFloat(rlist,NhlNtxFontHeightF,0.01);
     NhlRLSetInteger(rlist,NhlNtxFontColor,18);
With NCL, however, there is no need to use a separate function for setting float, integer, or any other type of resources. In NCL, all resource assignments can be performed with a single, consistent setvalues statement.

     setvalues plot_reference
         "txFontHeightF" : 0.01
         "txFontColor" : 18
     end setvalues

Array operations

NCL supports array operations that are not available in C and Fortran without special libraries or user functions. Users can perform many single-statement array operations in NCL without having to write special matrix functions and procedures that support full array manipulation.

For example, if AR1 and AR2 are two-dimensional arrays, then multiplication of these two matrices is accomplished with a single statement.

    AR3 = AR1 * AR2 
NCL also supports a wide range of array selection methods. Users can extract subsets of data, specify strides, and select data ranges using special array subscripts. Although similar functionality is available in FORTRAN90, this functionality is not available in C.

Compilation considerations

Since NCL is an interpreted language, it is not necessary to compile an NCL script in order to execute a program. Script changes can be made quickly with a program editor and tested without having to recompile the NCL program.

Functionality

NCL functionality mirrors what is available with the HLUs. However, the current release of the software does not support isosurfaces, field flows, cell arrays, histograms, 3-D plots, and weather maps. Users will have to use the low level utilities to gain access to this functionality at this time. In future releases of NCAR Graphics, however, the HLUs and NCL will contain the bulk of NCAR Graphics functionality.


User Guide Control Panel

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


$Revision: 1.5 $ $Date: 1998/06/15 22:08:30 $