This tool calculates the horizon angle (** Sx**), i.e. the maximum
slope along a specified azimuth (0-360 degrees) for each grid cell in an input
digital elevation model (DEM).

The user is able to constrain the maximum search distance for the ray tracing by entering a valid maximum search distance value (in the same units as the X-Y coordinates of the input raster DEM). If the maximum search distance is left blank, each ray will be traced to the edge of the DEM, which will add to the computational time.

In addition to the horizon angle, the user can opt to save the distance to
horizon, i.e. the distance between a grid cell and the location of its
maximum slope along the specified azimuth. If ** Sx** is negative,
the algorithm will calculate the distance to horizon as the distance from the
grid cell to the edge of the DEM along the ray, and the distance will be reported
using a negative value, to indicate that it has been artificially truncated.
Distance to horizon can be considered a measure of fetch. This algorithm may
suffer from edge effects, which could have the effect of negatively biasing the
distance to horizon, particularly in exposed areas near an edge of the DEM.

Maximum upwind slope should not be calculated for very extensive areas over which the Earth's curvature must be taken into account. Also, this index does not take into account the deflection of wind by topography. However, averaging the horizon angle over a window of directions can yield a more robust measure of exposure, compensating for the deflection of wind from its regional average by the topography. For example, if you are interested in measuring the exposure of a landscape to a northerly wind, you could perform the following calculation:

*Sx(N) = [Sx(345)+Sx(350)+Sx(355)+Sx(0)+Sx(5)+Sx(10)+Sx(15)] / 7*

Ray-tracing is a highly computationally intensive task and therefore this
tool may take considerable time to operate for larger sized DEMs.
** NoData** valued grid cells in the input image will be
assigned

The following is an example of a Python script that uses this tool:

```
wd = pluginHost.getWorkingDirectory()
```

inputFile = wd + "input.dep"

outputFile = wd + "output.dep"

azimuth = "215.0"

maxDist = "not specified"

distFile = "not specified"

args = [inputFile, outputFile, azimuth, maxDist, distFile]

pluginHost.runPlugin("HorizonAngle", args, False)

This is a Groovy script also using this tool:

```
def wd = pluginHost.getWorkingDirectory()
```

def inputFile = wd + "input.dep"

def outputFile = wd + "output.dep"

def azimuth = "215.0"

def maxDist = "5000.0"

def distFile = wd + "dist.dep"

String[] args = [inputFile, outputFile, azimuth, maxDist, distFile]

pluginHost.runPlugin("HorizonAngle", args, false)

- John Lindsay (2012) email: jlindsay@uoguelph.ca