# Turning bands simulation

This tool can be used to create a random field using the turning bands algorithm. The user must specify the name of a base raster image from which the output raster will derive its geographical information, dimensions (rows and columns), and other information. In addition, the range, in x-y units, must be specified. The range determines the correlation length of the resulting field. For a good description of how the algorithm works, see Carr (2001). The turning bands method creates a number of 1-D simulations (called bands) and fuses these together to create a 2-D error field. There is no natural stopping condition in this process, so the user must specify the number of bands to create. The default value of 1000 is reasonable. The fewer iterations used, the more prevalent the 1-D simulations will be in the output error image, effectively creating artifacts. Run time increases with the number of iterations.

Turning bands simulation is a commonly applied technique in Monte Carlo style simulations of uncertainty. As such, it is frequently run many times during a simulation (often 1000s of times). When this is the case, algorithm performance and efficiency are key considerations. The tool can optionally be run in 'fast mode' which places the output grid entirely in memory. This may not be possible for larger rasters or on computers with limited memory resources. The Stochastic Depression Analysis tool is an example of a tool that uses the turning bands method for a Monte Carlo based uncertainty analysis to create each of the realizations.

## Scripting:

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

``` wd = pluginHost.getWorkingDirectory() inputFile = wd + "input.dep" outputFile = wd + "output.dep" range = "265.0" numIterations = "1000" fastMode = "true" args = [inputFile, outputFile, range, numIterations, fastMode] pluginHost.runPlugin("TurningBands", 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 range = "265.0" def numIterations = "1000" def fastMode = "true" String[] args = [inputFile, outputFile, range, numIterations, fastMode] pluginHost.runPlugin("TurningBands", args, false) ```

## References:

• Carr, JR. 2002. Data visualization in the geosciences. Prentice Hall, 267 pp.