[GRASS-SVN] r56926 - in grass/trunk: gui/wxpython/scripts scripts/v.krige

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jun 25 17:29:47 PDT 2013


Author: hamish
Date: 2013-06-25 17:29:47 -0700 (Tue, 25 Jun 2013)
New Revision: 56926

Modified:
   grass/trunk/gui/wxpython/scripts/vkrige.py
   grass/trunk/scripts/v.krige/v.krige.py
Log:
allow cat column as data column (mostly for testing);
tweak default variance map name;
some linewrap and wording


Modified: grass/trunk/gui/wxpython/scripts/vkrige.py
===================================================================
--- grass/trunk/gui/wxpython/scripts/vkrige.py	2013-06-25 23:30:20 UTC (rev 56925)
+++ grass/trunk/gui/wxpython/scripts/vkrige.py	2013-06-26 00:29:47 UTC (rev 56926)
@@ -208,7 +208,7 @@
         """ Refreshes list of columns."""
         MapName = event.GetString()
         self.InputDataColumn.InsertColumns(vector = MapName,
-                                   layer = 1, excludeKey = True,
+                                   layer = 1, excludeKey = False,
                                    type = ['integer', 'double precision'])
 
     def OnInputColumnChanged(self, event):
@@ -220,7 +220,7 @@
         
         if enable:
             self.OutputMapName.SetValue(MapName.split("@")[0]+"_kriging")
-            self.OutputVarianceMapName.SetValue(MapName.split("@")[0]+"_kriging_var")
+            self.OutputVarianceMapName.SetValue(MapName.split("@")[0]+"_kriging.var")
         else:
             self.OutputMapName.SetValue('')
             self.OutputVarianceMapName.SetValue('')

Modified: grass/trunk/scripts/v.krige/v.krige.py
===================================================================
--- grass/trunk/scripts/v.krige/v.krige.py	2013-06-25 23:30:20 UTC (rev 56925)
+++ grass/trunk/scripts/v.krige/v.krige.py	2013-06-26 00:29:47 UTC (rev 56926)
@@ -86,7 +86,7 @@
 #%option G_OPT_R_OUTPUT
 #% key: output_var
 #% label: Name for output variance raster map
-#% description: If omitted, will be <input name>_kriging_var
+#% description: If omitted, will be <input name>_kriging.var
 #% required : no
 #%end
 
@@ -247,9 +247,11 @@
     def Run(self, input, column, output, package, sill, nugget, range, logger, \
             overwrite, model, block, output_var, command, **kwargs):
         """ Wrapper for all functions above. """
+
         logger.message(_("Processing %d cells. Computing time raises "
                          "exponentially with resolution." % grass.region()['cells']))
         logger.message(_("Importing data..."))
+
         if globals()["InputData"] is None:
             globals()["InputData"] = self.ImportMap(input, column)
         # and from here over, InputData refers to the global variable
@@ -268,11 +270,12 @@
                                           sill = sill,
                                           nugget = nugget,
                                           range = range)
-        logger.message(_("Variogram fitted."))
+        logger.message(_("Variogram fitting complete."))
         
         logger.message(_("Kriging..."))
-        KrigingResult = self.DoKriging(Formula, InputData, GridPredicted, Variogram['variogrammodel'], block) # using global ones
-        logger.message(_("Kriging performed."))
+        KrigingResult = self.DoKriging(Formula, InputData,
+                 GridPredicted, Variogram['variogrammodel'], block) # using global ones
+        logger.message(_("Kriging complete."))
         
         self.ExportMap(map = KrigingResult,
                        column='var1.pred',
@@ -331,9 +334,13 @@
             options['output'] = options['input'] + '_kriging'
 
         # check for output map with same name. g.parser can't handle this, afaik.
-        if grass.find_file(options['output'], element = 'cell')['fullname'] and os.getenv("GRASS_OVERWRITE") == None:
+        if grass.find_file(options['output'], element = 'cell')['fullname'] \
+           and os.getenv("GRASS_OVERWRITE") == None:
             grass.fatal(_("option: <output>: Raster map already exists."))
-        if options['output_var'] is not '' and (grass.find_file(options['output_var'], element = 'cell')['fullname'] and os.getenv("GRASS_OVERWRITE") == None):
+
+        if options['output_var'] is not '' \
+           and (grass.find_file(options['output_var'], element = 'cell')['fullname'] \
+           and os.getenv("GRASS_OVERWRITE") == None):
             grass.fatal(_("option: <output>: Variance raster map already exists."))
 
         importR()        
@@ -394,7 +401,8 @@
         import rpy2.robjects as robjects
         import rpy2.rinterface as rinterface #to speed up kriging? for plots.
     except ImportError:
-        grass.fatal(_("Python module 'Rpy2' not found. Please install it and re-run v.krige.")) # ok for other OSes?
+        # ok for other OSes?
+        grass.fatal(_("Python module 'Rpy2' not found. Please install it and re-run v.krige."))
         
     # R packages check. Will create one error message after check of all packages.
     missingPackagesList = []
@@ -402,7 +410,9 @@
         if not robjects.r.require(each, quietly = True)[0]:
             missingPackagesList.append(each)
     if missingPackagesList:
-        errorString = _("R package(s) ") + ", ".join(map(str, missingPackagesList)) +  _(" missing. Install it/them and re-run v.krige.")
+        errorString = _("R package(s) ") + \
+                      ", ".join(map(str, missingPackagesList)) + \
+                      _(" missing. Install it/them and re-run v.krige.")
         grass.fatal(errorString)
     
 if __name__ == '__main__':



More information about the grass-commit mailing list