[GRASS-dev] formatting expressions for r.mapcalc in GRASS6.4.3
Anna Kratochvílová
kratochanna at gmail.com
Fri Mar 15 10:58:00 PDT 2013
On Fri, Mar 15, 2013 at 6:17 PM, Glynn Clements
<glynn at gclements.plus.com> wrote:
>
> Helmut Kudrnovsky wrote:
>
>> - working:
>>
>> r.mapcalc
>> ndvi3=float(lsat7_2002_40-lsat7_2002_30)/float(lsat7_2002_40+lsat7_2002_30)
>> (Fri Feb 15 16:23:42 2013) Command finished (0 sec)
>>
>> r.mapcalc urban1_30m=if(landuse96_28m==1,1,0)+if(landuse96_28m==2,2,0)
>> (Fri Feb 15 16:24:24 2013) Command finished (0 sec)
>>
>> - not working (as Anna mentioned caused by ||):
>>
>> r.mapcalc urban2_30m=if(landuse96_28m==1 ||
>> landuse96_28m==2,landuse96_28m,null()
>> r.mapcalc MASK=if((elevation<100 && elevation>60) && (landuse96_28m==1 ||
>> landuse96_28m==2),1,null())
>
> Why do you think that the problem is caused by || rather than the
> spaces?
I've noticed it multiple times that pipe character is causing
problems. For example, running command
v.db.select map=... vs=|
from auto-generated dialog is giving error (something like bad syntax)
on Windows. In most cases you don't have any problems because you
don't explicitly use the option fs/separator (usually we use default)
in the command.
Anna
>
> --
> Glynn Clements <glynn at gclements.plus.com>
> _______________________________________________
> grass-dev mailing list
> grass-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-dev
More information about the grass-dev
mailing list