[GRASS-user] improve v.rast.stats speed?

G. Allegri giohappy at gmail.com
Thu Feb 19 18:55:29 EST 2009


Thanks Markus. I'm out of office, but I will try your solution as soon
as possible.

2009/2/20 Markus Metz <markus.metz.giswork at googlemail.com>:
> Hi Giovanni,
>
> could you please check out
> svn checkout https://svn.osgeo.org/grass/grass-addons/raster/r.univar2.zonal
> and let me know if the results and the speed are ok?
>
> r.univar2.zonal does zonal statistics if I understood the concept all right.
> You have to give a zoning map as input. That would be in your case the
> rasterized vector areas. The output can be very long, as in your case, so I
> added an option to dump the stats in a file, that way it's easier to
> scrutinize.
> In my tests, the stats were identical to r.univar2 in develbranch_6, only
> that I had to run r.univar2.zonal only once and not several times. This
> r.univar2.zonal is not polished: 3D support is missing and the output is not
> shell style although it should be, no idea why not. I would like to leave
> the polishing to the experts.
>
> I haven't added an entry in wiki addons, because I don't know if this is an
> unpolished gem or unnecessary with your current solution or a pile of trash
> (well, not completely trash, results are at least identical to r.univar2).
>
> Regards,
>
> Markus M
>
>
> G. Allegri wrote:
>>
>> The rasterizing method gives comparable performances to ArcGIS. I
>> confirm that it does the same.
>> The bottleneck is the r.univar limitation to CELL. I have to
>> investigate why, as it is based on r.stats which works with
>> DCELL/FCELL too
>>
>> The final join would be an improvement respect to Zonal Statistics in
>> ArcGIS which simply produce a dbf with OIDs from polygon IDs but
>> doesn't merge it into the original vectorial.
>>
>>
>> 2009/2/19 Markus Metz <markus.metz.giswork at googlemail.com>:
>>
>>>
>>> Markus Neteler wrote:
>>>
>>>>
>>>> On Thu, Feb 19, 2009 at 2:20 PM, G. Allegri <giohappy at gmail.com> wrote:
>>>>
>>>>
>>>>>
>>>>> Thanks for the ideas.
>>>>> I've just tried Starspan but it's performance is still too slow. I've
>>>>> let it run for 15 minutes...
>>>>>
>>>>>
>>>>
>>>> Can you please try GRASS 7?
>>>> grass70/scripts/v.rast.stats/v.rast.stats.py
>>>>
>>>>
>>>
>>> grass70/scripts/v.rast.stats/v.rast.stats.py also uses r.mapcalc in every
>>> pass:
>>>
>>> for i in cats:
>>>  ...
>>>  grass.mapcalc("MASK = if(...)
>>>
>>> if v.rast.stats is faster in grass7, then probably because of improved
>>> raster libs. A speed increase from >5 hours to 40 seconds is unlikely
>>> since
>>> grass.mapcalc is still called 1793 times (assuming each area has a unique
>>> category) for a region with 4415x6632 cells...
>>>
>>>
>>>
>>
>>
>


More information about the grass-user mailing list