[GRASS-dev] [GRASS GIS] #1388: r3.univar gives bad results for cell counts

GRASS GIS trac at osgeo.org
Sun Jun 12 01:27:19 EDT 2011


#1388: r3.univar gives bad results for cell counts
-----------------------+----------------------------------------------------
 Reporter:  hamish     |       Owner:  grass-dev@…              
     Type:  defect     |      Status:  new                      
 Priority:  critical   |   Milestone:  6.4.2                    
Component:  Raster     |     Version:  svn-develbranch6         
 Keywords:  r3.univar  |    Platform:  Linux                    
      Cpu:  x86-32     |  
-----------------------+----------------------------------------------------
 Hi,

 `r3.univar` gives wrong results for cell counts.
 tested in 6.5svn on debian oldstable&stable ia32&amd64.


 2x2 test
 {{{
 cat << EOF > test_rast3d_2x2.asc
 north: 2.0
 south: 0.0
 east: 2.0
 west: 0.0
 top: 2.0
 bottom: 0.0
 rows: 2
 cols: 2
 levels: 2
 0 1
 1 0
 1 0
 0 1
 EOF

 r3.in.ascii in=test_rast3d_2x2.asc out=test3d.2x2
 g.region rast3d=test3d.2x2

 r3.univar test3d.2x2
 ==> total null and non-null cells: 0
 ==> total null cells: -8

 Of the non-null cells:
 ----------------------
 n: 8
 minimum: 0
 maximum: 0
 range: 0
 mean: 0.5
 mean of absolute values: 0.5
 standard deviation: 0.5
 variance: 0.25
 variation coefficient: 100 %
 sum: 4
 }}}

 stats seem ok, cell counts at top of 0,-8 should be 8,0.


 3x3 test
 {{{
 cat << EOF > test_rast3d_3x3.asc
 north: 3.0
 south: 0.0
 east: 3.0
 west: 0.0
 top: 3.0
 bottom: 0.0
 rows: 3
 cols: 3
 levels: 3
 0 0 1
 0 1 0
 1 0 0
 1 0 0
 0 1 0
 0 0 1
 0 1 0
 0 1 0
 0 1 0
 EOF

 r3.in.ascii in=test_rast3d_3x3.asc out=test3d.3x3
 g.region rast3d=test3d.3x3
 r3.univar test3d.3x3

 ==> total null and non-null cells: 0
 ==> total null cells: -27

 Of the non-null cells:
 ----------------------
 n: 27
 minimum: 0
 maximum: 0
 range: 0
 mean: 0.333333
 mean of absolute values: 0.333333
 standard deviation: 0.471405
 variance: 0.222222
 variation coefficient: 141.421 %
 sum: 9
 }}}

 same header text is wrong, but the rest of the stats (including n) are ok.

 The `r3.info` values look ok.


 ?,
 Hamish

-- 
Ticket URL: <https://trac.osgeo.org/grass/ticket/1388>
GRASS GIS <http://grass.osgeo.org>



More information about the grass-dev mailing list