Hello programmers.
Consider a Python class with methods that derive a somewhat complex mapcalc
expression which contains the following pixel modifiers:
['A[-1, -1]', 'A[-1, 0]', 'A[-1, 1]', 'A[0, -1]', 'A[0, 0]', 'A[0, 1]',
'A[1, -1]', 'A[1, 0]', 'A[1, 1]']
These modifiers built-up a moving window to compute some values (eg. mean, median and other in-between values) and finally end up in a polynomial like:
-9.674 + 0.653 * SomeValue + 9.087 * SomeValue^2
As far as my understanding goes, I can't check for the validity of the
in-between computed values with mapcalc's powers. For example, check if the
average value as derived from the above defined pixel modifiers, lies within a
specific range. I have build helper functions, as part of the Python class,
which could do this. Then again, I don't have the powers of mapcalc to process
the data.
I wonder how I should approach this, excluding rewriting my program in C (which
I don't speak easily). If I go step-by-step, that is:
1) compute a map based with the mean of neighboring pixels (see pix-modifiers above)
2) use pyGRASS' RasterRow, for example, to be able to apply some helper function and check or do something
3) compute another, required, in-between map
4) use pyGRASS again
5) etc.
up until to reach the final equation of interest. This sounds really messy. How would you approach this (excluding an
implementation in C)?
Nikos