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

Glynn Clements glynn at gclements.plus.com
Tue Jul 3 15:24:51 PDT 2012


DavidRA wrote:

> I'd also like to explore the scripting possibility. Do you think that mi
> purpose could be achieved with shell or python scripts?

It's not really feasible to do it with a "script". You can do it with
a Python program which uses the GRASS raster API; all of the core
GRASS libraries have Python bindings, so whatever you can do in C you
can do in Python. But doing it in Python would be just as much work as
doing it in C, so you're basically talking about re-writing r.series
in Python.

Extending r.series should be fairly straightforward. Look at the
existing aggregates in lib/stats/*.c for reference (you don't need a
w_* function; those aren't used by r.series). Your function can be
added to either libstats or to r.series. Once you've created a
function, add an entry in the "menu" array at the top of
r.series/main.c.

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


More information about the grass-user mailing list