[GRASS-user] Re: r.mapcalc: Syntax Error?

Hermann Peifer peifer at gmx.eu
Thu Apr 5 09:59:43 EDT 2012


On 05/04/2012 14:27, Rich Shepard wrote:
> On Thu, 5 Apr 2012, Hermann Peifer wrote:
>
>>> GRASS 6.5.svn (Washington-Kinross):~/grassdata > r.mapcalc "weight =
>>> if(tan_curv_5.lm < 0, -100 * tan_curv_5.lm, \
>>> if(tan_curv_7.lm < 0, -100 * tan_curv_7.lm, \
>>> if(tan_curv_11.lm < 0, -100 * tan_curv_11.lm, 0.000001)))"
>>> syntax error, unexpected ';'
>>> Parse error
>>> [Raster MASK present]
>>>
>>> Since there is no semi-colon in the command, what is grass trying to
>>> tell
>>> me?
>
>> Perhaps that a '\' is missing after the equal sign? Hermann
>
> Hermann,
>
> On the command line there is no \n; that's the way the text wrapped in the
> MUA. But, I'll try it again and see if it does wrap and I'm missing that it
> does.
>

You could also try an alternative (ternary) notation:
"weight = tan_curv_5.lm < 0 ? -100 * tan_curv_5.lm : tan_curv_7.lm < 0 ? 
-100 * tan_curv_7.lm : tan_curv_11.lm < 0 ? -100 * tan_curv_11.lm : 
0.000001"

Hermann


More information about the grass-user mailing list