NAP is a loadable extension of Tcl. NAP 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:
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:
$" prefixes)
The nap_get command creates a NAO from data read from
a binary, HDF or netCDF file.
Some platforms (only Linux on Intel 386 at the time of writing)
support reading of remote virtual
netCDF files provided by
OPeNDAP
(a.k.a. DODS) web servers.
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.
The caps/nap GUI provides browsers for: