windowtotal
Sum of values within a specified square neighbourhood
Result = windowtotal(expression, windowlength)
--unittrue or --unitcell
For each cell its windowtotal is computed as follows. A square window with the cell in its centre is defined by windowlength. The windowlength is the length of the window in horizontal and vertical directions. For each cell i which is entirely or partly in the window the fraction of the cell in the window is determined. This is the area of the part of the cell in the window divided by the total area of a cell. Call this fraction(i); let expression(i) be the value on expression of cell i. Now, the windowtotal of the centre cell c is a fraction weighted sum of the values on expression:
where n is the number of cells which is entirely or partly in the window. For each cell c its windowtotal is computed and assigned to the corresponding cell on Result.
The cell value on windowlength should be greater than 0, else a missing value is assigned to the corresponding cell on Result.
A cell on windowlength with a missing value results in a missing value on Result at the corresponding cell. However, if a missing value on windowlength occurs in a cell which is not the centre cell of the window the value on expression in that cell is included in the summation of the cell values in the window.
This operation belongs to the group of Neigbourhood operators; window operators
Result1.map | Expr.map |
Result2.map | Expr.map | WinLen2.map |