Skip to content

Commit

Permalink
[sextante] Modified test data and example models
Browse files Browse the repository at this point in the history
  • Loading branch information
volaya committed Mar 24, 2013
1 parent f3b3fc9 commit 47101f3
Show file tree
Hide file tree
Showing 25 changed files with 571 additions and 52 deletions.
2 changes: 2 additions & 0 deletions python/plugins/sextante/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
from sextante.core.Sextante import runalg, runandload, alghelp, alglist, algoptions, load, \
extent, getObjectFromName, getObjectFromUri, getobject, getfeatures

from sextante.tests.TestData import loadTestData

__author__ = 'Victor Olaya'
__date__ = 'August 2012'
__copyright__ = '(C) 2012, Victor Olaya'
Expand Down
49 changes: 49 additions & 0 deletions python/plugins/sextante/modeler/models/contour_from_points.model
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
NAME:Contours from points
GROUP:Tools
PARAMETER:ParameterVector|VECTORLAYER_POINTS|Points|0|False
120.0,60.0
PARAMETER:ParameterNumber|NUMBER_INTERVAL|Interval|0.0|None|100.0
652.0,59.0
PARAMETER:ParameterTableField|TABLEFIELD_ATTRIBUTE|Attribute|VECTORLAYER_POINTS|-1
388.0,59.0
PARAMETER:ParameterNumber|NUMBER_CELLSIZEFORINTERMEDIATERASTERLAYER|Cellsize for intermediate raster layer|0.0|None|100.0
181.0,302.0
VALUE:HARDCODEDPARAMVALUE_LINE_TYPE_0===0
VALUE:HARDCODEDPARAMVALUE_WORKSPACE_3===w
VALUE:HARDCODEDPARAMVALUE_PASSWORD_3===geoserver
VALUE:HARDCODEDPARAMVALUE_URL_3===http://localhost:8080/geoserver/rest
VALUE:HARDCODEDPARAMVALUE_ZMAX_2===10000.0
VALUE:HARDCODEDPARAMVALUE_MULTIPLE_0===0
VALUE:HARDCODEDPARAMVALUE_ZMIN_2===0.0
VALUE:HARDCODEDPARAMVALUE_THRESHOLD_1===0.1
VALUE:HARDCODEDPARAMVALUE_USER_SIZE_0===25
VALUE:HARDCODEDPARAMVALUE_GRID_TYPE_0===3
VALUE:HARDCODEDPARAMVALUE_USER_3===admin
VALUE:HARDCODEDPARAMVALUE_TARGET_0===0
ALGORITHM:saga:shapestogrid
183.0,182.0
None
-1|VECTORLAYER_POINTS
-1|TABLEFIELD_ATTRIBUTE
-1|HARDCODEDPARAMVALUE_MULTIPLE_0
-1|HARDCODEDPARAMVALUE_LINE_TYPE_0
-1|HARDCODEDPARAMVALUE_GRID_TYPE_0
-1|HARDCODEDPARAMVALUE_TARGET_0
None
-1|NUMBER_CELLSIZEFORINTERMEDIATERASTERLAYER
None
ALGORITHM:saga:closegaps
484.0,212.0
None
0|USER_GRID
None
-1|HARDCODEDPARAMVALUE_THRESHOLD_1
None
ALGORITHM:saga:contourlinesfromgrid
653.0,435.0
None
1|RESULT
-1|HARDCODEDPARAMVALUE_ZMIN_2
-1|HARDCODEDPARAMVALUE_ZMAX_2
-1|NUMBER_INTERVAL
None
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
NAME:Habitat_selection_model
GROUP:Habitat models Sextante
PARAMETER:ParameterVector|VECTORLAYER_LOCATIONS|Locations|0|False
120.0,60.0
PARAMETER:ParameterVector|VECTORLAYER_LINEFEATURES|Line features|1|False
119.0,143.0
PARAMETER:ParameterVector|VECTORLAYER_HABITATTYPE|Habitat type|2|False
120.0,232.0
PARAMETER:ParameterTableField|TABLEFIELD_HABITATTYPEFIELD|Habitat type field|VECTORLAYER_HABITATTYPE|-1
122.0,316.0
PARAMETER:ParameterExtent|EXTENT_HABITATEXTENT|Habitat extent|0,1,0,1
121.0,399.0
VALUE:HARDCODEDPARAMVALUE_GRASS_MIN_AREA_PARAMETER_1===0.0001
VALUE:HARDCODEDPARAMVALUE_zmin_0===0.0
VALUE:HARDCODEDPARAMVALUE_column_0===z
VALUE:HARDCODEDPARAMVALUE_zmax_0===0.0
VALUE:HARDCODEDPARAMVALUE_use_1===0
VALUE:HARDCODEDPARAMVALUE_INTERPOL_6===0
VALUE:HARDCODEDPARAMVALUE_GRIDS_6===2|distance
VALUE:HARDCODEDPARAMVALUE_INTERPOL_5===0
VALUE:HARDCODEDPARAMVALUE_value_1===1.0
VALUE:HARDCODEDPARAMVALUE_GRASS_REGION_CELLSIZE_PARAMETER_1===0.0
VALUE:HARDCODEDPARAMVALUE_GRASS_REGION_CELLSIZE_PARAMETER_2===0.0
VALUE:HARDCODEDPARAMVALUE_metric_2===0
VALUE:HARDCODEDPARAMVALUE_n_0===150
VALUE:HARDCODEDPARAMVALUE_GRASS_SNAP_TOLERANCE_PARAMETER_1===-1.0
VALUE:HARDCODEDPARAMVALUE_GRIDS_5===2|distance
VALUE:HARDCODEDPARAMVALUE_-d_0===True
ALGORITHM:grass:v.random
383.0,397.0
None
-1|HARDCODEDPARAMVALUE_n_0
-1|HARDCODEDPARAMVALUE_zmin_0
-1|HARDCODEDPARAMVALUE_zmax_0
-1|HARDCODEDPARAMVALUE_column_0
-1|HARDCODEDPARAMVALUE_-d_0
-1|EXTENT_HABITATEXTENT
random_points
ALGORITHM:grass:v.to.rast.value
371.0,143.0
None
-1|VECTORLAYER_LINEFEATURES
-1|HARDCODEDPARAMVALUE_use_1
-1|HARDCODEDPARAMVALUE_value_1
None
-1|HARDCODEDPARAMVALUE_GRASS_REGION_CELLSIZE_PARAMETER_1
-1|HARDCODEDPARAMVALUE_GRASS_SNAP_TOLERANCE_PARAMETER_1
-1|HARDCODEDPARAMVALUE_GRASS_MIN_AREA_PARAMETER_1
line_raster
ALGORITHM:grass:r.grow.distance
615.0,141.0
None
1|output
-1|HARDCODEDPARAMVALUE_metric_2
None
-1|HARDCODEDPARAMVALUE_GRASS_REGION_CELLSIZE_PARAMETER_2
distance_raster
None
ALGORITHM:saga:addpolygonattributestopoints
859.0,62.0
None
-1|VECTORLAYER_LOCATIONS
-1|VECTORLAYER_HABITATTYPE
-1|TABLEFIELD_HABITATTYPEFIELD
locations_habitat
ALGORITHM:saga:addpolygonattributestopoints
857.0,264.0
None
0|output
-1|VECTORLAYER_HABITATTYPE
-1|TABLEFIELD_HABITATTYPEFIELD
points_habitat
ALGORITHM:saga:addgridvaluestopoints
858.0,162.0
None
-1|VECTORLAYER_LOCATIONS
-1|HARDCODEDPARAMVALUE_GRIDS_5
-1|HARDCODEDPARAMVALUE_INTERPOL_5
locations_distance
ALGORITHM:saga:addgridvaluestopoints
854.0,392.0
None
0|output
-1|HARDCODEDPARAMVALUE_GRIDS_6
-1|HARDCODEDPARAMVALUE_INTERPOL_6
random_distance
95 changes: 47 additions & 48 deletions python/plugins/sextante/modeler/models/watersheds.model
Original file line number Diff line number Diff line change
@@ -1,38 +1,43 @@
NAME:Watersheds from DEM
GROUP:[Sample models]
NAME:Watershed from DEM
GROUP:[Example models]
PARAMETER:ParameterRaster|RASTERLAYER_DEM|DEM|False
458.0,50.0
PARAMETER:ParameterNumber|NUMBER_INITIATIONTHRESHOLD|Initiation Threshold|None|None|10000000.0
257.0,403.0
VALUE:HARDCODEDPARAMVALUE_INIT_VALUE_1===10000000
VALUE:HARDCODEDPARAMVALUE_SPLIT_3===0
VALUE:HARDCODEDPARAMVALUE_Method_0===0
VALUE:HARDCODEDPARAMVALUE_INIT_METHOD_1===2
VALUE:HARDCODEDPARAMVALUE_CALC_METHOD_4===0
VALUE:HARDCODEDPARAMVALUE_CLASS_ID_3===0
VALUE:HARDCODEDPARAMVALUE_STEP_0===1
VALUE:HARDCODEDPARAMVALUE_MINLEN_1===10
VALUE:HARDCODEDPARAMVALUE_DOLINEAR _0===True
VALUE:HARDCODEDPARAMVALUE_MINSIZE_2===0
VALUE:HARDCODEDPARAMVALUE_CLASS_ALL_3===1
VALUE:HARDCODEDPARAMVALUE_LINEARTHRS_0===500.0
VALUE:HARDCODEDPARAMVALUE_CONVERGENCE_0===1.0
VALUE:HARDCODEDPARAMVALUE_DIV_CELLS_1===10
ALGORITHM:saga:catchmentarea(parallel)
260.0,172.0
120.0,60.0
PARAMETER:ParameterNumber|NUMBER_STREAMDEFINITIONTHRESHOLD|Stream definition threshold|0.0|None|1000000.0
222.0,473.0
VALUE:HARDCODEDPARAMVALUE_Method_1===0
VALUE:HARDCODEDPARAMVALUE_MINSLOPE_0===0.01
VALUE:HARDCODEDPARAMVALUE_SPLIT_4===1
VALUE:HARDCODEDPARAMVALUE_CLASS_ID_4===0
VALUE:HARDCODEDPARAMVALUE_INIT_METHOD_2===2
VALUE:HARDCODEDPARAMVALUE_STEP_1===1
VALUE:HARDCODEDPARAMVALUE_DOLINEAR _1===True
VALUE:HARDCODEDPARAMVALUE_MINSIZE_3===0
VALUE:HARDCODEDPARAMVALUE_CLASS_ALL_4===1
VALUE:HARDCODEDPARAMVALUE_LINEARTHRS_1===500.0
VALUE:HARDCODEDPARAMVALUE_DIV_CELLS_2===10
VALUE:HARDCODEDPARAMVALUE_CONVERGENCE_1===1.0
VALUE:HARDCODEDPARAMVALUE_MINLEN_2===10
ALGORITHM:saga:fillsinksplanchondarboux2001
120.0,160.0
None
-1|RASTERLAYER_DEM
-1|HARDCODEDPARAMVALUE_MINSLOPE_0
None
ALGORITHM:saga:catchmentareaparallel
119.0,299.0
None
0|RESULT
None
None
-1|HARDCODEDPARAMVALUE_STEP_0
-1|HARDCODEDPARAMVALUE_Method_0
-1|HARDCODEDPARAMVALUE_DOLINEAR _0
-1|HARDCODEDPARAMVALUE_LINEARTHRS_0
None
None
-1|HARDCODEDPARAMVALUE_CONVERGENCE_0
-1|HARDCODEDPARAMVALUE_STEP_1
-1|HARDCODEDPARAMVALUE_Method_1
-1|HARDCODEDPARAMVALUE_DOLINEAR _1
-1|HARDCODEDPARAMVALUE_LINEARTHRS_1
None
None
-1|HARDCODEDPARAMVALUE_CONVERGENCE_1
None
None
None
Expand All @@ -42,39 +47,33 @@ None
None
None
ALGORITHM:saga:channelnetwork
447.0,291.0
418.0,300.0
None
-1|RASTERLAYER_DEM
0|RESULT
None
0|CAREA
-1|HARDCODEDPARAMVALUE_INIT_METHOD_1
-1|NUMBER_INITIATIONTHRESHOLD
1|CAREA
-1|HARDCODEDPARAMVALUE_INIT_METHOD_2
-1|NUMBER_STREAMDEFINITIONTHRESHOLD
None
-1|HARDCODEDPARAMVALUE_DIV_CELLS_1
-1|HARDCODEDPARAMVALUE_DIV_CELLS_2
None
-1|HARDCODEDPARAMVALUE_MINLEN_1
-1|HARDCODEDPARAMVALUE_MINLEN_2
None
None
None
ALGORITHM:saga:watershedbasins
730.0,182.0
578.0,160.0
None
-1|RASTERLAYER_DEM
1|CHNLNTWRK
0|RESULT
2|CHNLNTWRK
None
-1|HARDCODEDPARAMVALUE_MINSIZE_2
-1|HARDCODEDPARAMVALUE_MINSIZE_3
None
ALGORITHM:saga:vectorisinggridclasses
864.0,330.0
None
2|BASINS
-1|HARDCODEDPARAMVALUE_CLASS_ALL_3
-1|HARDCODEDPARAMVALUE_CLASS_ID_3
-1|HARDCODEDPARAMVALUE_SPLIT_3
578.0,481.0
None
ALGORITHM:qgis:export/addgeometrycolumns
655.0,442.0
3|BASINS
-1|HARDCODEDPARAMVALUE_CLASS_ALL_4
-1|HARDCODEDPARAMVALUE_CLASS_ID_4
-1|HARDCODEDPARAMVALUE_SPLIT_4
None
3|POLYGONS
-1|HARDCODEDPARAMVALUE_CALC_METHOD_4
Watersheds
31 changes: 27 additions & 4 deletions python/plugins/sextante/tests/TestData.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,30 @@
import os.path
from sextante.core.QGisLayers import QGisLayers

