This module discusses those statements that are legal to type in--in
interactive mode--at the NCL prompt, or those statements that are legal
to include in an NCL script. This
module also details the functions and procedures that
are a part of NCL and how to add to that function set.
A statement is the fundamental element of NCL. Statements are not
restricted to being a single line of source code, and statements can be nested
within statements. You should keep two important things in mind about
how NCL executes its statements:
NCL offers several flow control statements that are similar to
flow control statements in other computer languages
(details are provided by the links):
A statement is only executed after it has been parsed and is found
to be free of syntax errors.
If a runtime error occurs while executing a statement, execution of the
statment--and any statements in which the erroneous statement is
nested--is immediately terminated.
NCL has three statements for interfacing with the
High Level Utilities library:
- These statements, of the form
If-then and If-then-else, implement a decision-making
capability in NCL.
Looping - The two looping statements are
for looping from a starting value to an ending value with a
for looping until a condition is met.
- break can
be used to abort a loop and
be used to abort the current iteration of a loop.
create - Allows you to create an
HLU object and assign values to its resources.
setvalues - Allows you to modify resources in an
HLU object after it has been created.
getvalues - Allows you to retrieve the values of
the resource setting in an HLU object.
In NCL, a function or procedure is a name followed by arguments in
parentheses with the arguments separated by commas. A function or
procedure is invoked by referencing its name and supplying an
argument list. A function returns a value, a procedure does not.
Arguments can be of any type, but facilities
exist in defining a function
for imposing restrictions on the arguments, such as numbers of
dimensions and dimension sizes. For arguments that must be a certain
type, the NCL
coercion rules apply. All arguments are passed by
reference in NCL; this means that a change in the value of an argument
within a function or procedure will change the value of the argument in
the call. If a parameter is coerced before a function is called,
changes within the function will not be reflected in the parameter.
block allows you to group statements into a new statement
and can be used to require syntax-checking on a block of statements
before executing those statements.
assignment statement allows you to assign a value
to any legal NCL construct
that can have a value, such as variables, arrays, and so forth.
is a statement that can be used to initialize variables and arrays
and is similar in function to type statements in other languages.
is used to exit NCL.
can be used to start and stop the recording of NCL commands in a file.
Currently supported math functions are:
NCL contains versions of most of the functions and procedures available to the
HLUs. For some of these, such as "draw", "delete" and so forth, the NCL
names have been shortened for convenience. The full HLU names are still
available in NCL if you want to use them. You may use whichever name you
prefer; the arguments will be identical.
- Function used to open a new data file (returns a file id).
- Function that returns True if all of the arguments in the input
logical array are True.
- Function that returns True if any of the arguments in the
input logical array is True.
- Function that reads ASCII files.
- Procedure that writes an ASCII data file from an NCL numeric data type.
- Function that reads binary files created with a C block I/O function write.
- Procedure that writes a binary file in raw C block I/O format from a
numeric data type.
- Procedure used to delete variables and free the symbol name from
the symbol table.
- Function that returns the sizes of the dimensions of any data array.
- Function that reads binary files created using an unformatted Fortran
- Procedure that writes a binary file, using Fortran unformatted writes,
of a numeric data type.
- Function that retrieves the values of shell environment variables.
- Function that retrieves the variable names from a file.
- Function that returns True if a specific attribute name is defined.
- Function that returns True if a specific dimension name is defined.
- Function that returns True if a specific file variable name is defined.
- Function that returns True if a specific file variable attribute name is defined.
- Function that returns True if a specific file variable dimension name is defined.
- Function that returns True if its argument references a missing value.
- Procedure that lists all of the current variables containing
references to files.
- Procedure that lists all of the variables associated with a
- Procedure that lists all of the HLU objects currently referenced by NCL.
- Procedure that lists all the currently defined NCL functions and
- Procedure that lists the currently defined variables.
- Procedure that prints the value of a variable (including file variables)
- Procedure that sorts singly-dimensioned numeric arrays in place.
- Procedure that sorts singly-dimensioned string arrays in place.
- Function that generates pseudo random numbers.
- Function that returns the size, in bytes, of its argument.
- Procedure that pauses execution for a specified number of seconds.
- Procedure that establishes a seed for the rand function.
- Procedure that passes UNIX system commands to the shell.
Conversion functions exist for every possible data conversion in
An intrinsic function is not defined by NCL source; it is a C or
Fortran routine that has been added to the NCL function set.
Intrinsic functions often perform operations that NCL source does not support.
For details on NCL intrinsic functions, see the
Intrinsic functions section of the NCL Reference Guide.
NCL allows you to define your own functions and procedures.
NCL functions and procedures are similar to functions and procedures in most
programming languages, but there are some distinct differences. For details
on procedures in general, see
NCL procedure overview. For specifics on the syntax of defining your
own functions and procedures, see
NCL functions and procedures definitions.
Please see the NCL Reference Manual for a discussion of
Extending NCL's function set.
- Procedure that provides access to the NhlClearWorkstation procedure for
- Procedure that provides access to the function NhlDataToNDC for
converting from data coordinates to NDC coordinates.
- Procedure that provides access to the NhlDestroy procedure for
removing HLU objects.
- Procedure providing access to the basic draw function NhlDraw.
- Procedure providing access to the HLU picture control function NhlFrame.
- Procedure providing access to the function NhlNDCToData for converting
from NDC coordinates to data coordinates.
- Function that adds an annotation to a plot.
- Function for adding one or more additional data items to a plot.
- Function returning the class name of one or more HLU objects.
- Procedure for drawing an immediate mode polyline using data coordinates.
- Procedure for drawing an immediate mode polygon using data coordinates.
- Procedure for drawing an immediate mode polymarker using data coordinates.
- Procedure for removing color index settings from specified workstations.
- Function for retrieving the bounding boxes of a list of HLU input
- Function for interrogating a workstation to see if a given color index
has been allocated.
- Function that returns the object name of an HLU object, given the HLU
- Procedure for drawing an immediate mode polyline using NDC coordinates.
- Procedure for drawing an immediate mode polygon using NDC coordinates.
- Procedure for drawing an immediate mode polymarker using NDC coordinates.
- Function used to allocate new workstation color indices.
- Procedure for removing annotations from plots.
- Procedure for removing data items from one or more plots.
- Procedure for removing one or more plots from an overlay.
- Procedure for defining workstation color indices.
- Procedure that forces an update of the internal state of a
- Procedure used to overlay one HLU plot object over a specific style of
- Procedure providing access to the HLU update workstation function
User Guide Control Panel
NG4.1 Home, Index, Examples, Glossary, Feedback, UG Contents, UG WhereAmI?
$Revision: 1.14 $ $Date: 1998/06/15 22:08:40 $