Grids

Table of Contents

  1. Dimensions, Coordinate variables and Mappings
  2. Difference between Grids and Scattered Data
  3. Missing Data
  4. Processing Scattered Data

Dimensions, Coordinate variables and Mappings

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 (CV). This is a vector which defines a piecewise-linear mapping from subscript to physical dimension.

CVs are convenient when each array dimension maps to a single physical dimension. However, the relationship between array dimensions and physical dimensions may be more complex. Consider the example of a satellite image with dimensions line (row) and pixel (column). The physical dimension latitude depends on both array dimensions (line and pixel). There is a matrix (with the same line and pixel dimensions as the image) giving the latitude at each point. There is another similar longitude matrix. These two matrices define piecewise-bilinear mappings from line/pixel space to latitude/longitude space. The task of warping the image to latitude/longitude space is essentially that of defining mappings from latitude/longitude space to line/pixel space i.e. the inverses of the given mappings. This can be done using the NAP functions invert_grid and invert_grid_no_trim.

Difference between Grids and Scattered Data

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

Function scattered2grid interpolates scattered data onto a grid.

© 2002, CSIRO Australia. Author: Harvey.Davies@CSIRO.AU
CVS Version Details: $Id: grid.html,v 1.5 2004/11/08 04:33:41 dav480 Exp $