[GRASS-user] r.category value range

Moritz Lennert mlennert at club.worldonline.be
Wed Feb 4 06:51:47 PST 2015


On 04/02/15 15:45, Moritz Lennert wrote:
> On 04/02/15 15:23, Markus Metz wrote:
>> On Wed, Feb 4, 2015 at 1:14 PM, Moritz Lennert
>> <mlennert at club.worldonline.be> wrote:
>>> On 04/02/15 11:48, Martin Album Ytre-Eide wrote:
>>>>
>>>> Hello!
>>>>
>>>> I trying to set a label  for a range of values in  a raster.
>>>>
>>>> I am using r.category (grass 7.0)
>>>>
>>>> "r.category map=lwc_2014 separator=':' rules=lwc.rules"
>>>>
>>>> My lwc.rules looks like this:
>>>>
>>>> 0:30:0.9
>>>> 31:90:0.7
>>>> 91:252:0.5
>>>>
>>>> so, r.category does not seem to read my range, but in stead gives me
>>>> labels for value 31 (label=90:0.7) and value 91 (label=252:0.5)
>>>>
>>>> Any clues to what I am doing wrong ? or is r.category not working as
>>>> intended?
>>>
>>>
>>> You should use r.recode, not r.category.
>>
>> According to the manual, r.category should work with these rules.
>
> You're right. Sorry, I wrote to fast.
>
> Actually the manual also says concerning the example: "The format is
> given as follows (when separator is set to colon)". So, AFAIU, you have
> to set the separator parameter to whatever separator you use in the rules.
>

Sorry, I really should take the time before I write. I can reproduce the 
issue actually:


g.copy raster=geology_30m,mygeol
r.category mygeol rules=- separator=':' <<EOF
217:270:1
405:862:2
910:948:3
EOF
r.category mygeol
217	270:1
262	
270	
405	862:2
583	
720	
766	
862	
910	948:3
921	
945	
946	
948

So, yes, there seems to be a bug in r.category. Please file a ticket.

Moritz


More information about the grass-user mailing list