[GRASS-user] Re: r.recode does not recognise fourth routine

[Please keep threads on the mailing list]

On 29/04/09 20:42, A. Márcia BARBOSA wrote:

Thanks Moritz,

Actually the r.reclass manual says it reclassifies "categories", I
hadn't really noticed or associated it with integer values.

Well, I think that this should be made clearer.

Now I've done it with r.recode, but it doesn't quite get all the
rules. Following the manual, I first used:

*:0.2:1
0.2:0.8:2
0.8:*:3

But it complains that "0.8:*: is not a valid rule" and doesn't do the
third category (values above 0.8 become null).

Weird. This should work. Are you sure that this was the exact rule you used and that this is the exact error message ?

Which version of GRASS are you using ?

Any idea why the first option didn't work?

No. If you can reproduce this with any of the demo data, this could help debugging.

Moritz

On 29/04/09 20:42, A. Márcia BARBOSA wrote:

Thanks Moritz,

Actually the r.reclass manual says it reclassifies "categories", I
hadn't really noticed or associated it with integer values.

Well, I think that this should be made clearer.

I added some notes about the requirement for integer input maps in the NOTES section
of the manual; updated in trunk, devbr6, and grass64_relbr (r36919 to r36921).

~ Eric.

[could you please keep this thread on the mailing list and not send mails only to me privately]

On 30/04/09 12:42, A. Márcia BARBOSA wrote:

Weird. This should work. Are you sure that this was the exact rule you used
and that this is the exact error message ?

Yes, I just copied and pasted them, and it happened again a few times
with my data.

Which version of GRASS are you using ?

I'm using the GRASS plugin in QGIS 1.0.1 Kore (Windows XP).

If you can reproduce this with any of the demo data, this could help
debugging.

I tried it with the South-Dakota data:
r.recode input=elevation.dem@PERMANENT rules="C:/rcl.txt" output=elevation123

My rules file said:
*:1200:1
1200:1700:2
1700:*:3

GRASS's reply:
'1700:*:' is not a valid rule

I cannot confirm this neither in GRASS directly, not in QGIS on Debian GNU/Linux.

Maybe be an issue with the windows version, although I don't really understand how this would happen...

Please post a bug on the tracker (http://trac.osgeo.org/grass/) and we'll see if someone with windows can reproduce.

Moritz

[sorry if I didn't properly reply to the list last times, it was accidental]

Actually, searching through the bug list I found the reason: "#172:
r.recode truncates last character in rules file". As I was recoding
the rasters to one-digit values, the last value was read as nothing,
hence the '1700:*:' is not a valid rule.

It works when I add an extra digit to the last value in the rules file
(which is not read), as suggested in the bug ticket. And apparently
this is only necessary when getting the rules from a file rather than
typing them in the command line, although I couldn't quite find out
how to type the rules in the command line... or rather how to say I've
typed the last rule already.

Cheers,
Márcia