[GRASSLIST:6530] MASK confussion

Hi

Is it normal and intended that "0" is taken the same as the "null" when doing "r.mapcalc 'MASK=some_raster"? It took me over an hour to guess my there where holes in my MASK. Shouldn't "0" be treated as a regular, valid value for MASK?

Maciek

Maciek Sieczka wrote:

Is it normal and intended that "0" is taken the same as the "null" when
doing "r.mapcalc 'MASK=some_raster"?

Yes.

It took me over an hour to guess my there where holes in my MASK.
Shouldn't "0" be treated as a regular, valid value for MASK?

Masks used to be zero/non-zero before support for a distinguished NULL
value was added in 5.0. The existing behaviour maintains backwards
compatibility.

--
Glynn Clements <glynn@gclements.plus.com>

From: "Glynn Clements" <glynn@gclements.plus.com>

Maciek Sieczka wrote:

Is it normal and intended that "0" is taken the same as the "null" when
doing "r.mapcalc 'MASK=some_raster"?

Yes.

It took me over an hour to guess my there where holes in my MASK.
Shouldn't "0" be treated as a regular, valid value for MASK?

Masks used to be zero/non-zero before support for a distinguished NULL
value was added in 5.0. The existing behaviour maintains backwards
compatibility.

I see. But is backward compatibility so important here? IMHO all Grass oldtimers users got used to using NULL for no-data instead of ZERO, and newbies use NULL by default.

Also, all Grass commands I know use NULL for no-data. And if they support ZERO it is an option. Shouldn't MASK follow this?

Just my ideas.

Thanks
Maciek

>> Is it normal and intended that "0" is taken the same as the "null"
>> when doing "r.mapcalc 'MASK=some_raster"?
>
> Yes.
>
>> It took me over an hour to guess my there where holes in my MASK.
>> Shouldn't "0" be treated as a regular, valid value for MASK?
>
> Masks used to be zero/non-zero before support for a distinguished
> NULL value was added in 5.0. The existing behaviour maintains
> backwards compatibility.

I see. But is backward compatibility so important here? IMHO all Grass
oldtimers users got used to using NULL for no-data instead of ZERO,
and newbies use NULL by default.

It's a true/false thing. 0 is false.
It could be better documented, but where?

Also, all Grass commands I know use NULL for no-data.

A lot of the old raster modules still only have minimal floating point
support, let alone NULL support..

And if they support ZERO it is an option. Shouldn't MASK follow this?

nope. Where would you put the option? g.gisenv? I think it would lead to
many disasters.

Hamish