#1977: r.random.cells does not respect MASK
----------------------------------+-----------------------------------------
Reporter: pvanbosgeo | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 6.4.3
Component: Raster | Version: unspecified
Keywords: r.random.cells, mask | Platform: Unspecified
Cpu: Unspecified |
----------------------------------+-----------------------------------------
In the helpfile of r.random.cells, it is mentioned that "Random cells will
not be generated in areas masked off". However, in reality the function
does not (seem to) respect the MASK.
#1977: r.random.cells does not respect MASK
----------------------------------+-----------------------------------------
Reporter: pvanbosgeo | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 6.4.3
Component: Raster | Version: unspecified
Keywords: r.random.cells, mask | Platform: Unspecified
Cpu: Unspecified |
----------------------------------+-----------------------------------------
Comment(by hamish):
Works for me -- random cells are only created in the MASKed areas. the
areas not covered by the MASK map are flood filled with "0". (use "r.null
setnull=0" to clear that away)
#1977: r.random.cells does not respect MASK
----------------------------------+-----------------------------------------
Reporter: pvanbosgeo | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Raster | Version: svn-trunk
Keywords: r.random.cells, mask | Platform: Unspecified
Cpu: Unspecified |
----------------------------------+-----------------------------------------
Comment(by pvanbosgeo):
Ah, yes, its not working for me on trunk. Sorry for the wrong milestone
and not mentioning this was with grass 7. The mentioned add-on works, but
it does not enforce a minimal spacing between points as far as I can see.
#1977: r.random.cells does not respect MASK
----------------------------------+-----------------------------------------
Reporter: pvanbosgeo | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Raster | Version: svn-trunk
Keywords: r.random.cells, mask | Platform: Unspecified
Cpu: Unspecified |
----------------------------------+-----------------------------------------
Comment(by mmetz):
Replying to [ticket:1977 pvanbosgeo]:
> In the helpfile of r.random.cells, it is mentioned that "Random cells
will not be generated in areas masked off". However, in reality the
function does not (seem to) respect the MASK.
Try r56375. The bug comes from the times when zero was regarded as NULL.
Actually it should not work either in 6.x because for CELL_TYPE NULL != 0.
#1977: r.random.cells does not respect MASK
----------------------------------+-----------------------------------------
Reporter: pvanbosgeo | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Raster | Version: svn-trunk
Keywords: r.random.cells, mask | Platform: Unspecified
Cpu: Unspecified |
----------------------------------+-----------------------------------------
Comment(by pvanbosgeo):
Great, it works now, with the note that all cells other than the random
points (cells) have the value 0, including all cells outside the masked
area. That is fine, although a suggestion might be to set all cells,
except obviously the random points, to NULL, like r.random does.
#1977: r.random.cells does not respect MASK
----------------------------------+-----------------------------------------
Reporter: pvanbosgeo | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Raster | Version: svn-trunk
Keywords: r.random.cells, mask | Platform: Unspecified
Cpu: Unspecified |
----------------------------------+-----------------------------------------
Comment(by mmetz):
Replying to [comment:7 hamish]:
> Replying to [comment:5 mmetz]:
> > Actually it should not work either in 6.x because for CELL_TYPE NULL
!= 0.
>
> and yet it does work there.
>
> perhaps because it uses G_get_map_row_nomask()?
Trunk uses Rast_get_c_row_nomask().
I created a MASK that contains only NULL and 1, no zero. Therefore I think
it is a bug in G_get_map_row_nomask() of 6.x, converting NULL to zero.