[GRASS-user] I can not get expected value with r.mapcalc

Hi

What is wrong in following expression? . I was expecting to get 51 as value.But only value is 0.

r.mapcalc “pr2.pass00 = if ( MASK,curvt_cat == 1 && curvp_cat == 3 && asp_cat == 3 && slp_cat == 1 && jeo == 6 ,51, null() )” --overwrite

regards

···

Ahmet Temiz
Jeoloji Müh.
Afet ve Acil Durum Yönetimi Başkanlığı
Bilgi İşlem Dairesi Başkanlığı-CBS Grubu


Ahmet Temiz
Geological Eng.
Information Systems - GIS Group
Disaster and Emergency Management
of Presidency

My understanding of the format for the if() operator with 4 parameters is
that the result is the third parameter only when the first parameter equals
zero. The GRASS MASK in your expression probably has only values of 1 and
null, so the result will always be either parameter 1, or null.

In addtion, r.mapcalc would honor the MASK anyway, so it's not necessary to
include it in the expression.
Looking at your expression, the second parameter gives a boolean result, so
maybe the following might give you what you want:
(Also watch out map names with a dot '.')

r.mapcalc "pr2_pass00 = if (curvt_cat == 1 && curvp_cat == 3 && asp_cat ==
3 && slp_cat == 1 && jeo == 6 ,51, null() )" --overwrite

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/I-can-not-get-expected-value-with-r-mapcalc-tp5290749p5290795.html
Sent from the Grass - Users mailing list archive at Nabble.com.