[GRASS-user] Searching for technical details on how v.rast.stats calculates means and other statistics

Markus Metz markus.metz.giswork at gmail.com
Sat Feb 21 02:20:59 PST 2015


On Fri, Feb 20, 2015 at 12:33 PM, RichardCooper <richtcooper at hotmail.com> wrote:
> I seem to be getting an error with r.univar when using a zone file.
>
> I run, g.region as follows:
> g.region -a raster=cahpa_i0apr_05216_nc_remapped_nc_1 at prcp05216ijk res=0.22

When you use g.region -a res=, the new computational region is most
probably not identical to the raster's grid geometry. Better just use

g.region -a raster=cahpa_i0apr_05216_nc_remapped_nc_1 at prcp05216ijk res=0.22

If you are interested in stats for zones, you could do

g.region rast=zones
g.region align=cover

in your case

g.region rast=BMR_bndry_epsg4326_rasterized at prcp05216ijk
g.region align=cahpa_i0apr_05216_nc_remapped_nc_1 at prcp05216ijk

HTH,

Markus M

>
> Then r.univar (see below).
> There are 6 categories in the zone file, but r.univar reports null cells for
> category 1? Initially I thought it was me not setting g.region correctly,
> but I can't seem to get it to work as expected.
>
> Any ideas would be welcome.
>
> Cheers,
> Richard
>
> r.univar map=cahpa_i0apr_05216_nc_remapped_nc_1 at prcp05216ijk
> zones=BMR_bndry_epsg4326_rasterized at prcp05216ijk
> zone 1 Category 1
> total null and non-null cells: 4
> total null cells: 0
> Of the non-null cells:
> ----------------------
> n: 4
> minimum: 3.5821e-05
> maximum: 7.74327e-05
> range: 4.16117e-05
> mean: 5.6472e-05
> mean of absolute values: 5.6472e-05
> standard deviation: 1.53325e-05
> variance: 2.35085e-10
> variation coefficient: 27.1506 %
> sum: 0.000225888012209907
> zone 2 Category 2
> total null and non-null cells: 2
> total null cells: 0
> Of the non-null cells:
> ----------------------
> n: 2
> minimum: 3.53024e-05
> maximum: 6.23036e-05
> range: 2.70012e-05
> mean: 4.8803e-05
> mean of absolute values: 4.8803e-05
> standard deviation: 1.35006e-05
> variance: 1.82266e-10
> variation coefficient: 27.6635 %
> sum: 9.76059491222259e-05
> zone 3 Category 3
> total null and non-null cells: 1
> total null cells: 0
> Of the non-null cells:
> ----------------------
> n: 1
> minimum: 8.14342e-05
> maximum: 8.14342e-05
> range: 0
> mean: 8.14342e-05
> mean of absolute values: 8.14342e-05
> standard deviation: 0
> variance: 0
> variation coefficient: 0 %
> sum: 8.14341983641498e-05
> zone 4 Category 4
> total null and non-null cells: 3
> total null cells: 0
> Of the non-null cells:
> ----------------------
>
>
> This is my zones file:
> Type of Map:  raster               Number of Categories: 6
>  |   Data Type:    CELL
>  |   Rows:         231
>  |   Columns:      231
>  |   Total Cells:  53361
>  |        Projection: Latitude-Longitude
>  |            N:  35:38:24N    S:  15:10:48S   Res: 0:13:12
>  |            E: 140:34:48E    W:  89:45:36E   Res: 0:13:12
>  |   Range of data:    min = 1  max = 6
>  |
>  |   Data Source:
>  |    Vector Map: BMR_bndry_epsg4326 at prcp05216ijk
>  |    Original scale from vector map: 1:1
>  |
>  |   Data Description:
>  |    generated by v.to.rast
>  |
>  |   Comments:
>  |    v.to.rast input="BMR_bndry_epsg4326 at prcp05216ijk" layer="1" type="ar\
>  |    ea" output="BMR_bndry_epsg4326_rasterized" use="cat" value=1 memory=\
>  |    300
>  |
>
>
> This is the raster file:
>
>   Type of Map:  raster               Number of Categories: 0
>  |   Data Type:    FCELL
>  |   Rows:         230
>  |   Columns:      230
>  |   Total Cells:  52900
>  |        Projection: Latitude-Longitude
>  |            N:  35:29:24N    S:  15:06:36S   Res: 0:13:12
>  |            E: 140:29:24E    W:  89:53:24E   Res: 0:13:12
>  |   Range of data:    min = 0  max = 0.002821672
>  |
>
>
>
> --
> 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-tp5188809p5188865.html
> Sent from the Grass - Users mailing list archive at Nabble.com.
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user


More information about the grass-user mailing list