<?xml version="1.0" encoding="UTF-8"?>
<toolchain saga-version="2.1.3">
  <group>ta_hydrology</group>
  <identifier>upslope_height</identifier>
  <name>Upslope Height, Slope, Aspect</name>
  <description>
	This tool calculates the mean height, mean slope and mean aspect of the upslope contributing area.
  </description>
  <menu>Flow Accumulation</menu>
  <parameters>
    <option varname="GRID_SYSTEM" type="grid_system">
      <name>Grid System</name>
    </option>
    <input varname="DEM" type="grid" parent="GRID_SYSTEM">
      <name>Elevation</name>
    </input>
    <output varname="HEIGHT" type="grid" parent="GRID_SYSTEM">
      <name>Upslope Height</name>
      <output_name>Height [Mean of Upslope Area]</output_name>
	  <colours>11</colours>
    </output>
    <output varname="SLOPE" type="grid" parent="GRID_SYSTEM">
      <name>Slope</name>
      <output_name>Slope [Mean of Upslope Area]</output_name>
	  <colours>9</colours>
    </output>
    <output varname="ASPECT" type="grid" parent="GRID_SYSTEM">
      <name>Aspect</name>
      <output_name>Aspect [Mean of Upslope Area]</output_name>
	  <colours>26</colours>
    </output>
    <option varname="FLOW_METHOD" type="choice">
      <name>Flow Distribution</name>
      <choices>Deterministic 8|Rho 8|Braunschweiger Reliefmodell|Deterministic Infinity|Multiple Flow Direction|Multiple Triangular Flow Direction|Multiple Maximum Downslope Gradient Based Flow Direction|</choices>
      <value>4</value>
    </option>
  </parameters>
  <tools>
    <tool library="ta_preprocessor" tool="2" name="Sink Removal">
      <input id="DEM">DEM</input>
      <output id="DEM_PREPROC">DEM_PREPROC</output>
      <option id="METHOD">1</option>
    </tool>
    <tool id="tool_02" library="ta_hydrology" tool="0" name="Catchment Area (Top-Down)">
      <input id="ELEVATION">DEM_PREPROC</input>
      <input id="VAL_INPUT">DEM</input>
      <output id="VAL_MEAN">MEAN</output>
      <option id="METHOD" varname="true">FLOW_METHOD</option>
    </tool>
    <tool id="tool_01" library="grid_calculus" tool="3" name="Grid Difference">
      <input id="A">MEAN</input>
      <input id="B">DEM</input>
      <output id="C">HEIGHT</output>
    </tool>
    <tool library="ta_morphometry" tool="0" name="Slope, Aspect, Curvature">
      <input id="ELEVATION">DEM</input>
      <output id="SLOPE">TMP</output>
      <output id="ASPECT">ASPECT</output>
      <option id="METHOD">6</option>
    </tool>
    <tool library="ta_hydrology" tool="0" name="Catchment Area (Top-Down)">
      <input id="ELEVATION">DEM_PREPROC</input>
      <input id="VAL_INPUT">TMP</input>
      <output id="VAL_MEAN">SLOPE</output>
      <option id="METHOD" varname="true">FLOW_METHOD</option>
    </tool>
    <tool library="grid_calculus" tool="1" name="Grid Calculator">
      <input id="GRIDS">ASPECT</input>
      <output id="RESULT">TMP</output>
      <option id="NAME">sin(aspect)</option>
      <option id="FORMULA">sin(g1)</option>
    </tool>
    <tool library="ta_hydrology" tool="0" name="Catchment Area (Top-Down)">
      <input id="ELEVATION">DEM_PREPROC</input>
      <input id="VAL_INPUT">TMP</input>
      <output id="VAL_MEAN">SIN_ASPECT</output>
      <option id="METHOD" varname="true">FLOW_METHOD</option>
    </tool>
    <tool library="grid_calculus" tool="1" name="Grid Calculator">
      <input id="GRIDS">ASPECT</input>
      <output id="RESULT">TMP</output>
      <option id="NAME">cos(aspect)</option>
      <option id="FORMULA">cos(g1)</option>
    </tool>
    <tool library="ta_hydrology" tool="0" name="Catchment Area (Top-Down)">
      <input id="ELEVATION">DEM_PREPROC</input>
      <input id="VAL_INPUT">TMP</input>
      <output id="VAL_MEAN">COS_ASPECT</output>
      <option id="METHOD" varname="true">FLOW_METHOD</option>
    </tool>
    <tool library="grid_calculus" tool="1" name="Grid Calculator">
      <input id="GRIDS">COS_ASPECT</input>
      <input id="GRIDS">SIN_ASPECT</input>
      <output id="RESULT">ASPECT</output>
      <option id="FORMULA">mod((180 + 270) - (atan2(g1, g2) * 180 / pi()), 360)</option>
    </tool>
  </tools>
</toolchain>
