I have a Python script with the following:
# Conversion to at-sensor brightness temperature grass.mapcalc("$raster_file= $K2/log(($K1/$L)+1)", raster_file=raster_file, K2=K2, K1=K1,L= tempL)
grass.mapcalc("$raster_file= if($raster_file < 0, null(), $raster_file)", raster_file=raster_file)
When it runs the second grass.mapcalc I get the following error:
ERROR: Unable to close raster map
ERROR: An error occurred while running r.mapcalc
Why am I obtaining this error? and How can I avoid it?
Thanks
Antonio
__________ Information from ESET NOD32 Antivirus, version of virus signature database 5563 (20101026) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com
António Rocha wrote:
I have a Python script with the following:
# Conversion to at-sensor brightness temperature
grass.mapcalc("$raster_file= $K2/log(($K1/$L)+1)", raster_file=raster_file, K2=K2, K1=K1,L= tempL)
grass.mapcalc("$raster_file= if($raster_file < 0, null(), $raster_file)", raster_file=raster_file)
When it runs the second grass.mapcalc I get the following error:
ERROR: Unable to close raster map
ERROR: An error occurred while running r.mapcalc
Why am I obtaining this error? and How can I avoid it?
Because you're using the same map as both input and output, which
won't work. Either use a temporary name for the intermediate map, or
replace the second grass.mapcalc call with r.null, e.g.:
grass.run_command('r.null', setnull = '-2147483647--1')
--
Glynn Clements <glynn@gclements.plus.com>