Re: [GRASS-user] map calculator in python loop

2018-12-13 Thread Alessandro Sebastiani
Hi Stefan and hi to everybody the original "g.list" command was >>> r_list = gscript.read_command("g.list" , type = "rast" ).strip().split() i forgot to put ("\n") as input parameter in the .split method. Howeever i wrote it while writing my script in this mail since i use it like 100 % of the tim

Re: [GRASS-user] map calculator in python loop

2018-12-13 Thread st_kiefer
Hi Alessandro, it would be great, if you also comunicate the actual solution, i.e. the proper "g.list"-command, or where you made the mistake. The mapcalc-call seems not to bee what caused the troubles. If someone runs into the same trouble as you, he would have the right hint immediately. rega

Re: [GRASS-user] map calculator in python loop

2018-12-13 Thread Alessandro Sebastiani
dear all, i found where the error was! i didn't set the "g.list" command properly, in fact the map calculator could not find maps . However , here it is how i ran the mapcalc: > gscript.mapcalc ( " %s = %s * %s " % ((r+"k") , r , c)) to Frank : k is just a suffix i wanted to use in order to give t

Re: [GRASS-user] map calculator in python loop

2018-12-12 Thread Frank David
Hi, What do you want to do with "k" ? Can you send what return gscript.verbose(( " %s = %s * %s ")  % (r , r , c)) Frank Le 12/12/2018 à 17:34, Alessandro Sebastiani a écrit : I get the same error after trying with your suggestion! I tried to define rasters in different ways, like >> c = ["co

Re: [GRASS-user] map calculator in python loop

2018-12-12 Thread Alessandro Sebastiani
I get the same error after trying with your suggestion! I tried to define rasters in different ways, like >> c = ["costante"] , but nothing seems to change Il giorno mer 12 dic 2018 alle ore 10:22 Moritz Lennert < mlenn...@club.worldonline.be> ha scritto: > On 12/12/18 12:59, Alessandro Sebastian

Re: [GRASS-user] map calculator in python loop

2018-12-12 Thread Moritz Lennert
On 12/12/18 12:59, Alessandro Sebastiani wrote: dear all, i'm dealing this time with r.mapcalc. I have different rasters which i grouped using g.list. Now r_list contains all my raster. I want to multiply those rasters to another raster (called "costante")  in order to obtain a new map, that i

Re: [GRASS-user] map calculator in python loop

2018-12-12 Thread st_kiefer
Hi Alessandro, actually, I have no experience and no idea of the scripting modul of grass. But I believe you need something like this: script.core.list_strings(type, pattern=None, mapset=None, exclude=None, flag='')[source] List of elements as strings. Returns the output from running

[GRASS-user] map calculator in python loop

2018-12-12 Thread Alessandro Sebastiani
dear all, i'm dealing this time with r.mapcalc. I have different rasters which i grouped using g.list. Now r_list contains all my raster. I want to multiply those rasters to another raster (called "costante") in order to obtain a new map, that i want to call as r followed by the letter "k" Here it