Teaching Research CV/Pubs Contact Links
 
 
 

Multidimensional Map Algebra (MMA)

 

Details of MMA

(from Mennis, J., Leong, J., and Khanna, R., 2005. Multidimensional map algebra. Proceedings of the 8th International Conference on GeoComputation, August 1-3, Ann Arbor, MI.)

 

1. Spatio-Temporal Data Types, NeighborhoodS, and Lags

 

1.1 Data Types

MMA specifies the following data types for encoding temporal, spatial, and spatio-temporal data:

 

TimeSeries

Grid

TimeCube

SpaceCube

HyperCube

 

A TimeSeries maps a set of values to a set of regular temporal positions.  A Grid (i.e. a conventional raster) maps a set of values to a set of regularly spaced planimetric positions. A TimeCube maps a set of values to a set of regularly spaced planimetric and temporal positions.  A SpaceCube maps a set of values to a set of regularly spaced planimetric and altitudinal positions. A HyperCube maps a set of values to a set of regularly spaced planimetric, altitudinal, and temporal positions. An individual TimeSeries, Grid, TimeCube, SpaceCube, or HyperCube data set is referred to as a layer.  An individual position in any layer is referred to as an element, and each element is associated with a single variable value.

The letters X, Y, Z, and T are used in the conventional manner to refer to various spatial and temporal dimensions.  The X and Y dimensions of a Grid specify planimetric position, where a [0,0] origin is specified at the lower left corner of the grid and X refers to the east-west axis and Y refers to the north-south axis.  The Z dimension refers to the altitudinal axis, with the origin at the lowest altitude, and the T dimension refers to the temporal axis, with the origin at the earliest time.  Thus, for example, a Grid element’s position can be specified as a [X,Y] coordinate value and a HyperCube element’s position can be specified as a [X,Y,Z,T] coordinate value.

Each data type is implemented as a JAVA class with a float array of one or more dimensions as an attribute of the class.  Thus, each element’s temporal, spatial, or spatio-temporal position in a layer is encoded as its position in the multidimensional array, and the element’s value is the value encoded for that array position.  The TimeSeries data type is implemented as a one-dimensional array [T], the Grid as a two-dimensional array [X,Y], the TimeCube and SpaceCube as three dimensional arrays [X,Y,T] and [X,Y,Z], respectively, and the HyperCube as a four dimensional array [X,Y,Z,T].  These classes also store information on spatial and temporal referencing and resolution, as well as a reserved value for indicating ‘no data.’

1.2 Neighborhoods

Other data types specified by MMA are used to define a neighborhood.  A neighborhood indicates the region considered proximal to a given element position.  Neighborhoods are used in conventional map algebra focal functions, where they can take the form of rectangle, circle, or wedge shapes of various sizes.  MMA neighborhoods extend these two-dimensional shapes to multiple dimensions, including the following data types, where the beginning of the data type indicates its appropriate dimensionality:

TNeighborhood

XYNeighborhood

XYZNeighborhood

XYTNeighborhood

XYZTNeighborhood

A TNeighborhood is defined simply by a temporal range.  XYNeighborhood is extended to represent either a rectangle or circle shape:

XYRectangle

XYCircle

XYZNeighborhood is extended to represent cubic and spherical neighborhoods:

XYZRectangle

XYZCircle

XYTNeighborhood is extended to represent neighborhoods that may best be conceptualized as a space-time cube and space-time cylinder, where the radius of the cylinder reflects a spatial radius and the length-wise axis of the cylinder reflects a temporal range:

XYTRectangle

XYTCircle

Of course, because the spatial and temporal dimensions do not use the same units of measurement (i.e. meters and hours are not equivalent), the user has the option of defining the neighborhood extent independently for the spatial and temporal dimensions.

XYZTNeighborhood is extended to represent extensions of rectangle and circle shapes to four dimensions, three spatial and one temporal:

XYZTRectangle

XYZTCircle

In addition, users can define custom neighborhoods of irregular shapes in space and space-time.

1.3 Lags

A lag is an offset from an element that certain MMA functions can utilize.  For example, a focal function may compute on a neighborhood that is not centered on the element position for whose value it is calculating but rather offset a certain distance (or time) away.  Lags may be specified for each type of layer depending on whether an offset in time, space, or space time is appropriate:

TLag

XYLag

XYZLag

XYTLag

XYZTLag

 

2. FUNCTIONS

 

Like conventional map algebra, MMA functions can be categorized according to the local, focal, zonal, or global nature of the function.  As noted above, each function (with the exception of global functions) also typically applies a mathematical, relational, or statistical calculation.  The following calculations are supported in the current implementation of MMA: 

 

Mathematical                Add, Subtract, Multiply, Divide

