1v.db.univar(1)              GRASS GIS User's Manual             v.db.univar(1)
2
3
4

NAME

6       v.db.univar   - Calculates univariate statistics on selected table col‐
7       umn for a GRASS vector map.
8

KEYWORDS

10       vector, statistics, attribute table
11

SYNOPSIS

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,...]]    [format=string]
17       [--help]  [--verbose]  [--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 ac‐
47           cess 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
63       format=string
64           Output format
65           Options: plain, json, shell
66           plain: Plain text output
67           json: JSON (JavaScript Object Notation)
68           shell: Shell script style for Bash eval
69

DESCRIPTION

71       v.db.univar  calculates  basic  univariate  statistics  for numeric at‐
72       tributes in a vector attribute table. It will calculate minimum,  maxi‐
73       mum,  range,  mean, standard deviation, variance, coefficient of varia‐
74       tion, quartiles, median, and 90th percentile.
75
76       v.db.univar uses db.univar which in turn uses db.select to get the  at‐
77       tribute  values on which it calculates the statistics.  This means that
78       statistics are calculated based on the entries in the attribute  table,
79       not  based on the features in the map. One attribute value is read from
80       each line in the attribute table, whether there are no, one or  several
81       features  with  the  category value referenced by that line, or whether
82       any features have more than one category value.  For feature-based, in‐
83       stead of attribute table-based, univariate statistics on attributes see
84       v.univar.  NOTES A database connection must be defined for the selected
85       vector layer.
86

EXAMPLES

88   Univariate statistics on attribute table column
89       In this example, the 30 years precipitation data table is statistically
90       analysed (North Carolina sample dataset) and univariate statistics per‐
91       formed:
92       # show columns of attribute table connected to precipitation map
93       v.info -c precip_30ynormals
94       # univariate statistics on 30 years annual precipitation in NC
95       v.db.univar precip_30ynormals column=annual
96        Number of values: 136
97        Minimum: 947.42
98        Maximum: 2329.18
99        Range: 1381.76
100        Mean: 1289.31147058823
101        [...]
102
103   Univariate statistics on randomly sampled data points
104       In  this  example,  random  points  are  sampled from the elevation map
105       (North Carolina sample dataset) and univariate statistics performed:
106       g.region raster=elevation -p
107       v.random output=samples n=100
108       v.db.addtable samples column="heights double precision"
109       v.what.rast samples raster=elevation column=heights
110       v.db.select samples
111       v.db.univar samples column=heights
112
113   JSON output
114       This uses the JSON output of the module which is passed  using  a  pipe
115       (in  Bash  or  other unix-like shell) to the jq tool which selects just
116       the relevant statistic.
117       v.db.univar precip_30ynormals column=annual format=json | jq .statistics.mean
118

SEE ALSO

120        db.univar, r.univar, v.univar, db.select, d.vect.thematic, v.random
121
122        GRASS SQL interface
123

AUTHORS

125       Michael Barton, Arizona State University
126
127       and authors of r.univar.sh (Markus Neteler et al.)
128

SOURCE CODE

130       Available at: v.db.univar source code (history)
131
132       Accessed: Saturday Oct 28 18:19:21 2023
133
134       Main index | Vector index | Topics index | Keywords index  |  Graphical
135       index | Full index
136
137       © 2003-2023 GRASS Development Team, GRASS GIS 8.3.1 Reference Manual
138
139
140
141GRASS 8.3.1                                                     v.db.univar(1)
Impressum