Overview of NAP (N-Dimensional Array Processor)

NAP is a loadable extension of Tcl which provides a powerful and efficient facility for processing data in the form of n-dimensional arrays. It has been designed to provide a tcl-flavoured array-processing facility with much of the functionality of languages such as APL, Fortran-90, IDL, J, matlab and octave. Three other tcl extensions which provide array-processing facilities are TiM, BLT and Tk3D.

Existing Tcl facilities (e.g. Tcl variables and procedures) are used where appropriate. The new facilities have been designed to match similar existing ones. In particular, NAP expressions use conventions which are essentially a superset of those of the Tcl expr command. Support is provided for data based on n-dimensional grids, where the dimensions correspond to continuous spatial coordinates. There are interfaces to the HDF and netCDF file formats commonly used for such data, especially in Earth sciences such as Oceanography and Meteorology. There is a new photo image format for NAP data.

NAP was developed as part of the CSIRO CAPS project, but can be loaded and used without the (satellite oriented) CAPS extension. However the CAPS extension requires NAP since most CAPS data are stored as NAOs.

Data are stored in memory as n-dimensional array objects (NAOs), which include information such as:

There are eleven data-types, six for integers, two for floating-point, one for characters, one pointer type (allowing arrays of arrays) and a ragged type providing a form of compression.

NAOs are created by the Tcl commands nap and nap_get.

The nap command takes arguments specifying an expression in a manner similar to the expr command. However, unlike expr, nap provides:

The nap_get command creates a NAO from data read from a binary, HDF or netCDF file.

Every NAO has an associated Tcl command called an object-oriented command (OOC). This is used to:

As usual in Tcl, OOC and nap_get command options can be abbreviated provided there is no ambiguity.

NAP provides many operators and built-in functions. One can define new functions by defining Tcl procedures with the proc command. It is also possible to call functions written in C and Fortran.

Author: Harvey Davies       © 2002, CSIRO Australia.       Legal Notice and Disclaimer
CVS Version Details: $Id: overview.html,v 1.7 2003/05/20 05:31:36 dav480 Exp $