[GRASS-user] r.cross doesn't work correctly.

Gra graziaz at gmail.com
Mon Feb 26 05:13:55 PST 2018


Hi
I tried also the -z flag.

I attach the result and the two inputs


Thanks

Grazia


2018-02-26 13:31 GMT+01:00 Nikos Alexandris <nik at nikosalexandris.net>:

> * Markus Metz <markus.metz.giswork at gmail.com> [2018-02-26 13:01:35 +0100]:
>
> On Mon, Feb 26, 2018 at 11:19 AM, Gra <graziaz at gmail.com> wrote:
>>
>>>
>>> Dear community
>>>
>>> I use r.cross to combine and then reclassify a set of indicators.
>>>
>>> I realised that r.cross doesn't work correctly.
>>>
>>> I have two inputs maps with values from 1 to 3 each.
>>>
>>>
>>> the problem is that r.category doesn't list the first combination (eg 1
>>>
>> to 1)
>>
>>>
>>> eg
>>> r.category map=myinput at in_data
>>>
>>
>> 0
>>> 1 category 1; category 2
>>> 2 category 1; category 3
>>> 3 category 2; category 1
>>> 4 category 2; category 2
>>> 5 category 2; category 3
>>> 6 category 3; category 1
>>> 7 category 3; category 2
>>> 8 category 3; category 3
>>>
>>> in reality the first combination exists (0 is empty but  I should have
>>>
>> there category 1; category 1)
>>
>>> the problem is that I have to iterate on 700 cases and I wont check and
>>>
>> correct manually.
>>
>>>
>>> could  you fix it?
>>>
>>
>> Please try trunk r72281
>>
>
> Works for me, thank you.
>
> I get now (compared to what I've posted in the other post):
>
> 0       CZfg; category 1
> 1       CZfg; category 2
> 2       CZbg; category 1
> 3       CZbg; category 2
> 4       CZg; category 1
>
> What about the -z flag, though?
>
> r.category geology_Test
> 217     CZfg
> 405     CZbg
> 766     CZg
>
> r.category basins_0_12
> 0       0
> 12      Twelve
>
> r.cross input=geology_Test,basins_0_12 out=cross_Test_6
> r.cross input=geology_Test,basins_0_12 out=cross_Test_7 -z
>
> r.category cross_Test_6
> 0       CZfg; 0
> 1       CZfg; Twelve
> 2       CZbg; 0
> 3       CZbg; Twelve
> 4       CZg; 0
>
> and
>
> r.category cross_Test_7
> 0       CZfg; 0
> 1       CZfg; Twelve
> 2       CZbg; 0
> 3       CZbg; Twelve
> 4       CZg; 0
>
>
> The manual reads:
>
> With the -z flag zero data values are not crossed. This means that if a
> zero category value occurs in any input data layer, the combination is
> assigned to category zero in the resulting map layer, even if other data
> layers contain non-zero data. In the example given above, use of the -z
> option would cause 3 categories to be generated instead of 5.
>
> By the way, it should be: "In the following example..." and not "In the
> example given above...".
>
> Nikos
>
>
> Markus M
>>
>> thanks
>>> Grazia
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20180226/f20abe69/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: result.pack
Type: application/x-java-pack200
Size: 101078 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20180226/f20abe69/attachment-0003.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: os.pack
Type: application/x-java-pack200
Size: 66899 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20180226/f20abe69/attachment-0004.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RPnr.pack
Type: application/x-java-pack200
Size: 80671 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20180226/f20abe69/attachment-0005.bin>


More information about the grass-user mailing list