Opened 12 years ago
Closed 8 years ago
#1804 closed defect (fixed)
r.clump NULL handling
Reported by: | marisn | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | 7.0.5 |
Component: | Raster | Version: | svn-trunk |
Keywords: | r.clump | Cc: | |
CPU: | Unspecified | Platform: | Unspecified |
Description
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; }
Change History (8)
comment:1 by , 12 years ago
Keywords: | r.clump added |
---|
follow-up: 3 comment:2 by , 12 years ago
comment:3 by , 12 years ago
follow-up: 5 comment:4 by , 11 years ago
comment:5 by , 11 years ago
Replying to 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.
comment:6 by , 9 years ago
Milestone: | 7.0.0 → 7.0.5 |
---|
comment:8 by , 8 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Replying to neteler:
Anything left here, marisn?
There have been made serious improvements for the module thus it seems to be completely fixed for me.
Replying to marisn:
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