dataFolder = os.path.join(os.path.dirname(__file__), 'data')
raster = os.path.join(dataFolder, "raster.tif")
points = os.path.join(dataFolder, "points.shp")
lines = os.path.join(dataFolder, "lines.shp")
polygons = os.path.join(dataFolder, "polygons.shp")

def points():
return os.path.join(dataFolder, "points.shp")

def raster():
return os.path.join(dataFolder, "raster.tif")

def lines():
return os.path.join(dataFolder, "lines.shp")

def polygons():
return os.path.join(dataFolder, "polygons.shp")

def polygons2():
return os.path.join(dataFolder, "polygons2.shp")

def union():
return os.path.join(dataFolder, "union.shp")

def loadTestData():
QGisLayers.load(points(), "points");
QGisLayers.load(polygons(), "polygons");
QGisLayers.load(polygons2(), "polygons2");
QGisLayers.load(lines(), "lines");
QGisLayers.load(raster(), "raster");
QGisLayers.load(union(), "union");
Empty file.
Binary file modified python/plugins/sextante/tests/data/lines.dbf
Binary file not shown.
Binary file modified python/plugins/sextante/tests/data/points.dbf
Binary file not shown.
Binary file modified python/plugins/sextante/tests/data/points.shp
Binary file not shown.
Binary file modified python/plugins/sextante/tests/data/points.shx
Binary file not shown.
Binary file modified python/plugins/sextante/tests/data/polygons.dbf
Binary file not shown.
Binary file modified python/plugins/sextante/tests/data/polygons.shp
Binary file not shown.
Binary file modified python/plugins/sextante/tests/data/polygons.shx
Binary file not shown.
Binary file added python/plugins/sextante/tests/data/polygons2.dbf
Binary file not shown.
1 change: 1 addition & 0 deletions python/plugins/sextante/tests/data/polygons2.prj
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PROJCS["ED50_UTM_zone_30N",GEOGCS["GCS_European_1950",DATUM["D_European_1950",SPHEROID["International_1924",6378388,297]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",-3],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["Meter",1]]
1 change: 1 addition & 0 deletions python/plugins/sextante/tests/data/polygons2.qpj
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PROJCS["ED50 / UTM zone 30N",GEOGCS["ED50",DATUM["European_Datum_1950",SPHEROID["International 1924",6378388,297,AUTHORITY["EPSG","7022"]],TOWGS84[-87,-98,-121,0,0,0,0],AUTHORITY["EPSG","6230"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4230"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",-3],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH],AUTHORITY["EPSG","23030"]]
Binary file added python/plugins/sextante/tests/data/polygons2.shp
Binary file not shown.
Binary file added python/plugins/sextante/tests/data/polygons2.shx
Binary file not shown.
Loading

0 comments on commit 47101f3

Please sign in to comment.