[GRASS-user] How to implement this kind of operation?

Glynn Clements glynn at gclements.plus.com
Mon Jul 2 06:55:25 PDT 2012


DavidRA wrote:

> I guess I could use the code of r.series, modifying it a bit to obtain a new
> function. The problem is that... man, that code is hard to understand. I do
> have some notions of C, but here I'm finding a lot of trouble to see what it
> does. For example, I don't see where it does the calculations: there is a
> section of the code with a comment saying "process the data", but inside of
> it, where is the average calculated? The average, or any of the other
> methods.

The aggregate functions (c_ave, c_median, etc) are all in lib/stats. 
The functions are also used by r.neighbors and r.resamp.stats.

r.series has a table of aggregates defined at the top of main.c. You
would need to define your aggregate function then add it to that
table.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-user mailing list