Re: making sense of r.reclass.area

Markus Metz <[email protected]>
Newsgroups gmane.comp.gis.grass.user
Message-ID <CAG+h=FFmuvpsPC84wEHrc5O=G09xTR2deV6rrbx5gRtviTVdRg@mail.gmail.com>
On Mon, Nov 13, 2017 at 11:24 AM, Ken Mankoff <[email protected]> wrote:
>
> Dear GRASS list,
>
> I'm having trouble understanding how to properly use ~r.reclass.area~. It
seems to give inconsistent results. I'm using the following MWE to help me
figure this out.
>
> Several questions... such as:
>
> Why are the units in hectare instead of m^2?

Most probably for historical reasons (the module comes from GRASS 4).
>
> Why is -c and -d mutually exclusive for "mode=reclass" but not
"mode=rmarea"?

A bug. They should always be mutually exclusive: either input is already
clumped (-c flag), or clumps will be created from the input, considering
diagonal neighbours (-d flag).
>
> 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.

>
> Why does mode=reclass say it cannot find areas <=1 ha, but only if -c is
used, and the module never seems to have trouble finding areas of 1 ha
otherwise?

Maybe because the input is not clumped?

HTH,

Markus M
>
> Thanks,
>
>   -k.
>
>
> grass72 -c EPSG:3413 ./Gclump.debug
> # frink "1 hectare -> m^2" 10,000 m^2
> 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, 1, foo)" --o
>
> debug foo
> # * * * * *
> # * 1 1 * *
> # * * * 1 *
> # * 1 * * *
> # * * * * *
>
> # RMAREA
>
> # simple run with no args
> r.reclass.area input=foo output=o value=1 mode=lesser method=rmarea --o
--q && debug o
> r.reclass.area -c input=foo output=o value=1 mode=lesser method=rmarea
--o --q && debug o
> # WANT: include diagonal
> r.reclass.area -d input=foo output=o value=1 mode=lesser method=rmarea
--o --q && debug o
> r.reclass.area -d -c input=foo output=o value=1 mode=lesser method=rmarea
--o --q && debug o
>
> # All produce the same output:
> # * * * * *
> # * 1 1 * *
> # * * * * *
> # * * * * *
> # * * * * *
>
> # RECLASS
>
> r.reclass.area input=foo output=o value=1 mode=lesser method=reclass --o
--q && debug o
> # GOOD: flags areas <=1. Does not consider diagonal:
> # * * * * *
> # * * * * *
> # * * * 1 *
> # * 1 * * *
> # * * * * *
>
> r.reclass.area -c input=foo output=o value=1 mode=lesser method=reclass
--o --q && debug o
> # ERROR: "No areas <= 1.000 hectar
>
> r.reclass.area -d input=foo output=o value=1 mode=lesser method=reclass
--o --q && debug o
> # Appears to work, only areas <=1 flagged, including diagonal
> # * * * * *
> # * * * * *
> # * * * * *
> # * 1 * * *
> # * * * * *
>
> r.reclass.area -c -d input=foo output=o value=1 mode=lesser
method=reclass --o --q && debug o
> # ERROR: flags c and d are mutually exclusive
>
> exit
> rm -fR  Gclump.debug
> _______________________________________________
> grass-user mailing list
> [email protected]
> https://lists.osgeo.org/mailman/listinfo/grass-user

_______________________________________________
grass-user mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/grass-user
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.