Skip to content

Commit

Permalink
[sextante] minor changes in algorithms and some code cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
volaya committed Feb 24, 2013
1 parent 2c00099 commit 7e1f58f
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 24 deletions.
4 changes: 0 additions & 4 deletions python/plugins/sextante/core/LayerExporter.py
Expand Up @@ -84,10 +84,6 @@ def exportRasterLayer(layer):
Currently, the output is restricted to geotiff, but not all other formats are exported.
Only those formats not supported by GDAL are exported, so it is assumed that the external
app uses GDAL to read the layer'''
exts = GdalUtils.getSupportedRasterExtensions()
for ext in exts:
if (unicode(layer.source()).endswith(ext)):
return unicode(layer.source())

#TODO:Do the conversion here
return unicode(layer.source())
Expand Down
6 changes: 1 addition & 5 deletions python/plugins/sextante/core/Sextante.py
Expand Up @@ -36,7 +36,6 @@
from sextante.gui.SextantePostprocessing import SextantePostprocessing
from sextante.gui.UnthreadedAlgorithmExecutor import UnthreadedAlgorithmExecutor,\
SilentProgress

from sextante.modeler.Providers import Providers
from sextante.modeler.ModelerAlgorithmProvider import ModelerAlgorithmProvider
from sextante.modeler.ModelerOnlyAlgorithmProvider import ModelerOnlyAlgorithmProvider
Expand All @@ -52,8 +51,6 @@
from sextante.taudem.TauDEMAlgorithmProvider import TauDEMAlgorithmProvider
from sextante.admintools.AdminToolsAlgorithmProvider import AdminToolsAlgorithmProvider



class Sextante:

iface = None
Expand Down Expand Up @@ -149,7 +146,6 @@ def loadFromProviders():

@staticmethod
def updateProviders():

for provider in Sextante.providers:
provider.loadAlgorithms()

Expand Down Expand Up @@ -345,7 +341,7 @@ def cancel():


##==========================================================
##This methods are here to be used from the python console,
##These methods are here to be used from the python console,
##making it easy to use SEXTANTE from there
##==========================================================

Expand Down
6 changes: 3 additions & 3 deletions python/plugins/sextante/gdal/GdalUtils.py
Expand Up @@ -30,10 +30,10 @@
import os

try:
from osgeo import gdal
gdalAvailable = True
from osgeo import gdal
gdalAvailable = True
except:
gdalAvailable = False
gdalAvailable = False

class GdalUtils():

Expand Down
2 changes: 1 addition & 1 deletion python/plugins/sextante/gdal/scripts/sieve.py
Expand Up @@ -30,11 +30,11 @@
##src_filename=raster
##dst_filename=output raster
##connectedness=selection 4;8
##threshold=number 2
from sextante.gdal.GdalUtils import GdalUtils

from osgeo import gdal, ogr

threshold = 2
connectedness=int(connectedness)
options = []

Expand Down
14 changes: 7 additions & 7 deletions python/plugins/sextante/gdal/translate.py
Expand Up @@ -61,10 +61,10 @@ def defineCharacteristics(self):
self.addParameter(ParameterBoolean(translate.OUTSIZE_PERC, "Output size is a percentage of input size", True))
self.addParameter(ParameterString(translate.NO_DATA, "Nodata value, leave as none to take the nodata value from input", "none"))
self.addParameter(ParameterSelection(translate.EXPAND, "Expand", ["none","gray","rgb","rgba"]))
self.addParameter(ParameterCrs(translate.SRS, "Override the projection for the output file", ""))
self.addParameter(ParameterCrs(translate.SRS, "Override the projection for the output file", None))
self.addParameter(ParameterExtent(translate.PROJWIN, "Subset based on georeferenced coordinates"))
self.addParameter(ParameterBoolean(translate.SDS, "Copy all subdatasets of this file to individual output files", False))
self.addParameter(ParameterString(translate.EXTRA, "Additional creation parameters"))
self.addParameter(ParameterString(translate.EXTRA, "Additional creation parameters", " "))
self.addOutput(OutputRaster(translate.OUTPUT, "Output layer"))

def processAlgorithm(self, progress):
Expand All @@ -75,8 +75,8 @@ def processAlgorithm(self, progress):
noData = str(self.getParameterValue(translate.NO_DATA))
expand = str(self.getParameterFromName(translate.EXPAND).options[self.getParameterValue(translate.EXPAND)])
projwin = str(self.getParameterValue(translate.PROJWIN))
srs = str(self.getParameterValue(translate.SRS))
sds = str(self.getParameterValue(translate.SDS))
srs = self.getParameterValue(translate.SRS)
sds = self.getParameterValue(translate.SDS)
extra = str(self.getParameterValue(translate.EXTRA))

commands = ["gdal_translate"]
Expand All @@ -92,9 +92,9 @@ def processAlgorithm(self, progress):
commands.append("-expand "+expand)
regionCoords = projwin.split(",")
commands.append("-projwin "+regionCoords[0]+" "+regionCoords[3]+" "+regionCoords[1]+" "+regionCoords[2])
if srs != "":
commands.append("-a_srs EPSG:"+srs)
if sds == "True":
if srs is not None:
commands.append("-a_srs "+str(srs))
if sds:
commands.append("-sds")
commands.append(extra)
commands.append(self.getParameterValue(translate.INPUT))
Expand Down
3 changes: 2 additions & 1 deletion python/plugins/sextante/grass/description/r.kappa.txt
Expand Up @@ -3,6 +3,7 @@ r.kappa - Calculate error matrix and kappa parameter for accuracy assessment of
Raster (r.*)
ParameterRaster|classification|Raster layer containing classification result|False
ParameterRaster|reference|Raster layer containing reference classes|False
ParameterString|title|Title for error matrix and kappa|ACCURACY ASSESSMENT
ParameterString|title|Title for error matrix and kappa|"ACCURACY ASSESSMENT"
ParameterBoolean|-h|No header in the report|False
ParameterBoolean|-w|Wide report (132 columns)|False
OutputFile|output|Output file containing error matrix and kappa
Expand Up @@ -38,7 +38,7 @@ class VectorLayerBoundsAlgorithm(GeoAlgorithm):
def defineCharacteristics(self):
self.showInModeler = True
self.showInToolbox = False
self.name = "Raster layer bounds"
self.name = "Vector layer bounds"
self.group = "Modeler-only tools"
self.addParameter(ParameterVector(self.LAYER, "Layer"))
self.addOutput(OutputNumber(self.XMIN, "min X"))
Expand Down
@@ -1,5 +1,6 @@
##Classification=group
##Layer = raster|R.raster
##userasterpackage
##[Example scripts]=group
##Layer = raster
##no_data_value = number 0
##showplots
Layer <- raster(Layer, 1)
Expand Down

0 comments on commit 7e1f58f

Please sign in to comment.