Comparative                 GreaterThan LessThan, EqualTo

Statistical                     Minimum, Maximum, Mean, Median, Range, Variance

 

The functions are referred to by the category name followed by the type of calculation, for example:

 

LocalAdd

FocalMaximum

ZonalMean

 

Each MMA function is implemented as a JAVA class.  Each function class contains a method called ‘execute’ that is called to execute the function, and which is overloaded to handle different combinations of layer types as inputs to the method and for user-defined function parameterization. 

 

2.1 Local Functions

A local function ingests at least one layer and outputs one layer.  There are several types of input parameter combinations:

 

One layer and a scalar value

For example, a LocalAdd that ingests a spacecube and the value ‘5’ would output a spacecube in which each element is equal to the sum of 5 + the value of the analogous element in the input spacecube.    

 

Two layers of the same type

For example, a LocalAdd that ingests two spacecubes would output a spacecube in which each element is equal to the sum of the elements that share the same position in the two input layers.   

 

A list of layers of the same type

For example, a LocalAdd that ingests a list of spacecubes would output a spacecube in which each element is equal to the sum of the elements that share the same position in all the input spacecubes. 

 

One layer and another layer of fewer dimensions

For example, a LocalAdd that ingests a spacecube and a grid would output a grid in which each element is equal to the sum of the elements that share the same position in the two input layers.  Note that for each element in the grid there will be many elements in the spacecube that share its position, as for every planimetric coordinate the spacecube will contain many altitudinal positions.  This function is restricted to cases where the second input layer (e.g. a grid in the example given here) has a subset of the dimensions of the first input layer (e.g. a spacecube).

 

Within the local function category there is also another category called rollup functions.  These functions transform an input layer into another layer type with fewer dimensions using a mathematical summarization.  For example, a LocalRollUpZMean that ingests a spacecube would output a grid by taking the mean of all elements in the Z dimension for each [X,Y] element position.

The basic syntax for local functions is:

outlayer = localFunction.execute(inlayer1, inlayer2)

where ‘outlayer’ is the name of the layer generated by the function, ‘localFunction’ is the name of the local function, ‘execute’ is the name of the method called to invoke the function, ‘inlayer1’ is the name of the first input layer, and ‘inlayer2’ is the name of the second input layer.  Other method signatures are made to operate on lists of two or more layers, to lag one layer by another in the X, Y, Z, and/or T dimensions, and to combine layers of different types. 

2.2 Focal Functions

A focal function ingests at least one layer and one neighborhood and outputs one layer of the same type as the input layer.  For example, a FocalAdd that ingests a spacecube and a cubic neighborhood would output a spacecube in which each element is assigned the sum of the element values located within the cubic neighborhood of each element.  Focal functions can also ingest a lag to offset the neighborhood during the focal iteration.  It is also possible to pass a list of neighborhoods and/or a list of lags into a focal function.  If a list of neighborhoods (lags) is used, the focal function will utilize a separate neighborhood (lag) for each element’s focal calculation.

 

The basic syntax for focal functions is:

outlayer = focalFunction.execute(inlayer, neighborhood, lag)

where ‘outlayer’ is the name of the layer generated by the function, ‘focalFunction’ is the name of the focal function, ‘execute’ is the name of the method called to invoke the function, ‘inlayer’ is the name of the input layer, ‘neighborhood’ is the user-specified focal neighborhood, and ‘lag’ is the user-specified lag. 

2.3 Zonal Functions

A zonal function ingests a zone layer and a value layer and outputs a table.  For example, a ZonalAdd that ingests a zone spacecube and a value spacecube will output a table in which each record represents one zone and for each zone is calculated the sum of all the value spacecube’s elements contained within that zone.  The zone layer must be either the same type as the value layer, or a type with a subset of the dimensions of the value layer.  For example, a ZonalAdd that ingests a zone grid and a value spacecube will output a table in which each record represents a grid zone and for each zone is calculated the sum of all the value spacecube’s elements contained within that zone.  Note that in this case, there will be multiple spacecube elements associated with each grid element, as there will be many altitudinal positions in the spacecube associated with each planimetric position in the grid.

The basic syntax for zonal functions is:

outtable = zonalFunction.execute(inzonelayer, invaluelayer)

where ‘outtable’ is the name of the table generated by the function, ‘zonalFunction’ is the name of the zonal function, ‘execute’ is the name of the method called to invoke the function, ‘inzonelayer’ is the name of the zone layer, and ‘invaluelayer’ is the name of the value layer.  Like MMA local functions, zonal functions can also combine layers of different types, provided that the dimensions of the zone layer type are a subset of the dimensions of the value layer type (e.g. a timeseries zone layer and a timecube value layer).