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 <[email protected]>
_______________________________________________
grass-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-user