Next: , Previous: ncap2 netCDF Arithmetic Processor, Up: ncap2 netCDF Arithmetic Processor


4.1.1 Syntax of ncap2 statements

Mastering ncap2 is relatively simple. Each valid statement statement consists of standard forward algebraic expression. The fl.nco, if present, is simply a list of such statements, whitespace, and comments. The syntax of statements is most like the computer language C. The following characteristics of C are preserved:

Array syntax
Arrays elements are placed within [] characters;
Array indexing
Arrays are 0-based;
Array storage
Last dimension is most rapidly varying;
Assignment statements
A semi-colon ‘;’ indicates the end of an assignment statement.
Comments
Multi-line comments are enclosed within /* */ characters. Single line comments are preceded by // characters.
Nesting
Files may be nested in scripts using #include script. Note that the #include command is not followed by a semi-colon because it is a pre-processor directive, not an assignment statement. The filename script is interpreted relative to the run directory.
Attribute syntax
The at-sign @ is used to delineate an attribute name from a variable name.