R-GRASS link problem

3 messages Options
Embed this post
Permalink
jgarcia-2

R-GRASS link problem

Reply Threaded More More options
Print post
Permalink
Hi;
I've already reported this problem to the R list, but it is probable
that the source of the problem is GRASS (5.4) instead of R.
I'm using the library GRASS in R to carry out a sequence of operation in
a set of GRASS maps.
After a couple of loops I obtain the warning message:
"Too many open raster files"
and the communication between R and GRASS does not work anymore for that
moment on.

The fact is that I'm opening a sequence of maps, but the destination
name in R is always the same, so it does not seem to be an R problem but
a GRASS one.

Could you advise me about how to solve this?

Thanks and best regards,

Javier
------------------------

--
Javier GarcĂ­a-Pintado
Institute of Earth Sciences Jaume Almera (CSIC)
Lluis Sole Sabaris s/n, 08028 Barcelona
Phone: +34 934095410
Fax:   +34 934110012
e-mail:[hidden email]


[jgarcia.vcf]

begin:vcard
fn;quoted-printable:Javier Garc=C3=ADa-Pintado
n;quoted-printable:Garc=C3=ADa-Pintado;Javier
org;quoted-printable:Institute of Earth Sciences Jaume Almera (CSIC)=0D=0A=
       
adr;dom:;;Lluis Sole Sabaris s/n, 08028 Barcelona
email;internet:[hidden email]
tel;work:+34 934095410
tel;fax:+34 934110012
version:2.1
end:vcard



_______________________________________________
statsgrass mailing list
[hidden email]
http://grass.itc.it/mailman/listinfo/statsgrass
Roger Bivand

Re: R-GRASS link problem

Reply Threaded More More options
Print post
Permalink
On Wed, 8 Aug 2007, javier garcia-pintado wrote:

> Hi;
> I've already reported this problem to the R list, but it is probable
> that the source of the problem is GRASS (5.4) instead of R.

You wrote to R-help, not to R-sig-geo, which is the correct list on the R
side.

> I'm using the library GRASS in R to carry out a sequence of operation in
> a set of GRASS maps.
> After a couple of loops I obtain the warning message:
> "Too many open raster files"
> and the communication between R and GRASS does not work anymore for that
> moment on.
>
> The fact is that I'm opening a sequence of maps, but the destination
> name in R is always the same, so it does not seem to be an R problem but
> a GRASS one.
>

The GRASS package for legacy GRASS 5 has its own copy of the GRASS library
files that it calls, and the problem occurs when the number of "open"
files exceeds MAXFILES 256. You can change this in src/include/G.h and
re-build if you like, but since the C source of rastget shows you, it is
careful to close the file handles, line 214 in src/rastget.c. This leads
me to think that this is an OS story, and so we need to know your OS.
Here, Windows or cygwin may behave very differently when freeing system
resources from say Linux.

For me on Linux, running example(rast.get) outside GRASS (I do not have a
working GRASS 5 installation any more) and then running:

for (i in 1:260) {
  print(i)
  exget <- rast.get(G, rlist=c("ex.Zn.grid.in", "ex.tr3.in",
   "ex.Zn.grid.o.in"), catlabels=as.logical(c(FALSE, FALSE, TRUE)))
}

did not show any problems.

Roger

> Could you advise me about how to solve this?
>
> Thanks and best regards,
>
> Javier
> ------------------------
>
>

--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: [hidden email]

_______________________________________________
statsgrass mailing list
[hidden email]
http://grass.itc.it/mailman/listinfo/statsgrass
Roger Bivand
Economic Geography Section
Department of Economics
Norwegian School of Economics and Business Administration
Helleveien 30
N-5045 Bergen, Norway
Markus Neteler-3

Re: R-GRASS link problem

Reply Threaded More More options
Print post
Permalink
Hi,

just to note that these limitations no longer exist in recent GRASS 6.

Markus

Roger Bivand wrote:
On Wed, 8 Aug 2007, javier garcia-pintado wrote:

> Hi;
> I've already reported this problem to the R list, but it is probable
> that the source of the problem is GRASS (5.4) instead of R.

You wrote to R-help, not to R-sig-geo, which is the correct list on the R
side.

> I'm using the library GRASS in R to carry out a sequence of operation in
> a set of GRASS maps.
> After a couple of loops I obtain the warning message:
> "Too many open raster files"
> and the communication between R and GRASS does not work anymore for that
> moment on.
>
> The fact is that I'm opening a sequence of maps, but the destination
> name in R is always the same, so it does not seem to be an R problem but
> a GRASS one.
>

The GRASS package for legacy GRASS 5 has its own copy of the GRASS library
files that it calls, and the problem occurs when the number of "open"
files exceeds MAXFILES 256. You can change this in src/include/G.h and
re-build if you like, but since the C source of rastget shows you, it is
careful to close the file handles, line 214 in src/rastget.c. This leads
me to think that this is an OS story, and so we need to know your OS.
Here, Windows or cygwin may behave very differently when freeing system
resources from say Linux.

For me on Linux, running example(rast.get) outside GRASS (I do not have a
working GRASS 5 installation any more) and then running:

for (i in 1:260) {
  print(i)
  exget <- rast.get(G, rlist=c("ex.Zn.grid.in", "ex.tr3.in",
   "ex.Zn.grid.o.in"), catlabels=as.logical(c(FALSE, FALSE, TRUE)))
}

did not show any problems.

Roger

> Could you advise me about how to solve this?
>
> Thanks and best regards,
>
> Javier
> ------------------------
>
>

--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand@nhh.no