[STATSGRASS] Re: R-GRASS error in region changes

Roger Bivand Roger.Bivand at nhh.no
Mon Feb 21 08:37:48 EST 2005


Hi Javier,

OK, it's a bug, I'll push a new version out as soon as I've checked, the 
problem is G_get_window() saving its previous read from disk instead of 
reading fresh. Until the new version reaches CRAN, please use interp=TRUE 
in rast.get() - this *is* fixed most places, like gmeta(), rast.put(), and 
the sites functions, just not rast.get()!

Roger

On Mon, 21 Feb 2005, javier garcia wrote:

> Hi Roger and all the rest,
> 
> I've tried this with two different computers:
> 
> Linux Mandrake 10.0
> GRASS version: 5.3.0
> Package: R-GRASS Version: 0.2-20
> R version: 1.9.1
> 
> Linux Mandrake 8.2
> GRASS version: 5. 0
> Package: R-GRASS Version: 0.2-17
> R version 1.9.1
> 
> and the problem is identical.
> 
> The exact error message is:
> 
> "Error in rast.get(G, rlist=paste("template", i, sep= ""), catlabels = 
> FALSE) :
> Current GRASS region changed: ns_res"
> 
> I supposed that 
> G <- meta would include the new region information and rast.get would not have 
> any problem then
> 
> In Spearfish, the problem remains the same.
> 
> Javier
> ---------
> El Lunes, 21 de Febrero de 2005 13:02, Roger Bivand escribió:
> > On Mon, 21 Feb 2005, javier garcia - CEBAS wrote:
> > > Hi all;
> > > I guess that Roger B. is the best person to answer this, anyway I send
> > > the question to everybody in the list (I think it is interesting):
> > > I'm trying to do an R script to do a statistical analysis over GRASS
> > > maps, and I obtain an error. Perhaps the link R-GRASS doesn't allow to do
> > > what I'm trying?
> > >
> > > Through my R script I'm changing the region in GRASS, and after this I
> > > get some maps from GRASS into R, what gives an error:
> > >
> > > -----------------
> > > # R script
> > > library(GRASS)
> > > for (i in 33:1) {
> > >   g.region <- paste("g.region n=9.9 s=0 e=3.3 w=0 res=",3.3/i,sep="")
> > >   system(g.region)
> > >   system(paste("r.mapcalc template",i,"=1",sep=""))
> > >   rm(G)
> > >   G <- gmeta()
> > >   RGRASS <- rast.get(G, rlist=paste("template",i,sep=""),
> > > catlabels=FALSE) }
> > > -----------------
> > >
> > > The R error message appears in the second loop:
> > > Error in rast.get(G, rlist = paste("template", i, sep = ""), catlabels =
> > > FALSE) :
> > >         Current GRASS region changed: ns_res
> > >
> > >
> > > Could be any possibility to succeed with this?
> >
> > There usually is, one way or another. But to find out, it would be useful
> > to state your platform (OS, etc), which GRASS version you are using, which
> > R version, and which R-GRASS interface version - that is, the usual
> > routine on R-help. Knowing the versions makes it easier to see what is
> > going on. If you can also replicate this on Spearfish or another very
> > standard data set makes it even easier! If anyone else has insights,
> > please join in!
> >
> > Best wishes,
> >
> > Roger
> >
> > > Thanks and best regards,
> > >
> > > Javier
> 
> 

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






More information about the grass-stats mailing list