[GRASS-user] making sense of r.reclass.area

Ken Mankoff mankoff at gmail.com
Fri Nov 17 04:40:31 PST 2017


Hi Markus,

Thanks for the reply. You're right that unclumped data was part of the problem, but even with that realization and more testing things still don't make sense. Specifically, the diagonal flag doesn't seem to work for rmarea for me, or I'm not understanding how it should work.

I've now clumped my input (and also test this telling r.reclass.area to clump the input by not using the "-c" flag). Text below appears OK in Gmail for me but is best viewed in fixed-width font.

# set up the environment
grass72 -c EPSG:3413 ./Gclump
g.region w=0 e=500 s=0 n=500 res=100 -p
debug() { r.out.xyz -i input=$@  | cut -d"|" -f3 | xargs -n5; }

r.mapcalc "foo = if(row() == 2 && ((col() > 1) && (col() < 4)) , 1, null())" --o
r.mapcalc "foo = if(row() == 3 && col() == 4, 1, foo)" --o
r.mapcalc "foo = if(row() == 4 && col() == 2, 2, foo)" --o

I think I've "clumped" the above, with diagonals, by assigning the 3 cells a value of 1 and the single cell a value of 2. Just to be sure, I'm manually running r.clump 2x:

r.clump input=foo output=foo_c      # no diagonals
r.clump -d input=foo output=foo_cd  # diagonal

debug foo
debug foo_cd  # give the same result
# * * * * *
# * 1 1 * *
# * * * 1 *
# * 2 * * *
# * * * * *

And as expected,

debug foo_c
* * * * *
* 1 1 * *
* * * 2 *
* 3 * * *
* * * * *

On 2017-11-17 at 08:45, Markus Metz <markus.metz.giswork at gmail.com> wrote:
> On Mon, Nov 13, 2017 at 11:24 AM, Ken Mankoff <mankoff at gmail.com> wrote:
>> Why does mode=rmarea appear to ignore the -d flag
>
> The -d flag only has an effect if clumps are created from the input.
> If the -c flag is set, the input is already clumped and the -d flag
> has no effect. This is (should be) independent of the mode.

OK. So r.reclass.area with foo_cd (diagonal clumped) and the -c flag should remove the small single cell, and retain the 3 cells with 1 diagonal, right?

And this should be the same behavior as if if I pass in foo (unclumped), no "-c" flag, and yes "-d" flag. 

r.reclass.area -c input=foo_cd output=o value=1 mode=lesser method=rmarea --o --q && debug o

Everything I run here produces the same result, regardless of which of the three foo* rasters I pass in, or any of the three flag options (NONE, -c, or -d).

* * * * *
* 1 1 * *
* * * * *
* * * * *
* * * * *

  -k.


More information about the grass-user mailing list