[GRASS-user] How to initialize raster maps.
Marcello Gorini
gorini at gmail.com
Thu Dec 8 18:42:28 EST 2011
:) how difficult, isn't it?
Thanks!
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
> wrote:
> 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
>> raster
>> 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
>> dimensions
>> 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
>> raster
>> maps?
>>
>> Thanks in advance for any thoughts you could share.
>>
>
> g.region rast=YourBaseMap
> r.mapcalc initialized_map=0
>
> Moritz
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-user/attachments/20111208/776cb6e7/attachment.html
More information about the grass-user
mailing list