1v.db.univar(1) Grass User's Manual v.db.univar(1)
2
3
4
6 v.db.univar - Calculates univariate statistics on selected table col‐
7 umn for a GRASS vector map.
8
10 vector, statistics, attribute table
11
13 v.db.univar
14 v.db.univar --help
15 v.db.univar [-eg] map=name [layer=string] column=name
16 [where=sql_query] [percentile=float[,float,...]] [--help] [--ver‐
17 bose] [--quiet] [--ui]
18
19 Flags:
20 -e
21 Extended statistics (quartiles and 90th percentile)
22
23 -g
24 Print stats in shell script style
25
26 --help
27 Print usage summary
28
29 --verbose
30 Verbose module output
31
32 --quiet
33 Quiet module output
34
35 --ui
36 Force launching GUI dialog
37
38 Parameters:
39 map=name [required]
40 Name of vector map
41 Or data source for direct OGR access
42
43 layer=string
44 Layer number or name
45 Vector features can have category values in different layers. This
46 number determines which layer to use. When used with direct OGR
47 access this is the layer name.
48 Default: 1
49
50 column=name [required]
51 Name of attribute column on which to calculate statistics (must be
52 numeric)
53
54 where=sql_query
55 WHERE conditions of SQL statement without ’where’ keyword
56 Example: income < 1000 and population >= 10000
57
58 percentile=float[,float,...]
59 Percentile to calculate (requires extended statistics flag)
60 Options: 0-100
61 Default: 90
62
64 v.db.univar calculates basic univariate statistics for numeric
65 attributes in a vector attribute table. It will calculate minimum, max‐
66 imum, range, mean, standard deviation, variance, coefficient of varia‐
67 tion, quartiles, median, and 90th percentile.
68
69 v.db.univar uses db.univar which in turn uses db.select to get the
70 attribute values on which it calculates the statistics. This means
71 that statistics are calculated based on the entries in the attribute
72 table, not based on the features in the map. One attribute value is
73 read from each line in the attribute table, whether there are no, one
74 or several features with the category value referenced by that line, or
75 whether any features have more than one category value. For fea‐
76 ture-based, instead of attribute table-based, univariate statistics on
77 attributes see v.univar. NOTES A database connection must be defined
78 for the selected vector layer.
79
81 Univariate statistics on attribute table column
82 In this example, the 30 years precipitation data table is statistically
83 analysed (North Carolina sample dataset) and univariate statistics per‐
84 formed:
85 # show columns of attribute table connected to precipitation map
86 v.info -c precip_30ynormals
87 # univariate statistics on 30 years annual precipitation in NC
88 v.db.univar precip_30ynormals column=annual
89 Number of values: 136
90 Minimum: 947.42
91 Maximum: 2329.18
92 Range: 1381.76
93 Mean: 1289.31147058823
94 [...]
95
96 Univariate statistics on randomly sampled data points
97 In this example, random points are sampled from the elevation map
98 (North Carolina sample dataset) and univariate statistics performed:
99 g.region raster=elevation -p
100 v.random output=samples n=100
101 v.db.addtable samples column="heights double precision"
102 v.what.rast samples raster=elevation column=heights
103 v.db.select samples
104 v.db.univar samples column=heights
105
107 db.univar, r.univar, v.univar, db.select, d.vect.thematic, v.random
108
110 Michael Barton, Arizona State University
111
112 and authors of r.univar.sh (Markus Neteler et al.)
113
115 Available at: v.db.univar source code (history)
116
117 Main index | Vector index | Topics index | Keywords index | Graphical
118 index | Full index
119
120 © 2003-2019 GRASS Development Team, GRASS GIS 7.8.2 Reference Manual
121
122
123
124GRASS 7.8.2 v.db.univar(1)