Result = windowaverage(expression, windowlength)

spatial scalar


spatial, non spatial scalar


spatial scalar


--unittrue or --unitcell


windowlength is measured in true length (default)


windowlength is measured in number cell lengths


For each cell its windowaverage 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 expression value of cell i. Now, the windowaverage(c) of the centercell is computed by taking a fraction weighted average of the values on expression:

\[windowavaverage(c) = { { \sum^n_{i=1} ( fraction(i) * expression(i) ) } \over \sum^n_{i=1} fraction(i) }\]

where n is the number of cells which is entirely or partly in the window. For each cell c its windowaverage 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 expression value 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


  1. • pcrcalc
    Result1 =;
    Expr =;
    report Result1 = windowaverage( Expr, 6);

    • python
    Expr = readmap(“”)
    Result1 = windowaverage( Expr, 6)

    ../../_images/windowaverage_Result1.png ../../_images/windowaverage_Expr.png

  2. • pcrcalc
    Result2 =;
    Expr =;
    WinLen2 =;
    report Result2 = windowaverage( Expr, WinLen2);

    • python
    Expr = readmap(“”)
    WinLen2 = readmap(“”)
    Result2 = windowaverage( Expr, WinLen2)

    ../../_images/windowaverage_Result2.png ../../_images/windowaverage_Expr.png ../../_images/windowaverage_WinLen2.png