[GRASS-user] Question regarding grass.mapcalc
Glynn Clements
glynn at gclements.plus.com
Fri Sep 24 14:12:28 EDT 2010
Kim Besson wrote:
> So your suggestion would be
> 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)
>
> and at the end delete L file?
My suggestion would be to replace:
tempL = grass.read_command("g.tempfile", pid = "1")
with:
tempL = myscript.tmp
Any temporary maps should be deleted upon termination. Use
atexit.register() to register a function which deletes any temporary
maps (if they exist). This will ensure that the maps get deleted
regardless of whether the script terminates normally or due to an
exception. Look at the scripts in 7.0 for examples.
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-user
mailing list