2

I am using the grass (6.4.3!) function v.rast.stats to calculate the mean value of rast values over polygons.

The tool is somewhat slow and I actually only need the mean value. Is there any possibility/trick to reduce the calculation to the mean value (just like in grass 7.0)?

4
  • 1
    Any change to update to GRASS GIS 7? We released the stable 7 more than a year ago, after years of development... it is worth it! We have done major effort to make it faster, see trac.osgeo.org/grass/wiki/Release/7.0.0-News
    – markusN
    Feb 6, 2016 at 9:38
  • Thanks @markusN! I'm sure it's worth it...the problem is the script is really long and I fear it would be some effort to rewrite it to GRASS 7.0. But maybe it's really worth it!
    – countryman
    Feb 6, 2016 at 17:04
  • 2
    We have documented all changes, so it may be a reasonably small job for you: trac.osgeo.org/grass/wiki/Release/… (and further down on that page). In case of doubts, just ask :)
    – markusN
    Feb 7, 2016 at 14:37
  • 2
    Ah, cool!!!!! I didn't know that this list exists! Then it's really nice and easy! Thanks a lot for your help!!! :-)
    – countryman
    Feb 7, 2016 at 18:20

3 Answers 3

3

From the doc, I don't think it's possible.

However, if you are free to use QGIS, you could give a try to the LecoS plugin which allows you to choose the metric you want to compute (contrary to the native zonal statistics plugin).

2

Okay, when inspecting the source code I found out that GRASS 6.4.3's v.rast.stats grasps the output from r.univar with the bash command cut -d | -f.

As r.univar itself is a compiled script already and all statistics are calculated anyway, there is few possibility to get the script faster as far as I see things. The only way is to reduce the number of columns added to the attribute table in v.rats.stats, but with respect to time this will make only a small difference.

2

Okay, maybe the simplest option would just be to update to GRASS 7.0 with the help of the list mentioned by @markusN:

https://trac.osgeo.org/grass/wiki/Release/7.0.0-News#Optionchanges:flagsandparametersharmonized

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.