Hi Markus,
Thanks for your comments.
It still appears that v.rast.stats is giving me different values to
r.univar.
Essentially I'd like to clarify how the values are derived from
v.rast.stats. I'm guessing that the discrepancy between my r.univar and
v.rast.stats outputs relates to how I'm using g.region?
The following shows my approach for deriving statistics from both r.univar
and v.rast.stats.
Cheers,
Richard
1. Using r.univar and zones to output stats
# set g.region for rasterizing vector
g.region -p -a vector=BMR_bndry_epsg4326@prcp05216ijk res=0.22
projection: 3 (Latitude-Longitude)
zone: 0
datum: wgs84
ellipsoid: wgs84
north: 14:31:12N
south: 13:12N
west: 99:39:36E
east: 101:12E
nsres: 0:13:12
ewres: 0:13:12
rows: 6
cols: 7
cells: 42
# rasterize vector to be used for zones
v.to.rast --overwrite input=BMR_bndry_epsg4326@prcp05216ijk type=area
output=BMR_bndry_epsg4326_rasterized use=cat
Reading areas...
Reading features...
Writing raster map...
Converted areas: 6 of 0
v.to.rast complete.
# set g.region for zones with r.univar
g.region -p rast=BMR_bndry_epsg4326_rasterized@prcp05216ijk
projection: 3 (Latitude-Longitude)
zone: 0
datum: wgs84
ellipsoid: wgs84
north: 14:31:12N
south: 13:12N
west: 99:39:36E
east: 101:12E
nsres: 0:13:12
ewres: 0:13:12
rows: 6
cols: 7
cells: 42
g.region -p align=cahpa_i0apr_05216_nc_remapped_nc_1@prcp05216ijk
projection: 3 (Latitude-Longitude)
zone: 0
datum: wgs84
ellipsoid: wgs84
north: 14:35:24N
south: 13:03N
west: 99:34:12E
east: 101:19:48E
nsres: 0:13:12
ewres: 0:13:12
rows: 7
cols: 8
cells: 56
r.univar -g -t map=cahpa_i0apr_05216_nc_remapped_nc_1@prcp05216ijk
zones=BMR_bndry_epsg4326_rasterized@prcp05216ijk
zone|label|non_null_cells|null_cells|min|max|range|mean|mean_of_abs|stddev|variance|coeff_var|sum|sum_abs
1|Category
1|4|0|3.58209799742326e-05|7.74326545069925e-05|4.16116745327599e-05|5.64720030524768e-05|5.64720030524768e-05|1.53324774982512e-05|2.35084866234379e-10|27.1505820043313|0.000225888012209907|0.000225888012209907
2|Category
2|2|0|3.53023679053877e-05|6.23035812168382e-05|2.70012133114506e-05|4.88029745611129e-05|4.88029745611129e-05|1.35006066557253e-05|1.82266380072614e-10|27.6634913694027|9.76059491222259e-05|9.76059491222259e-05
3|Category
3|1|0|8.14341983641498e-05|8.14341983641498e-05|0|8.14341983641498e-05|8.14341983641498e-05|0|0|0|8.14341983641498e-05|8.14341983641498e-05
4|Category
4|3|0|5.68314899282996e-05|8.2188387750648e-05|2.53568978223484e-05|6.57776896938837e-05|6.57776896938837e-05|1.16198714234862e-05|1.35021411898352e-10|17.6653687254186|0.000197333069081651|0.000197333069081651
5|Category
5|4|0|3.15697689075023e-05|4.9253627366852e-05|1.76838584593497e-05|3.7798413359269e-05|3.7798413359269e-05|7.09251495570204e-06|5.03037683968571e-11|18.7640546926894|0.000151193653437076|0.000151193653437076
6|Category
6|1|0|1.89598704309901e-05|1.89598704309901e-05|0|1.89598704309901e-05|1.89598704309901e-05|0|0|0|1.89598704309901e-05|1.89598704309901e-05
(Sun Feb 22 13:23:02 2015) Command finished (0 sec)
2. Check outputs against v.to.rast
# set g.region for raster (stats to be derived from this layer):
g.region -p -a raster=cahpa_i0apr_05216_nc_remapped_nc_1@prcp05216ijk
res=0.22
projection: 3 (Latitude-Longitude)
zone: 0
datum: wgs84
ellipsoid: wgs84
north: 35:38:24N
south: 15:10:48S
west: 89:45:36E
east: 140:34:48E
nsres: 0:13:12
ewres: 0:13:12
rows: 231
cols: 231
cells: 53361
v.rast.stats map=BMR_bndry_epsg4326@prcp05216ijk
raster=cahpa_i0apr_05216_nc_remapped_nc_1@prcp05216ijk
column_prefix=teststat method=number,minimum,maximum,range,average,sum
Outputs from attribute table:
cat,province,teststat_number,teststat_minimum,teststat_maximum,teststat_range,teststat_average,teststat_sum
1,krung_thep_maha_nakhon_bangkok,2,3.58209799742326e-05,6.23035812168382e-05,2.64826012426056e-05,4.90622805955354e-05,9.81245611910708e-05
2,samut_prakan,1,3.53023679053877e-05,3.53023679053877e-05,0,3.53023679053877e-05,3.53023679053877e-05
3,nonthaburi,2,5.02148177474737e-05,8.14341983641498e-05,3.12193806166761e-05,6.58245080558117e-05,0.000131649016111623
4,pathum_thani,3,4.46328085672576e-05,8.2188387750648e-05,3.75555791833904e-05,6.12175620820684e-05,0.000183652686246205
5,nakhon_pathom,3,3.81464305974077e-05,6.24195599812083e-05,2.42731293838006e-05,4.99398726484893e-05,0.000149819617945468
6,samut_sakhon,2,1.89598704309901e-05,7.74326545069925e-05,5.84727840760024e-05,4.81962624689913e-05,9.63925249379827e-05
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Searching-for-technical-details-on-how-v-rast-stats-calculates-means-and-other-statistics-tp5188809p5189188.html
Sent from the Grass - Users mailing list archive at Nabble.com.