[GRASS-SVN] r66391 - grass/branches/releasebranch_7_0/scripts/v.krige
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Oct 1 03:26:43 PDT 2015
Author: neteler
Date: 2015-10-01 03:26:43 -0700 (Thu, 01 Oct 2015)
New Revision: 66391
Modified:
grass/branches/releasebranch_7_0/scripts/v.krige/v.krige.html
grass/branches/releasebranch_7_0/scripts/v.krige/v.krige.py
Log:
v.krige: updated to rgrass7 - sync to trunk (contributed by pvanbosgeo)
Modified: grass/branches/releasebranch_7_0/scripts/v.krige/v.krige.html
===================================================================
--- grass/branches/releasebranch_7_0/scripts/v.krige/v.krige.html 2015-10-01 10:24:08 UTC (rev 66390)
+++ grass/branches/releasebranch_7_0/scripts/v.krige/v.krige.html 2015-10-01 10:26:43 UTC (rev 66391)
@@ -1,6 +1,6 @@
<h2>DESCRIPTION</h2>
-<em>v.krige</em> allows performing kriging operations in GRASS
+<em>v.krige</em> allows performing Kriging operations in GRASS GIS
environment, using R software functions in background.
@@ -27,7 +27,7 @@
<dt><b>rpy2</b></dt>
<dd>Python binding to R. Note! <tt>rpy</tt> version 1 is not supported.</dd>
-<dt><b>R packages automap, gstat, spgrass6 and rgeos. </b></dt>
+<dt><b>R packages automap, gstat, rgrass7 and rgeos. </b></dt>
<dd>automap is optional (provides automatic variogram fit).</dd>
</dl>
@@ -35,7 +35,7 @@
<div class="code"><pre>
install.packages("rgeos", dep=T)
install.packages("gstat", dep=T)
- install.packages("spgrass6", dep=T)
+ install.packages("rgrass7", dep=T)
install.packages("automap", dep=T)
</pre></div>
@@ -60,12 +60,14 @@
and get the packages via aptitude:
<div class="code"><pre>
- aptitude install r-cran-gstat r-cran-spgrass6
+ aptitude install r-cran-gstat r-cran-rgrass7
</pre></div>
<h4>Notes for Windows</h4>
-Compile GRASS following this
+<!-- this is probably the wrong place -->
+
+Compile GRASS GIS following this
<a href="http://trac.osgeo.org/grass/wiki/CompileOnWindows">guide</a>.
You could also use Linux in a virtual machine. Or install Linux in a
separate partition of the HD. This is not as painful as it appears,
@@ -73,9 +75,9 @@
<h3>Computation time issues</h3>
-Please note that kriging calculation is slown down both by high number
-of input data points and/or high region resolution, even if they both
-contribute to a better output.
+Please note that although high number of input data points and/or high
+region resolution contribute to a better output, both will also slow down
+the kriging calculation.
<h2>EXAMPLES</h2>
@@ -88,9 +90,9 @@
<div class="code"><pre>
# reduce resolution for this example
g.region raster=elevation -p res=100
-v.random output=rand2k_elev n=2000
-v.db.addtable map=rand2k_elev column="elevation double precision"
-v.what.rast map=rand2k_elev rast=elevation column=elevation
+v.random output=rand2k_elev npoints=2000
+v.db.addtable map=rand2k_elev columns="elevation double precision"
+v.what.rast map=rand2k_elev raster=elevation column=elevation
</pre></div>
<b>Part 2: remove points lacking elevation attributes</b>. Points
@@ -102,26 +104,26 @@
removed from the map.
<div class="code"><pre>
-v.extract rand2k_elev output=rand2k_elev_filt where="elevation not NULL"
+v.extract input=rand2k_elev output=rand2k_elev_filt where="elevation not NULL"
</pre></div>
Check the result of previous line ("number of NULL attributes" must be
0):
<div class="code"><pre>
-v.univar rand2k_elev_filt type=point column=elevation
+v.univar map=rand2k_elev_filt type=point column=elevation
</pre></div>
-<b>Part 3: reconstruct DEM through kriging</b>. Using automatic
-variogram fit is the simplest way to run <em>v.krige</em> from CLI (note:
+<b>Part 3: reconstruct DEM through kriging</b>. The simplest way to run
+<em>v.krige</em> from CLI is using automatic variogram fit (note:
requires R's automap package). Output map name is optional, the
-modules creates it automatically appending "_kriging" the the input
+modules creates it automatically appending "_kriging" to the input
map name and also checks for overwrite. If output_var is specified,
the variance map is also created. Automatic variogram fit is provided
-by R package automap, the variogram models tested by the fitting
+by R package automap. The variogram models tested by the fitting
functions are: exponential, spherical, Gaussian, Matern, M.Stein's
parametrisation. A wider range of models is available from gstat
-package and can be tested on the GUI via the variogram plotting. If
+package and can be tested on the GUI via the variogram plotting. If a
model is specified in the CLI, also sill, nugget and range values are
to be provided, otherwise an error is raised (see second example of
<em>v.krige</em> command).
@@ -147,9 +149,9 @@
<div class="code"><pre>
r.mapcalc "rand2k_elev_kriging_pe = sqrt(rand2k_elev_kriging_var)"
-r.univar elevation
-r.univar rand2k_elev_kriging
-r.univar rand2k_elev_kriging_pe
+r.univar map=elevation
+r.univar map=rand2k_elev_kriging
+r.univar map=rand2k_elev_kriging_pe
</pre></div>
The results show high errors, as the kriging techniques (ordinary and
@@ -157,7 +159,7 @@
one used in this example: elevation is higher in the southwest corner
and lower on northeast corner. Universal kriging can give far better
results in these cases as it can handle the trend. It is available in
-R package gstat and will be part of a future v.krige release.
+R package gstat and will be part in a future v.krige release.
<h2>SEE ALSO</h2>
@@ -167,14 +169,14 @@
<br>
R
-package <a href="http://cran.r-project.org/web/packages/spgrass6/index.html">spgrass6</a>,
+package <a href="http://cran.r-project.org/web/packages/rgrass7/index.html">rgrass7</a>,
maintained by Roger Bivand
<br>
The <a href="http://grasswiki.osgeo.org/wiki/R_statistics">Short
Introduction to Geostatistical and Spatial Data Analysis with GRASS GIS
and R statistical data language</a> at the GRASS Wiki (includes
-installation tips).
+installation tips). It contains a subsection about <b>rgrass7</b>.
<br><br>
Modified: grass/branches/releasebranch_7_0/scripts/v.krige/v.krige.py
===================================================================
--- grass/branches/releasebranch_7_0/scripts/v.krige/v.krige.py 2015-10-01 10:24:08 UTC (rev 66390)
+++ grass/branches/releasebranch_7_0/scripts/v.krige/v.krige.py 2015-10-01 10:26:43 UTC (rev 66391)
@@ -6,7 +6,7 @@
PURPOSE: Performs ordinary or block kriging
-DEPENDS: R 2.x, packages gstat, maptools and spgrass6, optional: automap
+DEPENDS: R 2.x, packages gstat, maptools and rgrass7, optional: automap
COPYRIGHT: (C) 2009-2014 the GRASS Development Team
@@ -140,7 +140,7 @@
Checks for NULL values in the provided column and exits if they are present."""
#@NOTE: new way with R - as it doesn't alter original data
- Rpointmap = robjects.r.readVECT6(map, type = 'point')
+ Rpointmap = robjects.r.readVECT(map, type = 'point')
# checks if x,y columns are present in dataframe. If they do are present, but with different names,
# they'll be duplicated.
if "x" not in robjects.r.names(Rpointmap):
@@ -232,7 +232,7 @@
def ExportMap(self, map, column, name, overwrite, command, variograms):
# add kriging parameters to raster map history
- robjects.r.writeRAST6(map, vname = name, zcol = column, overwrite = overwrite)
+ robjects.r.writeRAST(map, vname = name, zcol = column, overwrite = overwrite)
grass.run_command('r.support',
map = name,
title = 'Kriging output',
@@ -408,7 +408,7 @@
# R packages check. Will create one error message after check of all packages.
missingPackagesList = []
- for each in ["rgeos", "gstat", "spgrass6", "maptools"]:
+ for each in ["rgeos", "gstat", "rgrass7", "maptools"]:
if not robjects.r.require(each, quietly = True)[0]:
missingPackagesList.append(each)
if missingPackagesList:
More information about the grass-commit
mailing list