<font><p>Hi,</p>
<div>I am trying to create a script to run from the Sextante toolbox in which a model from the Sextante Modeler is included. </div><div>As result the script will create a flooded area (polygon) out from a water level input and a DEM (raster). The script looks like</div>


<div> </div><div>from sextante.core.QGisLayers import QGisLayers</div><div>from sextante.core.GeoAlgorithm import GeoAlgorithm</div><div>from sextante.modeler.ModelerAlgorithmProvider import ModelerAlgorithmProvider </div>
<div>from sextante.modeler.ModelerAlgorithm import ModelerAlgorithm </div><div>from sextante.algs.SextanteAlgorithmProvider import SextanteAlgorithmProvider </div><div>from sextante.saga.SagaAlgorithmProvider import SagaAlgorithmProvider </div>
<div>from sextante.saga.SagaAlgorithm import SagaAlgorithm</div><div>from sextante.script.ScriptAlgorithmProvider import ScriptAlgorithmProvider  </div><div>from sextante.script.ScriptAlgorithm import ScriptAlgorithm </div>


<div> </div><div>#Definition of inputs and outputs</div><div>#==============================</div><div>##DEMTot=raster</div><div>##FloodedArea_0.7=output vector</div>

<div> </div><div>#Algorithm body</div><div>#==============================</div><div>Sextante.runalg("Modeler:CalculateFloodedAreas", "DEMTot", 0.7, None, FloodedArea_0.7)</div>

<div> </div><div> </div><div>The model works alright but when running the script I get the following error:</div>

<div> </div><div>Traceback (most recent call last):</div><div>File "C:/Users/Erik/.qgis//python/plugins\sextante\core\GeoAlgorithm.py", line 118, in execute</div><div>self.processAlgorithm(progress)</div>
<div>  File "C:/Users/Erik/.qgis//python/plugins\sextante\script\ScriptAlgorithm.py", line 216, in processAlgorithm</div><div>exec(script) in ns</div><div>File "<string>", line 19</div><div>Sextante.runalg("Modeler:CalculateFloodedAreas", "DEMTot", 0.7, None, FloodedArea_0.7)</div>

<div>                                                                             ^</div><div>SyntaxError: invalid syntax     </div>

<p>As a beginner of Python I have to stick to examples provided, but unfortunately I have not found many run from the Sextante toolbox. In <a href="http://documentation.qgis.org/html/en/user_manual/sextante/console.html">http://documentation.qgis.org/html/en/user_manual/sextante/console.html</a> I have found the following example:</p>


<div>##dem=raster</div><div>##twi=output</div>
<div> </div><div>ret_slope = Sextante.runalg("saga:slopeaspectcurvature", dem, 0, None, None, None, None, None)</div><div>ret_area = Sextante.runalg("saga:catchmentarea(mass-fluxmethod)", "dem", 0, False, False, False, False, None, None, None, None, None)</div>

<p>Sextante.runalg("saga:topographicwetnessindex(twi), ret_slope['SLOPE'], ret_area['AREA'], None, 1, 0, twi)</p>

<div> </div><div>However, I believe there is something missing here. Shouldn´t there be some definitions of imports? Pathways?</div>

<p> </p>
<div>Anybody who could give me some hints on where to find good examples or tip to get me on the right track? I´m running QGIS on Windows. </div><div>Thanks in advance,</div><div>Jonas</div>

<p> </p></font>