[GRASS-user] How to initialize raster maps.
gorini at gmail.com
Thu Dec 8 18:42:28 EST 2011
:) how difficult, isn't it?
But there is no way to avoid r.mapcalc, is there?
On Thu, Dec 8, 2011 at 8:04 PM, Moritz Lennert <mlennert at club.worldonline.be
> On 08/12/11 22:26, Marcello Gorini wrote:
>> Dear all,
>> Inside a loop in a shell script, I keep incrementing the values of a
>> map using r.mapcalc with some logical expressions.
>> Therefore, I need to initialize the raster map before the loop itself.
>> Ideally, I would like to initialize it as a raster with the same
>> as my base map, but containing only zeros.
>> In order to do that, I use the following expression:
>> r.mapcalc "initialized_map=if(base_map>**999999,1,0)"
>> Besides being one of the ugliest pieces of code one could ever write, it
>> also incurs in waste of processing time.
>> Which would be a more elegant and optimized way of initializing these
>> Thanks in advance for any thoughts you could share.
> g.region rast=YourBaseMap
> r.mapcalc initialized_map=0
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the grass-user