Skip to content

Commit

Permalink
[sextante]minor fixes and added new R script examples
Browse files Browse the repository at this point in the history
  • Loading branch information
volaya committed Feb 17, 2013
1 parent 329062b commit 5fead9f
Show file tree
Hide file tree
Showing 11 changed files with 114 additions and 4 deletions.
6 changes: 5 additions & 1 deletion python/plugins/sextante/core/GeoAlgorithm.py
Expand Up @@ -346,7 +346,11 @@ def __str__(self):


def commandLineName(self):
return self.provider.getName().lower().replace(" ", "") + ":" + self.name.lower().replace(" ", "").replace(",","")
name = self.provider.getName().lower() + ":" + self.name.lower()
validChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789:"
name = ''.join(c for c in name if c in validChars)
return name


def removeOutputFromName(self, name):
for out in self.outputs:
Expand Down
7 changes: 4 additions & 3 deletions python/plugins/sextante/gui/ParametersPanel.py
Expand Up @@ -106,7 +106,7 @@ def initGUI(self):
if param.isAdvanced:
self.advancedButton = QtGui.QPushButton()
self.advancedButton.setText("Show advanced parameters")
self.advancedButton.setMaximumWidth(150)
self.advancedButton.setMaximumWidth(250)
QtCore.QObject.connect(self.advancedButton, QtCore.SIGNAL("clicked()"), self.showAdvancedParametersClicked)
self.verticalLayout.addWidget(self.advancedButton)
break
Expand Down Expand Up @@ -193,8 +193,9 @@ def buttonToggled(self, value):
button.setChecked(False)

def getExtendedLayerName(self, layer):
if SextanteConfig.getSetting(SextanteConfig.SHOW_CRS_DEF):
return layer.name() + " [" + layer.crs().description() +"]"
authid = layer.crs().authid()
if SextanteConfig.getSetting(SextanteConfig.SHOW_CRS_DEF) and authid is not None:
return layer.name() + " [" + str(authid) +"]"
else:
return layer.name()

Expand Down
1 change: 1 addition & 0 deletions python/plugins/sextante/parameters/ParameterRaster.py
Expand Up @@ -16,6 +16,7 @@
* *
***************************************************************************
"""
import os

__author__ = 'Victor Olaya'
__date__ = 'August 2012'
Expand Down
5 changes: 5 additions & 0 deletions python/plugins/sextante/r/scripts/Field_dotplot.rsx
@@ -0,0 +1,5 @@
##[Example scripts]=group
##showplots
##layer=vector
##field=field layer
dotchart(layer[[field]],main=paste("Dotplot of",field),xlab=paste(field),ylab="Observation number")
18 changes: 18 additions & 0 deletions python/plugins/sextante/r/scripts/Field_dotplot.rsx.help
@@ -0,0 +1,18 @@
(dp0
S'ALG_CREATOR'
p1
VFilipe S. Dias
p2
sS'field'
p3
VVector's field
p4
sS'ALG_DESC'
p5
VThis tools uses the "dotchart()" function to create a Cleveland dotplot of a given field.
p6
sS'layer'
p7
VVector layer
p8
s.
5 changes: 5 additions & 0 deletions python/plugins/sextante/r/scripts/Field_histogram.rsx
@@ -0,0 +1,5 @@
##[Example scripts]=group
##showplots
##layer=vector
##field=field layer
hist(layer[[field]],main=paste("Histogram of",field),xlab=paste(field))
22 changes: 22 additions & 0 deletions python/plugins/sextante/r/scripts/Field_histogram.rsx.help
@@ -0,0 +1,22 @@
(dp0
S'ALG_CREATOR'
p1
VFilipe S. Dias
p2
sS'field'
p3
VVector's field
p4
sS'ALG_DESC'
p5
VThis tool uses the "hist()" function to create a histogram, using Sturges rule.
p6
sS'ALG_HELP_CREATOR'
p7
VFilipe S. Dias
p8
sS'layer'
p9
VVector layer
p10
s.
14 changes: 14 additions & 0 deletions python/plugins/sextante/r/scripts/Field_summary_statistics.rsx
@@ -0,0 +1,14 @@
##[Example scripts]=group
##layer=vector
##field=field layer
Summary_statistics<-data.frame(name.i=rbind(length(layer[[field]]),
length(unique(layer[[field]])),
min(layer[[field]]),
max(layer[[field]]),
max(layer[[field]])-min(layer[[field]]),
mean(layer[[field]]),
median(layer[[field]]),
sd(layer[[field]])),row.names=c("Count:","Unique values:","Minimum value:","Maximum value:","Range:","Mean value:","Median value:","Standard deviation:"))
colnames(Summary_statistics)<-c(field)
>Summary_statistics

@@ -0,0 +1,18 @@
(dp0
S'ALG_CREATOR'
p1
VFilipe S. Dias
p2
sS'field'
p3
VVector's field
p4
sS'ALG_DESC'
p5
VThis tool computes the following summary statistics for the input field:\u000a\u000a- Minimum value, using "min()"\u000a\u000a- Maximum value, using "max()"\u000a\u000a- Range, which the difference between the maximum and the minimum value\u000a\u000a- Mean value, using "mean()"\u000a\u000a- Median value, using "median()"\u000a\u000a- Standard deviation, using "sd"\u000a\u000a\u000a
p6
sS'layer'
p7
VVector layer
p8
s.
4 changes: 4 additions & 0 deletions python/plugins/sextante/r/scripts/Field_table_of_counts.rsx
@@ -0,0 +1,4 @@
##[Example scripts]=group
##layer=vector
##field=field layer
>table(layer[[field]])
18 changes: 18 additions & 0 deletions python/plugins/sextante/r/scripts/Field_table_of_counts.rsx.help
@@ -0,0 +1,18 @@
(dp0
S'ALG_CREATOR'
p1
VFilipe S. Dias
p2
sS'field'
p3
VVector's field
p4
sS'ALG_DESC'
p5
VThis tool created a table of counts for a given field, using the function "table()".
p6
sS'layer'
p7
VVector layer
p8
s.

0 comments on commit 5fead9f

Please sign in to comment.