<?xml version="1.0" encoding="UTF-8"?>
<toolchain saga-version="2.2.4">
	<group>tta_tools</group>
	<identifier>tta_LandCover</identifier>
	<name>Land Cover Scenario Offset</name>
	<author>R.Fisher (c) 2015</author>
	<description>
		Prepare your scenario for subsequent travel time analysis with information on topography, road network, and vegetation cover.
		Topography is used for automated channel network delineation. Resulting channels are categorized by their Strahler order. In the final land cover map channels use numbers above 100 (i.e. '101, 102, 103, ...' representing increasing Strahler orders). Likewise roads use numbers above 200 with the exact number based on the attribute chosen to specify the road type (i.e. 201, 202, 203, ...). Vegetation cover takes the original numbers for the final map, so these should not intermingle with numbers used for channel and road representation.

		Find further information at Rohan Fisher's web page on &lt;a href="http://rohanfisher.wordpress.com/travel-time-modelling-saga/"&gt;Travel Time Modelling with SAGA&lt;/a&gt;.
	</description>
	<reference>
		<authors>Fisher, R., and Lassa, J.</authors>
		<year>2017</year>
		<title>Interactive, open source, travel time scenario modelling: tools to facilitate participation in health service access analysis</title>
		<where>International Journal of Health Geographics, 16(13).</where>
		<doi>10.1186/s12942-017-0086-8</doi>
	</reference>
	<reference>
		<authors>Ray, N., and Ebener, S.</authors>
		<year>2008</year>
		<title>AccessMod 3.0: computing geographic coverage and accessibility to health care services using anisotropic movement of patients</title>
		<where>International Journal of Health Geographics, 7(63).</where>
		<doi>10.1186/1476-072X-7-63</doi>
	</reference>
	

	<!-->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
	///////////////////////////////////////////////////////
	<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<-->
	<parameters>
		<input varname="ROAD_LINES" type="shapes">
			<name>Roads</name>
		</input>
		<option varname="ROAD_CLASS" type="table_field" parent="ROAD_LINES">
			<name>Attribute</name>
			<description>attribute specifying road's type with regard to travel time</description>
		</option>

		<input varname="CHANNEL_LINES" type="shapes" optional="true">
			<name>Channel Network</name>
		</input>
		<option varname="CHANNEL_ORDER" type="table_field" parent="CHANNEL_LINES">
			<name>Stream Order</name>
		</option>
		<option varname="DEM_SYSTEM" type="grid_system">
			<condition type="not_exists">CHANNEL_LINES</condition>
			<name>Grid System</name>
		</option>
		<input varname="DEM" type="grid" parent="DEM_SYSTEM">
			<name>Elevation</name>
		</input>

		<option varname="LANDCOVER_SYSTEM" type="grid_system">
			<name>Grid System</name>
		</option>
		<input varname="VEGETATION" type="grid" parent="LANDCOVER_SYSTEM">
			<name>Vegetation</name>
		</input>
		<output varname="LANDCOVER" type="grid" parent="LANDCOVER_SYSTEM">
			<name>Land Cover</name>
			<output_name>Land Cover</output_name>
			<colours>14</colours>
		</output>
	</parameters>


	<!-->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
	///////////////////////////////////////////////////////
	<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<-->
	<tools>
		
		<!-->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
			1.) channel network
		<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<-->

		<tool library="grid_tools" tool="33" name="Copy Grid">
			<input  id="GRID">VEGETATION</input>
			<output id="COPY">CHANNEL_GRID</output>
		</tool>

		<condition type="exists" variable="CHANNEL_LINES">
			<if>
				<tool library="grid_gridding" tool="0" name="Shapes to Grid">
					<option id="MULTIPLE">3</option>
					<option id="TARGET_DEFINITION">1</option>
					<input  id="INPUT">CHANNEL_LINES</input>
					<option id="FIELD" varname="true">CHANNEL_ORDER</option>
					<output id="GRID">CHANNEL_GRID</output>
				</tool>
			</if>
			<else>
				<tool library="ta_preprocessor" tool="2" name="Sink Removal">
					<input  id="DEM">DEM</input>
					<output id="DEM_PREPROC">DEM_NOSINKS</output>
				</tool>
				<tool library="ta_channels" tool="5" name="Channel Network and Drainage Basins">
					<option id="THRESHOLD">5</option>
					<input  id="DEM">DEM_NOSINKS</input>
					<output id="SEGMENTS">CHANNEL_LINES</output>
				</tool>
				<tool library="grid_gridding" tool="0" name="Shapes to Grid">
					<option id="OUTPUT">2</option>
					<option id="MULTIPLE">3</option>
					<option id="TARGET_DEFINITION">1</option>
					<input  id="INPUT">CHANNEL_LINES</input>
					<option id="FIELD" varname="false">ORDER</option>
					<output id="GRID">CHANNEL_GRID</output>
				</tool>
			</else>
		</condition>

		
		<!-->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
			2.) road network
		<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<-->

		<tool library="grid_tools" tool="33" name="Copy Grid">
			<input  id="GRID">VEGETATION</input>
			<output id="COPY">ROADS_GRID</output>
		</tool>

		<tool library="grid_gridding" tool="0" name="Shapes to Grid">
			<option id="MULTIPLE">2</option>
			<option id="TARGET_DEFINITION">1</option>
			<input  id="INPUT">ROAD_LINES</input>
			<option id="FIELD" varname="1">ROAD_CLASS</option>
			<output id="GRID">ROADS_GRID</output>
		</tool>


		<!-->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
			3.) combine roads, channels, vegetation
		<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<-->

		<tool library="grid_calculus" tool="1" name="Grid Calculator">
			<option id="FORMULA">ifelse(gt(g1,0),200+g1,ifelse(gt(g2,0),100+g2,ifelse(gt(g3,0),g3,nodata())))</option>
			<option id="USE_NODATA">TRUE</option>
			<option id="TYPE">4</option>
			<input  id="GRIDS">ROADS_GRID</input>
			<input  id="GRIDS">CHANNEL_GRID</input>
			<input  id="GRIDS">VEGETATION</input>
			<output id="RESULT">LANDCOVER</output>
		</tool>
	</tools>
</toolchain>
