<?xml version="1.0" encoding="UTF-8"?>
<toolchain saga-version="4.1.0">
	<group>climate_tools</group>
	<identifier>t_downscale_bulk</identifier>
	<menu absolute="true">Climate and Weather|Temperature</menu>
	<name>Lapse Rate Based Temperature Downscaling (Bulk Processing)</name>
	<author>O.Conrad (c) 2017</author>
	<description>
		The [[i]]Lapse Rate Based Temperature Downscaling[[/i]] is quite simple, but might perform well for mountainous regions, where the altitudinal gradient is the main driver for local temperature variation. First, a given lapse rate is used to estimate sea level temperatures from elevation and temperature data at a coarse resolution. Second, the same lapse rate is used to estimate the terrain surface temperature using higher resoluted elevation data and the spline interpolated sea level temperatures from the previous step.
	</description>
	
	<parameters>
		<option varname="LORES_GRID_SYSTEM" type="grid_system">
			<name>Coarse Resolution</name>
		</option>
		<input varname="LORES_DEM" type="grid" parent="LORES_GRID_SYSTEM">
			<name>Elevation</name>
		</input>
		<input varname="LORES_T" type="grid_list" parent="LORES_GRID_SYSTEM">
			<name>Temperature</name>
		</input>

		<option varname="HIRES_GRID_SYSTEM" type="grid_system">
			<name>High Resolution</name>
		</option>
		<input varname="HIRES_DEM" type="grid" parent="HIRES_GRID_SYSTEM">
			<name>Elevation</name>
		</input>
		<output varname="HIRES_T" type="grid_list" parent="HIRES_GRID_SYSTEM">
			<name>Temperature</name>
		</output>
		
		<option varname="LAPSE_RATE" type="double">
			<name>Constant Lapse Rate</name>
			<value min="0.0">0.6</value>
			<description>constant lapse rate in degree of temperature per 100 meter. used if no lapse rate grid is specified.</description>
			<condition type="not_exists">LAPSE_RATES</condition>
		</option>
	</parameters>

	<tools>
		<foreach input="LORES_T">
			<tool library="climate" tool="t_downscale" name="Lapse Rate Based Temperature Downscaling">
				<option id="LAPSE_RATE" varname="true">LAPSE_RATE</option>
				<input  id="LORES_DEM">LORES_DEM</input>
				<input  id="HIRES_DEM">HIRES_DEM</input>
				<input  id="LORES_T"  >LORES_T</input>
				<output id="HIRES_T"  >HIRES_T</output>
			</tool>
		</foreach>
	</tools>
</toolchain>
