[GRASS5] [bug #912] (grass) probably r.mapcalc bug

this bug's URL: http://intevation.de/rt/webrt?serial_num=912
-------------------------------------------------------------------------

Subject: probably r.mapcalc bug

grass downloaded at: CVS Server, Germany
grass sources source: yes, I am using the latest GRASS from CVS

Hi,

eventually we have found a bug in r.mapcalc. At least it is somewhat
inconvenient...

GRASS 5.0.0pre3 > r.mapcalc 'tmp5=if(pascolo.albmug.00 >0,1,0)'
EXECUTING tmp5 = ... 100%
CREATING SUPPORT FILES FOR tmp5

-> no result

GRASS 5.0.0pre3 > r.mapcalc 'tmp5=if(pascolo.albmug.00 >0.,1,0)'
EXECUTING tmp5 = ... 100%
CREATING SUPPORT FILES FOR tmp5

-> no result

GRASS 5.0.0pre3 > r.mapcalc 'tmp5=if(pascolo.albmug.00 >1,1,0)'
EXECUTING tmp5 = ... 100%
CREATING SUPPORT FILES FOR tmp5
range: 1 1

-> result

The map contains:

r.info pascolo.albmug.00
| Type of Map: raster Number of Categories: 255
| Data Type: FCELL
| Range of data: min = 0.000000 max = 150.000000
| Data Description:
|
| generated by r.recode

r.stats -c pascolo.albmug.00
r.stats: 100%
0-0.588235 32065
0.588235-1.176471 3208
1.176471-1.764706 1266
[...]
94.117647-94.705882 207
99.411765-100 374
149.411765-150 157
* 1044154

Actually I don't understand the behaviour of r.mapcalc in the first case.

Generally, it seems that,
- there is something strange with if-conditions (see above)
- r.mapcalc *silently* does not operate on NULL values (there should be
   a warning)
- does not print a message about the file type (INT,FCELL) when doing
   a calculation (e.g. when dividing two INT maps, the result is INT.
   but many users may not realize this and don't know that they have to
   multiply with 1.0 to receive a FCELL)

Regards

Markus

-------------------------------------------- Managed by Request Tracker