<?xml version="1.0" encoding="UTF-8"?>
<toolchain saga-version="5.0.0">
	<group>grids_tools</group>
	<identifier>filter_rank</identifier>
	<name>Rank Filter</name>
	<author>O.Conrad (c) 2017</author>
	<description>Rank filter for grid collections. Set rank to fifty percent to apply a median filter.</description>
	<menu absolute="true">Grid Collection|Filter</menu>

	<parameters>
		<option varname="GRID_SYSTEM" type="grid_system">
			<name>Grid System</name>
		</option>
		<input varname="GRIDS" type="grids" parent="GRID_SYSTEM">
			<name>Grid Collection</name>
		</input>
		<output varname="FILTERED" type="grids" parent="GRID_SYSTEM">
			<name>Filtered</name>
			<output_name input="true" suffix="Rank Filter">GRIDS</output_name>
		</output>
		<option varname="RANK" type="double">
			<name>Rank</name>
			<value>50</value>
		</option>
		<option varname="KERNEL_TYPE" type="choice">
			<name>Kernel Type</name>
			<choices>Square|Circle</choices>
			<value>1</value>
		</option>
		<option varname="KERNEL_RADIUS" type="integer">
			<name>Kernel Radius</name>
			<value>2</value>
		</option>
	</parameters>

	<tools>
		<datalist type="grid_list">LIST</datalist>

		<foreach input="GRIDS">
			<tool library="grid_filter" tool="9" name="Rank Filter">
				<option id="RANK"          varname="1">RANK</option>
				<option id="KERNEL_TYPE"   varname="1">KERNEL_TYPE</option>
				<option id="KERNEL_RADIUS" varname="1">KERNEL_RADIUS</option>
				<input  id="INPUT" >GRIDS</input>
				<output id="RESULT">LIST</output>
			</tool>
		</foreach>

		<tool library="grids_tools" tool="0" name="Create a Grid Collection">
			<option id="ATTRIBUTES">3</option>
			<input  id="COPY">GRIDS</input>
			<input  id="LIST">LIST</input>
			<output id="GRIDS">FILTERED</output>
		</tool>		
	</tools>
</toolchain>
