Measuring Characteristic Scales

Finding scales of most extreme parameter values

This example measures the given parameter (e.g. slope, profile curvature etc.) over a range of scales, and finds the scale at which that parameter is most extreme (either positive or negative). Output consists of two rasters, one containing the measured parameter, the other the window size at which the parameter is most extreme. Can be used to explore scale sensitivity of a surface.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Script to measure surface parameter at characteristic scales.
version(1.0); 
 
# Change the directory below to correspond to your file location.
baseDir = "c:/Program Files/LandSerf/data/landscriptExamples/";

# Change the three values below to define the parameter to explore and the
# scale range over which that parameter is to be measured.
param = "planc"; 
maxWinSize = 35; 
minWinSize = 3; 

# Open the dem to analyse and create the rasters to store parameter and scale.
dem = open(baseDir & "dem.srf"); 
scaleMax = new(dem); 
scaleMax = minWinSize; 
maxParamSurf = surfparam(dem,param,minWinSize,1.0); 
winSize = minWinSize+2; 
maxParam = 0; 

# Loop through each window size comparing parameter with previous extreme values.
while (winSize <= maxWinSize); 
{ 
    echo("Calculating "&param&" using "&winSize&"x"&winSize&" window.");
    paramSurf = surfparam(dem_, param, winSize, 1.0); 
    scaleMax = ifelse(abs(paramSurf) > abs(maxParamSurf), winSize, scaleMax); 
    maxParamSurf=ifelse(abs(paramSurf) > abs(maxParamSurf), paramSurf, maxParamSurf); 
    winSize = winSize + 2; 
} 

# Add metadata to the two new rasters. 
colouredit(scaleMax,"rules",minWinSize&" 255 255 255, "& maxWinSize&" 0 0 0"); 
edit(scaleMax,"title",param&" characteristic scale");
edit(scaleMax,"notes","Window size at which "&param&" values are most extreme.");

edit(maxParamSurf,"title","Extreme "&param);
edit(maxParamSurf,"notes",param&" calculated with window sizes from "&
                          minWinSize&" to "&maxWinSize&". Contains the largest "&
                          "absolute value of the parameter over the range of scales.");

# Save the two new rasters 
save(maxParamSurf,baseDir&"max"&param&".srf"); 
save(scaleMax,baseDir&"charScale"&param&".srf");
maxplanc.srf:
maxplanc.srf

charScaleplanc.srf:
charScaleplanc.srf