<div dir="ltr"><div dir="ltr"><div>Hi Stefan and hi to everybody<br></div>the original "g.list" command was <br>>>> r_list = gscript.read_command("g.list" , type = "rast" ).strip().split()<br></div><div>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 time. In this way the mapcalc couldn't find maps since my iteration variable was not the raster itself but every single letter composing its name. Next time i'll be using copy&paste to avoid silly mistakes <br></div><div>regards<br></div><div>A. <br></div></div><br><div class="gmail_quote"><div dir="ltr">Il giorno gio 13 dic 2018 alle ore 04:26 <<a href="mailto:st_kiefer@web.de">st_kiefer@web.de</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Alessandro,<br>
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.<br>
<br>
regards<br>
<br>
Stefan<br>
<br>
> Alessandro Sebastiani <<a href="mailto:alessandro.sebastiani@uniroma1.it" target="_blank">alessandro.sebastiani@uniroma1.it</a>> hat am 13. Dezember 2018 um 09:15 geschrieben:<br>
> <br>
> <br>
> dear all,<br>
> i found where the error was! i didn't set the "g.list" command properly, in<br>
> fact the map calculator could not find maps . However , here it is how i<br>
> ran the mapcalc:<br>
> > gscript.mapcalc ( " %s = %s * %s " % ((r+"k") , r , c))<br>
> to Frank : k is just a suffix i wanted to use in order to give to the new<br>
> map a name similar to the older map (r in this case)<br>
> <br>
> Il giorno mer 12 dic 2018 alle ore 13:01 Frank David <<a href="mailto:frank.david@geophom.fr" target="_blank">frank.david@geophom.fr</a>><br>
> ha scritto:<br>
> <br>
> > Hi,<br>
> ><br>
> > What do you want to do with "k" ?<br>
> ><br>
> > Can you send what return gscript.verbose(( " %s = %s * %s ") % (r , r ,<br>
> > c))<br>
> ><br>
> > Frank<br>
> > Le 12/12/2018 à 17:34, Alessandro Sebastiani a écrit :<br>
> > > I get the same error after trying with your suggestion! I tried to<br>
> > > define rasters in different ways, like<br>
> > > >> c = ["costante"] ,<br>
> > > but nothing seems to change<br>
> > ><br>
> > > Il giorno mer 12 dic 2018 alle ore 10:22 Moritz Lennert<br>
> > > <<a href="mailto:mlennert@club.worldonline.be" target="_blank">mlennert@club.worldonline.be</a> <mailto:<a href="mailto:mlennert@club.worldonline.be" target="_blank">mlennert@club.worldonline.be</a>>><br>
> > > ha scritto:<br>
> > ><br>
> > > On 12/12/18 12:59, Alessandro Sebastiani wrote:<br>
> > > > dear all,<br>
> > > > i'm dealing this time with r.mapcalc. I have different rasters<br>
> > > which i<br>
> > > > grouped using g.list.<br>
> > > > Now r_list contains all my raster. I want to multiply those<br>
> > > rasters to<br>
> > > > another raster (called "costante") in order to obtain a new<br>
> > > map, that i<br>
> > > > want to call as r followed by the letter "k"<br>
> > > > Here it is what i've done:<br>
> > > > import grass.script as gscript<br>
> > > > >>> r_list = gscript.read_command("g.list" , type = "rast"<br>
> > > > ).strip().split("\n")<br>
> > > > >>> c = " costante"<br>
> > > > >>> for r in r_list:<br>
> > > > >>> gscript.mapcalc ( " %s = %s * %s " % ((r+"k") , r , c))<br>
> > ><br>
> > > Try<br>
> > ><br>
> > > " %sk = %s * %s " % (r , r , c) "<br>
> > ><br>
> > > Moritz<br>
> > ><br>
> > ><br>
> > > _______________________________________________<br>
> > > grass-user mailing list<br>
> > > <a href="mailto:grass-user@lists.osgeo.org" target="_blank">grass-user@lists.osgeo.org</a><br>
> > > <a href="https://lists.osgeo.org/mailman/listinfo/grass-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/grass-user</a><br>
> > _______________________________________________<br>
> > grass-user mailing list<br>
> > <a href="mailto:grass-user@lists.osgeo.org" target="_blank">grass-user@lists.osgeo.org</a><br>
> > <a href="https://lists.osgeo.org/mailman/listinfo/grass-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/grass-user</a><br>
> _______________________________________________<br>
> grass-user mailing list<br>
> <a href="mailto:grass-user@lists.osgeo.org" target="_blank">grass-user@lists.osgeo.org</a><br>
> <a href="https://lists.osgeo.org/mailman/listinfo/grass-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/grass-user</a><br>
_______________________________________________<br>
grass-user mailing list<br>
<a href="mailto:grass-user@lists.osgeo.org" target="_blank">grass-user@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/grass-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/grass-user</a></blockquote></div>