[GRASSLIST:26] Re: r.mapcalc limited number of input maps?

Otto Dassau dassau at gdf-hannover.de
Sun Mar 12 08:18:51 EST 2006


On Sun, 12 Mar 2006, Glynn Clements wrote:

>
> Otto Dassau wrote:
>
>>>> I would like to add raster map values with r.mapcalc. Does there exist a
>>>> maximum number of maps to calculate?
>>>
>>> AFAIK, there is only GRASS' limit on the maximum number of open maps
>>> (256). r.mapcalc doesn't have any fixed limits, but the GRASS
>>> libraries on which it depends might.
>>>
>>>> I tried with 8 maps and it works well, but there is a problem when I want
>>>> to add e.f more than 30 maps.
>>>>
>>>> r.mapcalc "newmap = map1+map2+map3+map4+..."
>>>
>>> What's the problem, exactly?
>>
>> I would like to add a number of maps and it doesn't work with r.mapcalc for a
>> large number of input maps but with r.series it is ok. The maps are stored in
>> a variable $INPUT and it looks like this:
>>
>> echo "$INPUT"
>> map1+map2+map3+map4+map5...
>>
>> the r.mapcalc command is:
>> r.mapcalc "output.$TIMESTAMP = $INPUT"
>>
>> r.mapcalc calculates without errors but the resulting map is empty when the
>> number of input maps is high. I don't know the exact number of maps, when it
>> works and when not. I only tested with 8 and with 30.  8 is fine 30 not.
>
> I can't reproduce this using simple generated data.
>
> Do the input maps contain nulls? In r.mapcalc, the result of an
> addition (or any other arithmetic operator) is null if either input is
> null. Hence, a cell in the output map will be null if the
> corresponding cell in any of the input maps is null. As the number of
> input maps increases, the proportion of null cells will increase.

yes, the maps contain null (no data) values and I didn't thought about 
how r.mapcalc uses it.

> Note that the r.mapcalc command is equivalent to using r.series with
> the -n switch (propagate nulls). Without that switch, r.series only
> uses non-null cells in its calculations.

right, I used r.series without -n switch.

now I understand. Thanks a lot!

   Otto

> -- 
> Glynn Clements <glynn at gclements.plus.com>
>




More information about the grass-user mailing list