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

Ken Mankoff mankoff at gmail.com
Mon Nov 13 02:24:44 PST 2017


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? 

Why is -c and -d mutually exclusive for "mode=reclass" but not "mode=rmarea"?

Why does mode=rmarea appear to ignore the -d flag

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?

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


More information about the grass-user mailing list