Dear Markus,

Excellent! Thanks to everyone for their help.
I tested r.diversity in the new revision (61840) on a raster with 12933032 
cells and it took under 3 minutes to complete r.li.simpson, r.li.shannon, 
r.li.pielou and r.li.renyi outputs.
Amazing :)

> execGRASS("r.diversity",flags="overwrite", parameters=list(input="flow", 
> prefix="flow_div", alpha=0.5, size=3))
> r.li.simpson complete. Raster map <flow_div_simpson_size_3.0> created.
> r.li.shannon complete. Raster map <flow_div_shannon_size_3.0> created.
> r.li.pielou complete. Raster map <flow_div_pielou_size_3.0> created.
> r.li.renyi complete. Raster map <flow_div_renyi_size_3.0_alpha_0.5>
> created.
> Done. 

Thanks again and keep well.

Cheers
Sandra

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of 
Markus Neteler
Sent: 06 September 2014 05:15 AM
To: Sandra MacFadyen
Cc: GRASS user list; Duccio Rocchini; Luca Delucchi
Subject: Re: [GRASS-user] execGRASS("r.diversity") Done. No rasters created 
(Large rasters)

Dear Sandra,

On Fri, Jun 20, 2014 at 7:49 AM, Markus Neteler <[email protected]> wrote:
> On Sat, Jun 14, 2014 at 9:21 AM, Sandra MacFadyen <[email protected]> wrote:
>> I am using r.diversity (GRASS GIS 7.0.0svn build 60785 win32) through 
>> R (R version 3.0.2 win32) on Windows 7 64bit.
...
>> However, when running the same code on a larger image (cells=6746328) 
>> from my own location, although it reports Done, no rasters are 
>> created. If I subset the image
>> (cells=1632830) and run it again its works (see # sub2Kruger # code and 
>> results below).
>> So I'm guessing it is a memory issue?
...
> ... it consumes a lot of memory... will check on a bigger machine, 
> perhaps a memory leak.

The assumption turned out to be right and I think we got it today!

Vaclav Petras checked it and discovered an "unfortunate" memory allocation 
which he fixed in r.li.* in revision 
http://trac.osgeo.org/grass/changeset/61812 ("r.li: fix memory handling (memory 
leak in avl_to_array function))".

Now r.li has become very fast, on my laptop:

GRASS 7.1.svn (nc_spm_08_grass7):~ >  g.region -p rast=lsat5_1987_10 res=10 -a 
...
rows:       1355
cols:       1503
cells:      2036565

GRASS 7.1.svn (nc_spm_08_grass7):~ > time -p r.li.simpson --o 
input=lsat5_1987_10@landsat conf=conf_diversity_5.0
output=lsat5_1987_div__simpson_size_5.0
r.li.simpson complete. Raster map <lsat5_1987_div__simpson_size_5.0>
created.
--> 29.32 seconds

or with a simulated higher resolution:

GRASS 7.1.svn (nc_spm_08_grass7):~ >  g.region -p rast=lsat5_1987_10
res=5 -aprojection: 99 (Lambert Conformal Conic) ...
rows:       2708
cols:       3005
cells:      8137540

GRASS 7.1.svn (nc_spm_08_grass7):~ > time -p r.li.simpson --o 
input=lsat5_1987_10@landsat conf=conf_diversity_5.0
output=lsat5_1987_div__simpson_size_5.0
r.li.simpson complete. Raster map <lsat5_1987_div__simpson_size_5.0>
created.
--> 227.37 seconds (used to be > 2 hours)

So, to grab this improvement for Windows, grab the version from here:
http://wingrass.fsv.cvut.cz/grass71/

(or via OSGeo4W installer). Be sure that the revision is at least
r61812 which is indicated in the file name.

Please let us know if all works to avoid that the change has any negative 
impact.
Tests here did not show any changes in the output except for the speed 
improvement and solved memory leak.

Subsequently also r.diversity should behave now.

I'll backport it to GRASS 7.0 release branch after some testing.

Markus

_______________________________________________
grass-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-user

Reply via email to