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

Markus Metz markus.metz.giswork at gmail.com
Mon Feb 26 05:38:08 PST 2018


On Mon, Feb 26, 2018 at 1:31 PM, Nikos Alexandris <nik at nikosalexandris.net>
wrote:
>
> * 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.
>
>
> What about the -z flag, though?
>
> 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.

The -z flag does not behave as explained in the manual. It comes from the
old days when there was no NULL encoding in GRASS, and zero was used as
nodata. Now the -z flag means that with the -z flag, NULL values are not
crossed, not that zero data are not crossed. This has been introduced in
2013 with r55276. The results of r.cross without the -z flag might look
strange if any of the input maps contains NULL cells.

Markus M
>
> 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/ed3850bb/attachment.html>


More information about the grass-user mailing list