<div dir="ltr"><div><div><div><br><br>On Fri, Nov 17, 2017 at 1:40 PM, Ken Mankoff <<a href="mailto:mankoff@gmail.com">mankoff@gmail.com</a>> wrote:<br>><br>> Hi Markus,<br>><br>> 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.<br><br></div>OK, I understand now. With method=rmarea, r.reclass converts the raster clumps to vector areas. That single cell in your example below, that either belongs to the larger clump 1 (with -d) or forms a separate clump 2 (without -d) will always be a separate small vector area (topology or not does not matter here) and thus will always be removed independent of the 2-cell clump. The vector approach is thus not working here as expected.<br><br></div>Incidentally I have added a minsize option to r.clump in GRASS 7.4 which should work as expected. Try to use r.clump minsize=X (in number of cells) instead of r.reclass.area method=rmarea mode=lesser.<br><br></div>Markus M<br><br><div><div><div>><br>> 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.<br>><br>> # set up the environment<br>> grass72 -c EPSG:3413 ./Gclump<br>> g.region w=0 e=500 s=0 n=500 res=100 -p<br>> debug() { <a href="http://r.out.xyz">r.out.xyz</a> -i input=$@  | cut -d"|" -f3 | xargs -n5; }<br>><br>> r.mapcalc "foo = if(row() == 2 && ((col() > 1) && (col() < 4)) , 1, null())" --o<br>> r.mapcalc "foo = if(row() == 3 && col() == 4, 1, foo)" --o<br>> r.mapcalc "foo = if(row() == 4 && col() == 2, 2, foo)" --o<br>><br>> 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:<br>><br>> r.clump input=foo output=foo_c      # no diagonals<br>> r.clump -d input=foo output=foo_cd  # diagonal<br>><br>> debug foo<br>> debug foo_cd  # give the same result<br>> # * * * * *<br>> # * 1 1 * *<br>> # * * * 1 *<br>> # * 2 * * *<br>> # * * * * *<br>><br>> And as expected,<br>><br>> debug foo_c<br>> * * * * *<br>> * 1 1 * *<br>> * * * 2 *<br>> * 3 * * *<br>> * * * * *<br>><br>> On 2017-11-17 at 08:45, Markus Metz <<a href="mailto:markus.metz.giswork@gmail.com">markus.metz.giswork@gmail.com</a>> wrote:<br>> > On Mon, Nov 13, 2017 at 11:24 AM, Ken Mankoff <<a href="mailto:mankoff@gmail.com">mankoff@gmail.com</a>> wrote:<br>> >> Why does mode=rmarea appear to ignore the -d flag<br>> ><br>> > The -d flag only has an effect if clumps are created from the input.<br>> > If the -c flag is set, the input is already clumped and the -d flag<br>> > has no effect. This is (should be) independent of the mode.<br>><br>> 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?<br>><br>> And this should be the same behavior as if if I pass in foo (unclumped), no "-c" flag, and yes "-d" flag.<br>><br>> r.reclass.area -c input=foo_cd output=o value=1 mode=lesser method=rmarea --o --q && debug o<br>><br>> 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).<br>><br>> * * * * *<br>> * 1 1 * *<br>> * * * * *<br>> * * * * *<br>> * * * * *<br>><br>>   -k.<br><br></div></div></div></div>