[GRASS-dev] v.cellstats script [+new module: r.out.xyz]

Dylan Beaudette dylan.beaudette at gmail.com
Mon Nov 20 13:09:49 EST 2006


Hi Hamish, Martin:

On Monday 20 November 2006 06:57, Martin Wegmann wrote:
> hello Hamish,
>
> On Saturday 18 November 2006 08:11, Hamish wrote:
> > Martin Wegmann wrote:
> > > Carlos Grohmann and I created a script as substitute for v.cellstats.
> > > It would be great if somebody can look through it to give feed-back
> > > how to improve it before we post it to the WIKI.
>
> [...]
>
> > how does this script's function differ from the new r.resamp.stats
> > module?
>
> yes it looks the same and it's much faster, but it variance is missing.

Great, always on the lookout for modules that aid with *scaling* operations. 
Any benchmarks?

> I did a test with v.cellstats2 and r.resamp.stats (+ r.to.vect + g.region +
> v.surf.rst) using spearfish and the result in quite the same.

Interpolation ? Was this for a downscaling operation? i.e. large cell size to 
small cell size?

> Perhaps it is worth to write a script v(r).cellstats with r.resamp.stats +
> subsequent commands to receive interpolated high res. results.

Not sure how to interpret this.

Once the suggested changes have been made, I would be willing to test 
aggregation with the new modules against the two other methods that I have 
recently used: 
1. starspan
2. r.resamp.stats

link to tests here:
http://casoilresource.lawr.ucdavis.edu/drupal/node/275

Cheers,

Dylan

> > script notes:   (many are general comments for all grass scripts)
> >
> >
> > * _v._cellstats, but it imports and exports raster maps!
>
> yes, you are right r.cellstats would be better. we named it v.*  just 
> because we wanted to provide a subsitute for v.cellstats
>
> thanks for your comments below, I will work through them and modify script.
>
> cheers, Martin
>
> > * use standard input= and output= option names for consistency.
> >   make input= the first option
> >
> > * output maps should use the "new,cell,raster". This way --overwrite
> > works, etc
> > #% key: raster
> > #% gisprompt: old,cell,raster
> >
> > * for method key, use "options:" line to specify available methods.
> > #% options: n,min,max,range,sum,mean,stddev,variance,coeff_var
> >
> > * redirect status messages to stderr:  (helps parsing output to a file)
> > echo "You must be in GRASS GIS to run this program" 1>&2
> >
> > * export cell x,y,z to file directly:
> > was:
> >   #convert to vect and export as ascii
> >   r.to.vect -z input=$GIS_OPT_raster output=tmp_vect feature=point
> >   v.out.ascii input=tmp_vect output=xyz_file format=point
> > easier:
> >   r.stats -1ng "$GIS_OPT_raster" > xyz_file
> >
> > (as this is impossible to guess without prior experience, I've just
> > written a simple wrapper script called r.out.xyz, now in 6.3cvs.
> > maybe better as an option to r.out.ascii?)
> >
> > * use "r.to.vect -b" so the script can work with larger grids
> > (1500x1500) input -> 2.25million vector point & memory problems
> > if topology is built. Also, r.in.xyz has to keep the entire map in
> > memory, so hard-coding percent=100 for Very large grids could cause
> > problems.
> >
> > * use g.tempfile  (script won't work if in a non writeable dir, eg "/")
> > see grass scripts/ for an example of doing that safely
> > (e.g. r.univar.sh)
> >
> > * double quote all "$VARIABLES". legal map names may include restricted
> > shell chars, filenames may include spaces.
> >
> >
> > cheers,
> > Hamish
> >
> > _______________________________________________
> > grass-dev mailing list
> > grass-dev at grass.itc.it
> > http://grass.itc.it/mailman/listinfo/grass-dev
>
> _______________________________________________
> grass-dev mailing list
> grass-dev at grass.itc.it
> http://grass.itc.it/mailman/listinfo/grass-dev

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




More information about the grass-dev mailing list