Dear all, i was able to compute zonal statistics for multiple areas using this script. I used > import grass.script as gscript > v_list = gscript.read_command("g.list" , type = "vect").strip().split("\n") # i have 5 vectors in my list > method = ("sum" , "average") > for v in v_list: > gscript.run_command("v.rast.stats", map_=v, raster = "LC1", column_prefix = "LC1", method = methods)
Now i have like 4 rasters that i would like to use as input to compute my statistics. Is there a way to loop this process for rasters and vector at the same time? i tried creating a list for rasters and using the name list as raster input but it seems not to work! cheers, Alessandro Il giorno mar 30 ott 2018 alle ore 11:52 Alessandro Sebastiani < alessandro.sebasti...@uniroma1.it> ha scritto: > Thanks a lot for your help! > > Il giorno mar 30 ott 2018 alle ore 11:49 Nikos Alexandris < > n...@nikosalexandris.net> ha scritto: > >> * Alessandro Sebastiani <alessandro.sebasti...@uniroma1.it> [2018-10-29 >> 21:32:51 +0100]: >> >> >thank you all for your suggestions. >> >Dear Nikos, I have some 0-1 rasters that represents presence-absence of >> >different land covers. Each raster's resolution is 10x10m, thus i want to >> >compute the sum in order to obtain the surface covered by each land cover >> >within my buffers. As regards to the buffer, i want to use the 0-100, >> >0-200, 0-300, 0-400 and 0-500 for computing stats. I can do it separately >> >with the module v.rast.stats. I just don't know how to loop it in a >> python >> >script >> >> Dear Alessandro, >> >> I don't have time to write back as I would like. Instead, I will send >> you off-list some unpublished script. With a bit of reading, there, you >> might identify some ideas that will eventually help in what you are >> doing. >> >> Kind regards, Nikos >> >
_______________________________________________ grass-user mailing list grass-user@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/grass-user