2008/8/23 José María Michia <[EMAIL PROTECTED]>: >> Is it possible to define variables?
2008/8/23 Glynn Clements <[EMAIL PROTECTED]>: > Yes; an assignment anywhere other than at the top level will define a > variable rather than an output map. You can either place the > assignment at the point that you would first use the value, e.g.: > > outmap = a * (pi = 3.14159265358979323846) + b > > or use eval(), e.g.: > > outmap = eval(pi = 3.14159265358979323846, a * pi + b) Thank you, Glynn. I was able to assign the variable. > Variables remain in scope until the end of the file. I do not know if I understood well about the scope of the variable. If I need to use the variable in several maps, only works if Pi is defined in each operation. For example: This works: r.mapcalc '= eval (pi = 3.14159265, pi + sin (map / pi))' r.mapcalc 'b = eval (pi = 3.14159265, pi + cos (map / pi))' But this does not: r.mapcalc '= eval (pi = 3.14159265, pi + sin (map / pi))' r.mapcalc 'b = eval (pi + cos (map / pi))' Just out of curiosity: I searched on Google and documentation GRASS how to do this, and could not find it. Does anyone know where it is documented that? Thanks again! José María PS: In response to messages from Glynn I forgot to use the address of the group, so we forwarded those messages here. Sorry! _______________________________________________ grass-user mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/grass-user
