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

#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&gt;
GRASS GIS <http://grass.osgeo.org>

#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: r.clump | Platform: Unspecified
      Cpu: Unspecified |
-------------------------+--------------------------------------------------
Changes (by martinl):

  * keywords: => r.clump

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1804#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#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: r.clump | Platform: Unspecified
      Cpu: Unspecified |
-------------------------+--------------------------------------------------

Comment(by mmetz):

Replying to [ticket:1804 marisn]:
> Current r.clump implementation uses 0 as NULL indicator and NULL cells
as any other values.

You could try r.clump2 from addons [0]. It should do what you want.

Markus M

[0] http://grasswiki.osgeo.org/wiki/AddOns/GRASS7/raster#r.clump2

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1804#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#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: r.clump | Platform: Unspecified
      Cpu: Unspecified |
-------------------------+--------------------------------------------------

Comment(by neteler):

Replying to [comment:2 mmetz]:
> You could try r.clump2 from addons [0]. It should do what you want.

We discussed in long time ago in the office :slight_smile: Maybe replace r.clump in
trunk with r.clump2 from Addons which is so much nicer?

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1804#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>

#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: r.clump | Platform: Unspecified
      Cpu: Unspecified |
-------------------------+--------------------------------------------------

Comment(by neteler):

Fixes have been made in r59076, r59082, r59122, r59128, r59131, r59136 but
I don't know if
r.clump2 in Addons is still better. The first fixes "do not clump NULL
data".

Solved?

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1804#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>

#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: r.clump | Platform: Unspecified
      Cpu: Unspecified |
-------------------------+--------------------------------------------------

Comment(by mmetz):

Replying to [comment:4 neteler]:
> Fixes have been made in r59076, r59082, r59122, r59128, r59131, r59136
but I don't know if
> r.clump2 in Addons is still better. The first fixes "do not clump NULL
data".

r.clump2 did not provide all the functionality of r.clump and was slower
than the new r.clump; removed from addons.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1804#comment:5&gt;
GRASS GIS <http://grass.osgeo.org>