Opened 7 years ago

Last modified 18 months ago

#1996 new defect

r.random.cells not working correctly when min distance is < 0.1

Reported by: pvanbosgeo Owned by: grass-dev@…
Priority: normal Milestone: 7.0.7
Component: Raster Version: svn-trunk
Keywords: r.random.cells Cc:
CPU: Unspecified Platform: Unspecified

Description

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.

Attachments (1)

test2.png (5.9 KB) - added by pvanbosgeo 7 years ago.
random points generated with r.random.cell with minimum distance of 0.09 degrees. Regions resolution is 0.00833.

Download all attachments as: .zip

Change History (9)

comment:1 Changed 7 years ago by martinl

Component: DefaultRaster
Keywords: r.random.cells added

comment:2 Changed 7 years ago 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

Changed 7 years ago by pvanbosgeo

Attachment: test2.png added

random points generated with r.random.cell with minimum distance of 0.09 degrees. Regions resolution is 0.00833.

comment:3 Changed 7 years ago 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).

comment:4 Changed 7 years ago 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

comment:5 Changed 4 years ago by martinl

Milestone: 7.0.07.0.5

comment:6 Changed 4 years ago by neteler

Milestone: 7.0.57.0.6

comment:7 Changed 3 years ago by neteler

Milestone: 7.0.67.0.7

comment:8 Changed 18 months ago by martinl

What is status of this issue?

Note: See TracTickets for help on using tickets.