Re: [GRASS-user] Select random cells from map

2010-06-07 Thread António Rocha

Thanks Hamish
I thought that random cells are retrieved from valid "map" cells. Or not?
Antonio

Hamish wrote:

António wrote:
  

I need to randomly select non-null cells from a given map.
I tried r.random.cells but I cannot define a maximum number
random cells and some selected random cells are not valid
values in my map. is there any other function to randomly
select cells from a raster?



Hamish:
  

r.to.vect to get a vector area coverage of your raster (do
not use the -s flag), then v.random.cover from wiki addons
then v.to.rast, and finally r.mapcalc to transfer values from
source map to random cell map? (probably we/I should make a
new wrapper script to do that automatically)

or you might skip the last steps and just use v.random.cover's
raster= option to sample the raster map directly.

probably the best idea is to fix r.random's cover= option to
loop until it has enough points.


also if you will be doing a lot of geostats it is probably
worth your while to learn about the GRASS<->R interface:
 http://grass.osgeo.org/wiki/R_statistics

... then the world is open to you.
  


António  wrote:
  
Thanks for your answer. I tried r.random with my input data and the 
number of cells and it worked but I do have one question: I didn't 
understand the objective of cover_map. I used the map from I want to 
extract random cells as input but what is the objective of cover_map?



r.random creates random points all over the current rectangular region
block.

Adding a cover map makes those random points only occur within the
irregular area covered by the cover map. (but r.random cover= is a bit
buggy right now; see new ticket in the bug trac'er)


Hamish



  



__ Information from ESET NOD32 Antivirus, version of virus signature 
database 5177 (20100606) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




  




__ Information from ESET NOD32 Antivirus, version of virus signature 
database 5178 (20100607) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] Select random cells from map

2010-06-02 Thread Hamish
> > António wrote:
> >> I need to randomly select non-null cells from a given map.
> >> I tried r.random.cells but I cannot define a maximum number
> >> random cells and some selected random cells are not valid
> >> values in my map. is there any other function to randomly
> >> select cells from a raster?

Hamish:
> > r.to.vect to get a vector area coverage of your raster (do
> > not use the -s flag), then v.random.cover from wiki addons
> > then v.to.rast, and finally r.mapcalc to transfer values from
> > source map to random cell map? (probably we/I should make a
> > new wrapper script to do that automatically)
> >
> > or you might skip the last steps and just use v.random.cover's
> > raster= option to sample the raster map directly.
> >
> > probably the best idea is to fix r.random's cover= option to
> > loop until it has enough points.
> >
> >
> > also if you will be doing a lot of geostats it is probably
> > worth your while to learn about the GRASS<->R interface:
> >  http://grass.osgeo.org/wiki/R_statistics
> >
> > ... then the world is open to you.

António  wrote:
> Thanks for your answer. I tried r.random with my input data and the 
> number of cells and it worked but I do have one question: I didn't 
> understand the objective of cover_map. I used the map from I want to 
> extract random cells as input but what is the objective of cover_map?

r.random creates random points all over the current rectangular region
block.

Adding a cover map makes those random points only occur within the
irregular area covered by the cover map. (but r.random cover= is a bit
buggy right now; see new ticket in the bug trac'er)


Hamish




___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] Select random cells from map

2010-06-01 Thread Hamish
António wrote:
> I need to randomly select non-null cells from a given map.
> I tried r.random.cells but I cannot define a maximum number
> random cells and some selected random cells are not valid
> values in my map. is there any other function to randomly
> select cells from a raster?

r.to.vect to get a vector area coverage of your raster (do
not use the -s flag), then v.random.cover from wiki addons
then v.to.rast, and finally r.mapcalc to transfer values from
source map to random cell map? (probably we/I should make a
new wrapper script to do that automatically)

or you might skip the last steps and just use v.random.cover's
raster= option to sample the raster map directly.

probably the best idea is to fix r.random's cover= option to
loop until it has enough points.


also if you will be doing a lot of geostats it is probably
worth your while to learn about the GRASS<->R interface:
 http://grass.osgeo.org/wiki/R_statistics

... then the world is open to you.


good luck,
Hamish




___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] Select random cells from map

2010-06-01 Thread António Rocha
Hi. I missed that r.random :) It seems to do what I need. I just need to 
understand a bit more what is the COVER parameter

Thanks nikos

Nikos Alexandris wrote:

António Rocha:
  

Hi there
I need to randomly select non-null cells from a given map. I tried
r.random.cells but I cannot define a maximum number random cells and
some selected random cells are not valid values in my map. is there any
other function to randomly select cells from a raster?



Doesn't "r.random" (not "r.random.cells") work? I think it works on/for non-
NULL cells.

In case r.random.cells and its capabilities are required, couldn't you just 
create a non-NULL MASK and limit its operation as you wish?


Nikos


__ Information from ESET NOD32 Antivirus, version of virus signature 
database 5163 (20100601) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




  




__ Information from ESET NOD32 Antivirus, version of virus signature 
database 5163 (20100601) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user