1.4. Neighbourhood operations: windows, frictions paths, visibility analysis

1.4.1. Introduction

Neighbourhood operations relate a cell to its neighbours. The value of each cell is changed on basis of a relation with neighbouring cells or flow of material (for instance water) from neighbouring cells. A rich suite of neighbourhood operators is available in PCRaster. This section introduces you to the window operators, operators for calculating distances over a map (spreading) and operators for visibility analysis. The next section covers neighbourhood operators for catchment analysis.

1.4.2. Direct neighbourhood operations: window operations

The window operators calculate statistical values (for instance average value, maximum value) of cells within a window that moves over the map. For each cell a new value is calculated on basis of the cell values within a square window around the cell. A wide range of window operators is available, but in the exercises only the windowaverage and windowdiversity will be used.

The map of the unsaturated zone (unsatMap) is rather ‘noisy’ and there are relatively many spikes and holes. This may be partly due to the interpolation routines used to create the surface elevation map and the phreatic level map. To create a smoother map from the unsatMap the windowaverage operator can be used.

The syntax of the windowaverage operator is: Result = windowaverage(expression, windowlength) where expression is the input map of scalar data type. The windowlength defines the size of the window used, it is the length of the square window in the distance units used on the maps.

The next windowaverage operation requires the unsatMap, created in a previous section. If you have not yet created it in your current session, recreate it by typing:

unsatMap = topoMap - phreaticMap <Enter>

Then, type:

unsat150Map  = windowaverage(unsatMap,150) <Enter>
unsat250Map  = windowaverage(unsatMap,250) <Enter>

Question: What is the size of the window, counted in number of cells, used for the calculation of unsat150Map? Keep in mind that the size of one cell is equal to 50 by 50 metres!

  1. 1 cell by 1 cell

  2. 2 cells by 2 cells

  3. 3 cells by 3 cells

  4. 4 cells by 4 cells

Correct answers: c.

Feedback: The length of one cell is 50, so using a windowlength map of 150, the operation will use a 3 x 3 cell window.



Question: How does the windowaverage operator affect the frequency distribution of the values in the maps?

  1. The windowaverage operator decreases the variation in the map and thus the frequency distribution. The larger the window, the more the variation is diminished.

  2. The windowaverage operator increases the diversity in the map and thus enlarges the frequency distribution. The larger the window, the more the variation is enlarged.

  3. The windowaverage operator does not affect the frequency distribution at all, since it originated from the data retreived from the input map.

Correct answers: a.

Feedback: None


The spatial diversity of an area can be studied with the windowdiversity operator. It has a syntax that corresponds with the windowaverage operator, but the input expression must have a data type boolean, nominal or ordinal. Try:

soidi150Map = windowdiversity(soilsMap,150) <Enter>

Also try it for different window lengths, e.g. 500.

Question: Explain the operation performed by the windowdiversity operator.

  1. The windowdiversity operator finds the number of different cell values within a window and assigns this number to the cell for the result.

  2. The windowdiversity operator determines the diversity within a window by calculating the differences between the cell values in that window.

  3. The windowdiversity operator calculates the standard deviation per window and assigns that value to the cell.

Correct answers: a.

Feedback: None


1.4.3. Entire neighbourhood operations: absolute distance calculation

The spread operator is used to calculate for each cell the shortest distance to non zero cell values on a boolean, nominal or ordinal map. This distance may be absolute (the real distance) or relative (taking into account frictions). Both kind of distances can be calculated with the same spread operator.

First, calculation of the absolute distance will be explained. The next section covers relative distances.

The syntax of the spread operator is: Result = spread(pointsexpression, initialdist, friction) where pointsexpression is a map of data type boolean, nominal or ordinal. The initialdist and friction are meant for calculation of relative distances (see next section), if set to 0 and 1 respectively the absolute distance will be calculated, like it will be done in this section.

The wellsMap is a boolean map with wells used for drink water supply in the area. Display it. Now, try:

welldistMap = spread(wellsMap,0,1)  <Enter>

And display inputs and outputs.

Protection zones are to be designated in the area surrounding wells used for drinking water supply. Create a boolean map (call it wellprotMap) that is TRUE in the area within 200 m distance (excluding a distance of 200 m itself) from wells and FALSE in the area further away from wells.


Question: For how many wells do their protection zones overlap (or are connected)?

  1. 2

  2. 11

  3. 4

  4. 7

Correct answers: a.

Feedback:

welldistMap = spread(wellsMap,0,1)
wellprotMap = welldistMap < 200

1.4.4. Entire neighbourhood operations: relative distance calculation

In the previous section, the friction map in the spread operator was set to 1 to obtain the absolute distance. By defining a different friction value or a map with friction values, friction can be included in the calculation and relative distances (for instance time) can be calculated. For instance, assume that the water is transported from the wells by a waterworks network (Dutch ‘waterleiding netwerk’). On average, it takes 3 seconds for the water to be transported one metre. A map with the total travel time for the water from the nearest well to each cell is calculated as follows:

welltimeMap = spread(wellsMap,0,3) <Enter>

Display welltimeMap. It gives for each cell the time needed for the water to reach the cell under consideration (from the nearest well). The spread operator has multiplied the distance (in metres) with the time needed to move one metre.