[GRASS-user] v.mapcalc

Micha Silver tsvibar at gmail.com
Sun Mar 14 13:23:24 PDT 2021


On 3/14/21 11:07 AM, Enrico Gabrielli bonushenricus wrote:
> Hi
> How are you?
> After solving thanks to Stefan and his r.slope.direction how to
> calculate the slope along the keyline, now I have to solve how to
> create parallels to the keyline. Nothing easier: see parallel! But I
> have to create many. In the graphical modeler I can't learn how to use
> the loop. Damn if I'm ignorant. But maybe v.mapcalc would also be very
> handy. But it doesn't work for me. After installing ply it doesn't work
> anyway.


Can you add some further information:

What is your operating system?

What version of GRASS?

When you say "I have to create many", do you mean many parallel lines at 
different distances?

Are you working with projected data? (I missed the previous thread on 
r.slope.direction, sorry if this has been mentioned before)

What scripting language do you prefer? python? bash shell script?

If python, what version is installed? (note that GRASS 7.8 has switched 
to python 3)

What is "keyline"? (i.e. please show the output from `v.info keyline`



>> Traceback (most recent call last):
>>    File "/usr/lib/grass76/scripts/v.mapcalc", line 429, in
>> <module>
>>      sys.exit(main())
>>    File "/usr/lib/grass76/scripts/v.mapcalc", line 415, in
>> main
>>      p.parse(expression)
>>    File "/usr/lib/grass76/scripts/v.mapcalc", line 191, in
>> parse
>>      self.parser.parse(expression)
>>    File "/usr/lib/python2.7/dist-packages/ply/yacc.py", line
>> 333, in parse
>>      return self.parseopt_notrack(input, lexer, debug,
>> tracking, tokenfunc)
>>    File "/usr/lib/python2.7/dist-packages/ply/yacc.py", line
>> 1063, in parseopt_notrack
>>      lookahead = get_token()     # Get the next token
>>    File "/usr/lib/python2.7/dist-packages/ply/lex.py", line
>> 393, in token
>>      newtok = self.lexerrorf(tok)
>>    File "/usr/lib/grass76/scripts/v.mapcalc", line 146, in
>> t_error
>>      (t.lineno, t.value))
>> SyntaxError: syntax error on line 1 near
>> ''buff_l(keyline at PERMANENT,5)''
> I used all possible quotes in the expression, but the result is always
> the same
>
> I don't want to use qgis (where there would be offset) because
> r.slope.direction is in grass and it is very convenient, and also all
> the rasters I use have them in grass. I would like to learn how to do
> everything in GRASS.
> Well, who knows if I'll succeed. As soon as I have some pennies I pay a
> friend of mine who is a python developer: maybe it's better.
>
> Thanks

-- 
Micha Silver
Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
cell: +972-523-665918



More information about the grass-user mailing list