[GRASS-dev] [grass-code R][338] different sampling methods

code R item #338, was opened at 2007-03-19 15:00
Status: Open
Priority: 3
Submitted By: Martin Wegmann (wegmann)
Assigned to: Nobody (None)
Summary: different sampling methods
Issue status: None
GRASS component: vector
Operating system: Linux
Operating system version: debian

Initial Comment:
Hello,

beside v.random or r.random to set points for latter analysis into an area other options would be very handy:

- sampling every 10th point of raster
- linear sampling: small areas have less points than larger areas

other sampling strategies could be implemented see Dylans page: http://casoilresource.lawr.ucdavis.edu/drupal/node/320

this ought to be either done per raster or per raster but separated by classes in raster.

Martin

----------------------------------------------------------------------

You can respond by visiting:
http://wald.intevation.org/tracker/?func=detail&atid=188&aid=338&group_id=21

grass-coder wald.intevation org wrote:

code R item #338, was opened at 2007-03-19 15:00

..

Summary: different sampling methods

..

beside v.random or r.random to set points for latter analysis into an
area other options would be very handy:

- sampling every 10th point of raster

use the modulus operator with r.mapcalc.

r.mapcalc ... \
  if( ((row() % 10) == 0) && ((col() % 10) == 0), map, null() )

?

- linear sampling: small areas have less points than larger areas

well, they do have points proportial to area already.
Do you mean proportional to area^2 or so?
(sorry for the basic question, I'm not a stats person)

Hamish

On Monday 19 March 2007 08:00, grass-coder@wald.intevation.org wrote:

code R item #338, was opened at 2007-03-19 15:00
Status: Open
Priority: 3
Submitted By: Martin Wegmann (wegmann)
Assigned to: Nobody (None)
Summary: different sampling methods
Issue status: None
GRASS component: vector
Operating system: Linux
Operating system version: debian

Initial Comment:
Hello,

beside v.random or r.random to set points for latter analysis into an area
other options would be very handy:

- sampling every 10th point of raster
- linear sampling: small areas have less points than larger areas

other sampling strategies could be implemented see Dylans page:
http://casoilresource.lawr.ucdavis.edu/drupal/node/320

this ought to be either done per raster or per raster but separated by
classes in raster.

Martin

Hi Martin,

I have thought about this as well. I am not a good enough coder to implement
all of the sampling routines that would be required: i.e. using
stratification, etc. I have been able to create sampling designs using
the 'spatstat' package in R however. I see two possible approaches:

1. we implement a full suite of sampling algorithms into v.random
- regular grid
- non-aligned
- random
- random stratified by areas or lines
- random along line segments
- random generation of line segments

this would require some work, but I have some references for most of the
algorithms handy -- I cannot implement them well.

2. we work with Roger Bivand to create some tutorials on moving grass vectors
into R, and using the sampling algorithms there, finally moving the results
back to GRASS. I think that this is currently possible, we just need some
help writing it up. On the page that you referenced
(http://casoilresource.lawr.ucdavis.edu/drupal/node/319) I have used
intermediate text files to move GRASS vectors back and forth. Using the
spgrass6 package to do this would be a big improvement.

Cheers,

--
Dylan Beaudette
Soils and Biogeochemistry Graduate Group
University of California at Davis
530.754.7341