[GRASS-SVN] r63383 - grass/branches/releasebranch_7_0/vector/v.univar
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Dec 5 09:59:13 PST 2014
Author: neteler
Date: 2014-12-05 09:59:13 -0800 (Fri, 05 Dec 2014)
New Revision: 63383
Modified:
grass/branches/releasebranch_7_0/vector/v.univar/main.c
grass/branches/releasebranch_7_0/vector/v.univar/v.univar.html
Log:
v.univar: messages improved; manual: notes added and example updated to NC
Modified: grass/branches/releasebranch_7_0/vector/v.univar/main.c
===================================================================
--- grass/branches/releasebranch_7_0/vector/v.univar/main.c 2014-12-05 17:59:03 UTC (rev 63382)
+++ grass/branches/releasebranch_7_0/vector/v.univar/main.c 2014-12-05 17:59:13 UTC (rev 63383)
@@ -9,7 +9,7 @@
*
* PURPOSE: Univariate Statistics for attribute
*
- * COPYRIGHT: (C) 2004-2010 by the GRASS Development Team
+ * COPYRIGHT: (C) 2004-2014 by the GRASS Development Team
*
* This program is free software under the GNU General
* Public License (>=v2). Read the file COPYING that
@@ -92,6 +92,8 @@
G_add_keyword(_("vector"));
G_add_keyword(_("statistics"));
G_add_keyword(_("univariate statistics"));
+ G_add_keyword(_("attribute table"));
+ G_add_keyword(_("geometry"));
module->label =
_("Calculates univariate statistics for attribute.");
module->description = _("Variance and standard "
@@ -133,7 +135,7 @@
geometry = G_define_flag();
geometry->key = 'd';
- geometry->description = _("Calculate geometry distances instead of table data");
+ geometry->description = _("Calculate geometric distances instead of attribute statistics");
G_gisinit(argv[0]);
@@ -246,10 +248,12 @@
count = 0;
nlines = Vect_get_num_lines(&Map);
+ G_message(_("Calculating geometric distances between %d primitives..."), nlines);
/* Start calculating the statistics based on distance to all other primitives.
Use the centroid of areas and the first point of lines */
for (i = 1; i <= nlines; i++) {
+ G_percent(i, nlines, 2);
type = Vect_read_line(&Map, iPoints, Cats, i);
if (!(type & otype))
@@ -348,7 +352,7 @@
nrec =
db_select_CatValArray(Driver, Fi->table, Fi->key, col_opt->answer,
where_opt->answer, &Cvarr);
- G_debug(2, "nrec = %d", nrec);
+ G_debug(2, "db_select_CatValArray() nrec = %d", nrec);
ctype = Cvarr.ctype;
if (ctype != DB_C_TYPE_INT && ctype != DB_C_TYPE_DOUBLE)
@@ -366,18 +370,20 @@
if ((otype & GV_POINTS) || (otype & GV_LINES))
nlines = Vect_get_num_lines(&Map);
+ G_debug(1, "select_from_database: %d points", nlines);
for (line = 1; line <= nlines; line++) {
int i, type;
G_debug(3, "line = %d", line);
+ G_percent(line, nlines, 2);
type = Vect_read_line(&Map, Points, Cats, line);
if (!(type & otype))
continue;
for (i = 0; i < Cats->n_cats; i++) {
if (Cats->field[i] == ofield) {
- double val;
+ double val = 0.0;
dbCatVal *catval;
G_debug(3, "cat = %d", Cats->cat[i]);
@@ -459,7 +465,7 @@
for (i = 0; i < Cats->n_cats; i++) {
if (Cats->field[i] == ofield) {
- double val;
+ double val = 0.0;
dbCatVal *catval;
G_debug(3, "cat = %d", Cats->cat[i]);
Modified: grass/branches/releasebranch_7_0/vector/v.univar/v.univar.html
===================================================================
--- grass/branches/releasebranch_7_0/vector/v.univar/v.univar.html 2014-12-05 17:59:03 UTC (rev 63382)
+++ grass/branches/releasebranch_7_0/vector/v.univar/v.univar.html 2014-12-05 17:59:13 UTC (rev 63383)
@@ -7,18 +7,39 @@
<tt>type=point</tt> is defined.
<p>Extended statistics adds median, 1st and 3rd quartiles, and 90th
-percentile.
+percentile to the output.
+<h2>NOTES</h2>
+
+When using the <em>-d</em> flag, univariate statistics of vector
+geometry are calculated. Depending on the selected vector <em>type</em>,
+distances are calculated as follows:
+
+<ul>
+<li> <em>type=point</em>: point distances are considered;</li>
+<li> <em>type=line</em>: the first point of each line is considered;</li>
+<li> <em>type=area</em>: the centroid of each area is considered.</li>
+</ul>
+
<h2>EXAMPLE</h2>
+The example is based on the North Carolina sample dataset:
+
<div class="code"><pre>
-g.region rast=elevation.10m -p
-v.random out=samples n=100
-v.db.addtable samples col="heights double precision"
-v.what.rast samples rast=elevation.10m col=heights
-v.db.select samples
+g.region rast=elevation -p
+v.random output=samples npoints=100
+v.db.addtable map=samples columns="heights double precision"
+v.what.rast map=samples rast=elevation column=heights
+v.db.select map=samples
-v.univar samples col=heights type=point
+# calculate height attribute statistics:
+v.univar -e samples column=heights type=point
+
+# compare to statistics of original raster map:
+r.univar -e elevation
+
+# calculate distance between sampling points statistics:
+v.univar -d samples column=heights type=point
</pre></div>
@@ -30,8 +51,12 @@
</em>
-<h2>AUTHOR</h2>
+<h2>AUTHORS</h2>
Radim Blazek, ITC-irst
+<p>
+extended by:<br>
+Hamish Bowman, University of Otago, New Zealand<br>
+Martin Landa
<p><i>Last changed: $Date$</i>
More information about the grass-commit
mailing list