[GRASS-dev] Re: [GRASS GIS] #763: r.statistics method=distribution: no percentages for negative basemap values

GRASS GIS trac at osgeo.org
Fri Sep 10 02:49:11 EDT 2010


#763: r.statistics method=distribution: no percentages for negative basemap
values
--------------------+-------------------------------------------------------
 Reporter:  peifer  |       Owner:  grass-dev@…              
     Type:  defect  |      Status:  new                      
 Priority:  normal  |   Milestone:  6.4.0                    
Component:  Raster  |     Version:  6.4.0 RCs                
 Keywords:          |    Platform:  Unspecified              
      Cpu:  x86-32  |  
--------------------+-------------------------------------------------------

Comment(by peifer):

 This is how I fixed it locally, for me:

 {{{
 --- o_distrib.c.save    2008-12-19 21:28:36.000000000 +0100
 +++ o_distrib.c 2009-09-27 15:14:58.000000000 +0200
 @@ -65,7 +65,8 @@
      total_count = 0;

      while (fscanf(fd1, "%ld %ld %ld", &basecat, &covercat, &area) == 3) {
 -       if (catb != basecat && basecat > 0) {
 +       if (catb != basecat) {
             if (fscanf(fd2, "%ld %ld", &cat, &total_count) != 2)
                 return (1);
             catb = basecat;
 }}}

 A question, perhaps for Markus:[[BR]]
 Why should cat=0 cause problems for r.stats or r.statistics? It is a legal
 value, by the end of the day. I also vaguely remember that some
 r.stats/r.statistics/r.report output doesn't show the counts for cat=0. At
 the time, my workaround was to reclassify 0 to 99999 or some such, in
 order to get correct statistcs.

-- 
Ticket URL: <http://trac.osgeo.org/grass/ticket/763#comment:3>
GRASS GIS <http://grass.osgeo.org>



More information about the grass-dev mailing list