[GRASS-dev] [GRASS GIS] #1804: r.clump NULL handling

GRASS GIS trac at osgeo.org
Wed Nov 21 09:48:21 PST 2012


#1804: r.clump NULL handling
-------------------------+--------------------------------------------------
 Reporter:  marisn       |       Owner:  grass-dev@…              
     Type:  defect       |      Status:  new                      
 Priority:  normal       |   Milestone:  7.0.0                    
Component:  Raster       |     Version:  svn-trunk                
 Keywords:               |    Platform:  Unspecified              
      Cpu:  Unspecified  |  
-------------------------+--------------------------------------------------
 Current r.clump implementation uses 0 as NULL indicator and NULL cells as
 any other values.

 Setting 0 and NULL to NULL can be done with following code. Unfortunately
 today my pointer-fu is too weak (around line 229) to change code to treat
 0 as valid value and leave NULL as-is.

 Clumping 0 areas as any other areas would be sensible thing. The open
 question remains - should NULL areas also be clumped or just skipped and
 left as-is (NULL)?

 {{{
 Index: raster/r.clump/clump.c
 ===================================================================
 --- raster/r.clump/clump.c      (revision 53904)
 +++ raster/r.clump/clump.c      (working copy)
 @@ -105,7 +105,7 @@
             for (col = 1; col <= ncols; col++) {
                 LEFT = X;
                 X = cur_in[col];
 -               if (X == 0) {   /* don't clump zero data */
 +               if (X == 0 || Rast_is_c_null_value(&X)) { /* don't clump
 zero/NULL data */
                     cur_clump[col] = 0;
                     continue;
                 }
 }}}

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



More information about the grass-dev mailing list