[GRASS-user] Question regarding grass.mapcalc
kimbesson1981 at gmail.com
Fri Sep 24 12:11:25 EDT 2010
So your suggestion would be
(($lmax-$lmin)/($QCALmax-$QCALmin)) ($raster_file-$QCALmin)", L=tempL,
lmin=lmin, lmax=lmax, QCALmax=QCALmax, QCALmin=QCALmin,
and at the end delete L file?
2010/9/24 Glynn Clements <glynn at gclements.plus.com>
> Kim Besson wrote:
> > I'm doing a Python script to calibrate a raster image. Since I need to do
> > different calculations I'm using a tempfile (tempL)
> > This is the code:
> > tempL = grass.read_command("g.tempfile", pid = "1")
> > grass.mapcalc("$L=$lmin+ (($lmax-$lmin)/($QCALmax-$QCALmin))*
> > ($raster_file-$QCALmin)", L=tempL, lmin=lmin, lmax=lmax, QCALmax=QCALmax,
> > QCALmin=QCALmin, raster_file=raster_file)
> > Where tempL is a temporary, (lmin,lmax) are floats, QCALmax and QCALmin
> > int and raster_file is a raster map used as input.
> > And I get this:
> > syntax error, unexpected '/', expecting NAME or STRING
> > Parse error
> > ERROR: An error occurred while running r.mapcalc
> > What is happening? I believe it has something to do with tempL. Maybe I'm
> > not doing this right. Can anyone help me on this?
> g.tempfile returns the full pathname to a temporary file, not a map
> There isn't a module to generate temporary map names. A common
> approach is to use the name of the script followed by ".tmp".
> Glynn Clements <glynn at gclements.plus.com>
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the grass-user