Dear GRASS developers,
I have two maps: 'landuse' (CELL) and 'slope' (FCELL), and I need to average
'slope' for every category in 'landuse'. Seems like r.average would do it, so
I do:
GRASS:~ > r.average base=landuse cover=slope output=landuse.slope
But:
1) r.average help says:
"The output map is actually a reclass of the base map (see r.reclass), and
will have exactly the same category values as the base map. The averaged
values computed by r.average are stored in the output map's category labels
file."
But this is not what I see from r.info, r.report, r.cats! For example:
GRASS:~ > r.report landuse.slope
...
|----------------------------------------------------------------------------|
| Category Information |
| #|description |
|----------------------------------------------------------------------------|
| 0.2-0.266667|from to |
| 0.466667-0.533333|from to |
| 0.533333-0.6|from to |
| 0.6-0.666667|from to |
| 0.666667-0.733333|from to |
...
This looks totally different from what help promices:
- averaged values were put in category values, not labels
- category labels are meaningless
From this I see no way to determine the relationship I need, i.e. something
like:
landuse category 1 --> average slope
...
landuse category N --> average slope
Note that the average slope values need to be actual, not classified, like
r.report gives...
How do I go about it?
Also:
2) r.statistics is designed to do the same as r.average, r.mode, r.median,
etc. Why not deprecate r.average & others in favor of r.statistics? This
would reduce the number of modules, and I think that GRASS really needs this.
The long list of raster modules is confusing, especially given that too many
of them either duplicate each other, or don't work the way they are supposed
to (according to help). Well, you can see I've had a tough day with GRASS
today
Is r.statistics supported though? I tried using it for the problem above, it
complained that r.stats doesn't accept <z> flag. Changed line 29 of
src/raster/r.statistics/cmd/o_average.c
from
sprintf (command, "%s -az input='%s,%s' fs=space > %s", ...
to:
sprintf (command, "%s -an input='%s,%s' fs=space > %s", ...
Now I can run it:
GRASS:~ > r.statistics base=landuse cover=slope method=average
output=landuse.slope1
but the output map 'landuse.slope1' is totally wrong. r.report says that all
it's cells are null, and r.info seems to get stuck in a loop and needs Ctrl-C.
Thanks,
Aleksey