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

Nikos Alexandris nik at nikosalexandris.net
Mon Feb 26 07:03:23 PST 2018


* Markus Metz <markus.metz.giswork at gmail.com> [2018-02-26 14:38:08 +0100]:

>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

Maybe renaming to -n (in future versions) ?

Nikos

>> By the way, it should be: "In the following example..." and not "In the
>> example given above...".
>>
>> Nikos
>>
>>
>>> Markus M
>>>
>>>> thanks
>>>> Grazia

-- 
Nikos Alexandris | Remote Sensing & Geomatics
GPG Key Fingerprint 6F9D4506F3CA28380974D31A9053534B693C4FB3 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20180226/d7363cc9/attachment.sig>


More information about the grass-user mailing list