|
@@ -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 @@ int main(int argc, char *argv[])
|
|
|
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 @@ int main(int argc, char *argv[])
|
|
|
|
|
|
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 @@ static void select_from_geometry(void)
|
|
|
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 @@ static void select_from_database(void)
|
|
|
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 @@ static void select_from_database(void)
|
|
|
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 @@ static void select_from_database(void)
|
|
|
|
|
|
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]);
|