Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[sextante] more tests. Added extra model and script
- Loading branch information
Showing
5 changed files
with
113 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
NAME:Model with algorithms not in running order | ||
GROUP:[Test algorithms] | ||
PARAMETER:ParameterRaster|RASTERLAYER_RASTER|raster|False | ||
120.0,60.0 | ||
VALUE:HARDCODEDPARAMVALUE_MINSLOPE_1===0.01 | ||
VALUE:HARDCODEDPARAMVALUE_Method_0===0 | ||
VALUE:HARDCODEDPARAMVALUE_STEP_0===1 | ||
VALUE:HARDCODEDPARAMVALUE_DOLINEAR _0===True | ||
VALUE:HARDCODEDPARAMVALUE_LINEARTHRS_0===500.0 | ||
VALUE:HARDCODEDPARAMVALUE_CONVERGENCE_0===1.0 | ||
ALGORITHM:saga:catchmentareaparallel | ||
154.0,415.0 | ||
None | ||
1|RESULT | ||
None | ||
None | ||
None | ||
None | ||
-1|HARDCODEDPARAMVALUE_STEP_0 | ||
-1|HARDCODEDPARAMVALUE_Method_0 | ||
-1|HARDCODEDPARAMVALUE_DOLINEAR _0 | ||
-1|HARDCODEDPARAMVALUE_LINEARTHRS_0 | ||
None | ||
None | ||
-1|HARDCODEDPARAMVALUE_CONVERGENCE_0 | ||
None | ||
None | ||
None | ||
None | ||
None | ||
None | ||
None | ||
None | ||
ALGORITHM:saga:fillsinksplanchondarboux2001 | ||
340.0,260.0 | ||
None | ||
-1|RASTERLAYER_RASTER | ||
-1|HARDCODEDPARAMVALUE_MINSLOPE_1 | ||
None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
##input=vector | ||
##output=output vector | ||
from sextante.core.SextanteVectorWriter import SextanteVectorWriter | ||
from qgis.core import * | ||
from PyQt4.QtCore import * | ||
|
||
inputLayer = sextante.getobject(input) | ||
features = sextante.getfeatures(inputLayer) | ||
fields = inputLayer.pendingFields().toList() | ||
outputLayer = SextanteVectorWriter(output, None, fields, QGis.WKBPoint, inputLayer.crs()) | ||
count = 0 | ||
mean = [0 for field in fields] | ||
x = 0 | ||
y = 0 | ||
for ft in features: | ||
c = ft.geometry().centroid().asPoint() | ||
x += c.x() | ||
y += c.y() | ||
attrs = ft.attributes() | ||
for f in range(len(fields)): | ||
try: | ||
mean[f] += float(attrs[f].toDouble()[0]) | ||
except: | ||
pass | ||
count += 1 | ||
if count != 0: | ||
mean = [value / count for value in mean] | ||
x /= count | ||
y /= count | ||
outFeat = QgsFeature() | ||
meanPoint = QgsPoint(x, y) | ||
outFeat.setGeometry(QgsGeometry.fromPoint(meanPoint)) | ||
outFeat.setAttributes([QVariant(v) for v in mean]) | ||
outputLayer.addFeature(outFeat) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters