Grids

Traditional array-processors, such as APL, are based on a data-model which has discrete dimensions whose corresponding subscripts take integer values. NAP handles such traditional arrays in the traditional manner. However NAP is based on a more general data-model which also allows non-integer subscript values. These values represent distances along dimensions which often correspond to the physical dimensions of spacio-temporal spaces, which are of course continuous.

If desired, a dimension can have an associated variable called the coordinate variable. This is a vector which defines a piecewise-linear mapping from subscript to physical dimension.

Data in a continuous space with two or more dimensions can be either gridded or scattered. NAP's data-model (with continuous subscripts, coordinate variables, etc.) facilitates the processing of gridded data.

Let us consider the case of two dimensions i.e. matrices. Two-dimensional gridded data is aligned in rows and columns, whereas scattered data is not. The following examples are intended to illustrate the difference between scattered and gridded 2D data.

Example of Scattered 2D Data (Not a Grid)

Note that the data are not aligned in rows and columns.

Example of 2D Grid

The following example has the grid in black. The blue point is not on the grid and has non-integer subscript values (2.1, 1.6). The coordinate variables are latitude and longitude.

column 0 1 1.6 2 3 4
longitude 30°E 40°E 52°E 60°E 65°E 75°E
row latitude
0 30°N
1 25°N
2 10°N
2.1 8°N
3 10°S

Missing Data

The NAP data model allows any element of an array to have a value which is a missing-value. Such elements are considered null or missing and are treated specially in operations such as arithmetic. Thus adding a missing value to anything produces a missing value.

The following example is similar to that above. However four grid points are missing. These are shown in red.

column 0 1 1.6 2 3 4
longitude 30°E 40°E 52°E 60°E 65°E 75°E
row latitude
0 30°N
1 25°N
2 10°N
2.1 8°N
3 10°S

The missing points are treated as if they did not exist, as shown in the following:

column 0 1 1.6 2 3 4
longitude 30°E 40°E 52°E 60°E 65°E 75°E
row latitude
0 30°N
1 25°N
2 10°N
2.1 8°N
3 10°S

It would be possible to represent scattered data by a grid with many missing points. In the extreme, each scattered point would have its own row and its own column. There would be only one non-missing point in each row. There would be only one non-missing point in each column. Of course this would be very inefficient for a matrix of significant size.

Processing Scattered Data

NAP has no facilities for directly processing scattered data. However it is possible to define a grid from scattered data. This can be done by

  • defining a least-squares best-fit n-dimensional surface and then using this to define the grid values
  • using Delaunay triangulation (not yet implemented)

    © 2002, CSIRO Australia. Author: Harvey.Davies@CSIRO.AU
    CVS Version Details: $Id: grid.html,v 1.1 2002/08/07 08:09:24 dav480 Exp $