[GRASS-dev] [GRASS GIS] #1996: r.random.cells not working correctly when min distance is < 0.1

#1996: r.random.cells not working correctly when min distance is < 0.1
-------------------------+--------------------------------------------------
Reporter: pvanbosgeo | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Default | Version: svn-trunk
Keywords: | Platform: Unspecified
      Cpu: Unspecified |
-------------------------+--------------------------------------------------
I am running r.random.cells in location/mapset with latlon with a
resolution of 0.008333. When using a minimum distance of e.g., 0.09
degrees, random locations / cells are selected that are closer then that
distance, including selection of neighboring cells.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1996&gt;
GRASS GIS <http://grass.osgeo.org>

#1996: r.random.cells not working correctly when min distance is < 0.1
----------------------------+-----------------------------------------------
Reporter: pvanbosgeo | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Raster | Version: svn-trunk
Keywords: r.random.cells | Platform: Unspecified
      Cpu: Unspecified |
----------------------------+-----------------------------------------------
Changes (by martinl):

  * keywords: => r.random.cells
  * component: Default => Raster

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

#1996: r.random.cells not working correctly when min distance is < 0.1
----------------------------+-----------------------------------------------
Reporter: pvanbosgeo | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Raster | Version: svn-trunk
Keywords: r.random.cells | Platform: Unspecified
      Cpu: Unspecified |
----------------------------+-----------------------------------------------

Comment(by hamish):

what is your ew, ns region resolution? (the module uses that)

r.random.cells does not know that 1deg lat is not the same distance as
1deg lon. Considering the nature of what it is doing (feeding into future
stats) I wouldn't risk the wrong answers, I'd run it from a projected
location instead of a lat/lon one.

the module is smart enough to deal with ew,ns resolution (of the same
units) being different though.

Hamish

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

#1996: r.random.cells not working correctly when min distance is < 0.1
----------------------------+-----------------------------------------------
Reporter: pvanbosgeo | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Raster | Version: svn-trunk
Keywords: r.random.cells | Platform: Unspecified
      Cpu: Unspecified |
----------------------------+-----------------------------------------------

Comment(by pvanbosgeo):

The region's resolution is 0.008333. Good point about different distances
latitudinal and longitudinal. In my specific case it doesn't really matter
though, I just want to avoid to select any two cells that are e.g., less
then 2 cells apart). A minimum distance of 0.09 should take care of that,
shouldn't it. However, the resulting layer does still contain plenty of
neighboring cells selected (see attached image).

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

#1996: r.random.cells not working correctly when min distance is < 0.1
----------------------------+-----------------------------------------------
Reporter: pvanbosgeo | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Raster | Version: svn-trunk
Keywords: r.random.cells | Platform: Unspecified
      Cpu: Unspecified |
----------------------------+-----------------------------------------------

Comment(by hamish):

without exploring the code to closely, perhaps what is happening is that
the random points in real x,y,z space are more than 1 cell space apart
from each other, but at the final rasterization step they trigger filling
adjacent cells?

{{{
+------+
| . |
| |
| |
+------+
| |
| |
| . |
+------+
}}}

But r.random.cells works on distance between the rows and columns, so
perhaps that is wrong and it is comparing distance between cell centers.
Further investigation would be needed to see at what stage the
rasterization happens.

Hamish

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