So your suggestion would be<div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; color: rgb(80, 0, 80); ">rass.mapcalc("$L=$lmin+ (($lmax-$lmin)/($QCALmax-$QCALmin)) ($raster_file-$QCALmin)", L=tempL, lmin=lmin, lmax=lmax, QCALmax=QCALmax, QCALmin=QCALmin, raster_file=raster_file)</span></div>
<div><font class="Apple-style-span" color="#500050" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><br></span></font></div><div><font class="Apple-style-span" color="#500050" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">and at the end delete L file?</span></font></div>
<div><font class="Apple-style-span" color="#500050" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">Thanks</span></font></div><div><font class="Apple-style-span" color="#500050" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">Kim<br>
</span></font><br><div class="gmail_quote">2010/9/24 Glynn Clements <span dir="ltr"><<a href="mailto:glynn@gclements.plus.com">glynn@gclements.plus.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5"><br>
Kim Besson wrote:<br>
<br>
> I'm doing a Python script to calibrate a raster image. Since I need to do 3<br>
> different calculations I'm using a tempfile (tempL)<br>
><br>
> This is the code:<br>
><br>
> tempL = grass.read_command("g.tempfile", pid = "1")<br>
> grass.mapcalc("$L=$lmin+ (($lmax-$lmin)/($QCALmax-$QCALmin))*<br>
> ($raster_file-$QCALmin)", L=tempL, lmin=lmin, lmax=lmax, QCALmax=QCALmax,<br>
> QCALmin=QCALmin, raster_file=raster_file)<br>
><br>
> Where tempL is a temporary, (lmin,lmax) are floats, QCALmax and QCALmin are<br>
> int and raster_file is a raster map used as input.<br>
><br>
> And I get this:<br>
> syntax error, unexpected '/', expecting NAME or STRING<br>
> Parse error<br>
> ERROR: An error occurred while running r.mapcalc<br>
><br>
> What is happening? I believe it has something to do with tempL. Maybe I'm<br>
> not doing this right. Can anyone help me on this?<br>
<br>
</div></div>g.tempfile returns the full pathname to a temporary file, not a map<br>
name.<br>
<br>
There isn't a module to generate temporary map names. A common<br>
approach is to use the name of the script followed by ".tmp".<br>
<font color="#888888"><br>
--<br>
Glynn Clements <<a href="mailto:glynn@gclements.plus.com">glynn@gclements.plus.com</a>><br>
</font></blockquote></div><br></div>