[GRASS-SVN] r41997 - in grass/branches/develbranch_6:
gui/wxpython/scripts scripts/v.krige
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Apr 23 09:37:35 EDT 2010
Author: aghisla
Date: 2010-04-23 09:37:33 -0400 (Fri, 23 Apr 2010)
New Revision: 41997
Modified:
grass/branches/develbranch_6/gui/wxpython/scripts/vkrige.py
grass/branches/develbranch_6/scripts/v.krige/v.krige.py
Log:
Fixing rpy2 issues. Still broken.
Modified: grass/branches/develbranch_6/gui/wxpython/scripts/vkrige.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/scripts/vkrige.py 2010-04-23 12:55:41 UTC (rev 41996)
+++ grass/branches/develbranch_6/gui/wxpython/scripts/vkrige.py 2010-04-23 13:37:33 UTC (rev 41997)
@@ -33,10 +33,8 @@
sys.exit(_("No GRASS-python library found."))
### wxGUI imports
-GUIModulesPath = os.path.join(os.getenv("GISBASE"), "etc", "wxpython", "gui_modules")
+GUIModulesPath = os.path.join(os.getenv("GISBASE"), "etc", "gui", "wxpython", "gui_modules")
sys.path.append(GUIModulesPath)
-GUIPath = os.path.join(os.getenv("GISBASE"), "etc", "wxpython")
-sys.path.append(GUIPath)
import globalvar
if not os.getenv("GRASS_WXBUNDLED"):
@@ -399,8 +397,8 @@
self.SetSizerAndFit(self.Sizer)
self.VariogramCheckBox.Bind(wx.EVT_CHECKBOX, self.HideOptions)
self.VariogramCheckBox.SetValue(state = True) # check it by default
-
- ModelFactor = robjects.r.vgm().r['long']
+
+ ModelFactor = robjects.r.vgm().rx('long')
ModelList = robjects.r.levels(ModelFactor[0])
#@FIXME: no other way to let the Python pick it up..
# and this is te wrong place where to load this list. should be at the very beginning.
Modified: grass/branches/develbranch_6/scripts/v.krige/v.krige.py
===================================================================
--- grass/branches/develbranch_6/scripts/v.krige/v.krige.py 2010-04-23 12:55:41 UTC (rev 41996)
+++ grass/branches/develbranch_6/scripts/v.krige/v.krige.py 2010-04-23 13:37:33 UTC (rev 41997)
@@ -149,8 +149,8 @@
if "x" not in robjects.r.names(Rpointmap):
# extract coordinates with S4 method
coordinatesPreDF = robjects.r['as.data.frame'](robjects.r.coordinates(Rpointmap))
- coordinatesDF = robjects.r['data.frame'](x = coordinatesPreDF.r['coords.x1'][0],
- y = coordinatesPreDF.r['coords.x2'][0])
+ coordinatesDF = robjects.r['data.frame'](x = coordinatesPreDF.rx('coords.x1')[0],
+ y = coordinatesPreDF.rx('coords.x2')[0])
# match coordinates with data slot of SpatialPointsDataFrame - maptools function
# match is done on row.names
Rpointmap = robjects.r.spCbind(Rpointmap, coordinatesDF)
@@ -176,8 +176,8 @@
# addition of coordinates columns into dataframe.
coordinatesDF = robjects.r['as.data.frame'](robjects.r.coordinates(Grid))
- data = robjects.r['data.frame'](x = coordinatesDF.r['s1'][0],
- y = coordinatesDF.r['s2'][0],
+ data = robjects.r['data.frame'](x = coordinatesDF.rx('s1')[0],
+ y = coordinatesDF.rx('s2')[0],
k = robjects.r.rep(1, Region['cols']*Region['rows']))
GridPredicted = robjects.r.SpatialGridDataFrame(Grid,
data,
@@ -188,8 +188,8 @@
if isblock is True:
predictor = 'x+y'
else:
- predictor = 1
- Formula = robjects.r['as.formula'](robjects.r.paste(column, "~", predictor))
+ predictor = '1'
+ Formula = robjects.Formula(column + "~" + predictor)
#print Formula
return Formula
@@ -207,11 +207,11 @@
VariogramModel = robjects.r.autofitVariogram(formula, inputdata, **DottedParams)
#print robjects.r.warnings()
- Variograms['datavariogram'] = VariogramModel.r['exp_var'][0]
- Variograms['variogrammodel'] = VariogramModel.r['var_model'][0]
+ Variograms['datavariogram'] = VariogramModel.rx('exp_var')[0]
+ Variograms['variogrammodel'] = VariogramModel.rx('var_model')[0]
# obtain the model name. *Too* complicated to get the string instead of level, unlike R does.
- VariogramAsDF = robjects.r['as.data.frame'](VariogramModel.r['var_model'][0]) # force conversion
- ModelDF = VariogramAsDF.r['model'][0]
+ VariogramAsDF = robjects.r['as.data.frame'](VariogramModel.rx('var_model')[0]) # force conversion
+ ModelDF = VariogramAsDF.rx('model')[0]
Variograms['model'] = robjects.r.levels(ModelDF).subset(ModelDF[1])[0]
else:
DataVariogram = robjects.r['variogram'](formula, inputdata)
@@ -261,7 +261,9 @@
logger.message(_("Fitting variogram..."))
isblock = block is not ''
+ logger.message(column)
Formula = self.ComposeFormula(column, isblock, InputData)
+ logger.message(Formula)
if globals()["Variogram"] is None:
globals()["Variogram"] = self.FitVariogram(Formula,
InputData,
More information about the grass-commit
mailing list