[GRASS-dev] graph function input limitations

Glynn Clements glynn at gclements.plus.com
Wed Nov 21 06:39:44 PST 2012


Paulo van Breugel wrote:

> I am working with the r.mapcalc graph function. When the input (number 
> of xy pairs) is very high, I am getting an error message:
> 
> "memory exhausted
> Parse error
> ERROR: parse error"
> 
> The largest possible number of xy pairs seems to be somewhere between 
> 2400 and 2500. It runs with 2400 xy pairs, and pretty fast for that 
> matter. Memory usage doesn't go beyond 1.5GB with 2400 xy pairs, while I 
> have 12GB RAM (on 64bit Linux computer), so I guess RAM isn't the 
> limitation here.

Each "term" in an r.mapcalc expression requires a row buffer, i.e. one
int/float/double value for each column of the map. A numeric literal
results in a row buffer filled with that value.

Depending upon what you're trying to do, it might be possible to use a
combination of r.mapcalc -> r.recode -> r.mapcalc. r.recode would use
significantly less memory than r.mapcalc's graph() function.

> In the help page of r.series, there is a mention of a soft limit of 1024 
> files. Does something similar apply here (but with different numbers)?
> 
> I can actually work around it, using a approximation of the graph 
> function, but would like to know at what number of xy pairs I should 
> apply the workaround. Particularly important, is the limit the same for 
> all users, or if not, what would be a safe limit? Or is there a way to 
> set this limit from within a script?

The limit would depend upon the number of columns in the current
region and the amount of memory available.

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


More information about the grass-dev mailing list