Hi Moritz,
thanks for the comments.
I didn't know that r.mask had a 'cat' option, this makes the whole process more 
direct. The same for using g.region raster=MASK.
Also, the hint about keeping info as text (as you did in i.segment.stats) and 
raster is a very good idea to make the process faster. I'll implement those 
things to speed up the code.
I don't know if it makes it clearer, but what we wanted is to calculate several 
metrics and statistics, using Brazilian city limits as zones (a total of ~5,600 
cities), based on land use maps for the whole country (resolution = 30m), for 
all years from 2000 to 2016. Also, we didn't wanted to calculate only 
general/basic statistics such as average, sum, etc., but also more specific 
metrics such as the area and percentage of different cover classes, edge 
amount, number of forest patches, isolation between forest patches and 
others.That's why I chose to build it in a way we write a given function (that 
calculated any of these metrics) and then we use it as an argument for the 
process, so that we loop over polygons and over input rasters to calculate 
these metrics for each city.
That was my initial aim, but I guess this may also be useful in other cases.
I know r.li (but didn't tested r.pi yet), the metrics it calculates are very 
interesting but somehow limited (of course I could write other ones based on 
the r.li.daemon core function, but I am not very well versed in C to use it 
yet...). Even though, I agree I could use maybe a combination of r.li and make 
some calculations with the output info of r.univar and r.stats to get the same 
numbers, and maybe I would be able to avoid loops.I'll think about it.
Thanks, Moritz and Stephan!Bernardo    Em quinta-feira, 12 de abril de 2018 
13:15:17 BRT, Moritz Lennert <mlenn...@club.worldonline.be> escreveu:  
 On 12/04/18 16:56, Bernardo Santos wrote:
> For example, I am still not sure how I would use a combination of 
> r.univar/r.stats and some kind of input raster map to produce, say, 
> zonal info of number of habitat patches, structural or functional 
> connectivity, isolation, or other more complex metrics used in landscape 
> ecology.
> That's way I was building something like that, so that we can just write 
> an alternative function using any raster input map that returns the 
> value of one of such metrics, and then use it to calculate them over 
> sets of zones.

Have you looked into the landscape metrics modules, notably the r.li 
suite of modules, but also the r.pi suite in the addons (although ISTR 
that the latter is not really usable in its current state) ?

grass-user mailing list

Reply via email to