[GRASSLIST:2040] Re: (no subject)
Roger Bivand
Roger.Bivand at nhh.no
Fri Dec 12 05:24:52 EST 2003
On Fri, 12 Dec 2003, José Agustín García García wrote:
> Hi friends,
> I am trying to do kriging using R (packages:
> geoR and GRASS) and Grass. My problem come up
> when I try to expor the results to file with
> rast.put. I use the following R-sentences
>
> salida<- krige.conv(datos, locations=loci,
> krige=krige.control(cov.pars=ml.fn$cov.pars,
> cov.model="matern", nugget= ml.fn$nugget))
> cachos=pretty(salida$predict, n=10)
> ncolors=length(cachos)-1
> dim(salida$predict)<-c(G$Nrow,G$Ncol)
> rast.put(G,lname='krig1',layer=salida$predict,
> breaks=cachos, col=rainbow(ncolors), check=FALSE)
>
> but I get the following error:
>
> Error in rast.put(G, lname = "krig1", layer = salida$predict, breaks = cachos,
> :
> number of colors must equal one less than the number of breaks
I think that you may have found an "infelicity" in rast.put() - please
try:
rast.put(G,lname='krig1',layer=salida$predict, check=FALSE)
which will give a default grey colour scheme, also using pretty. The
problem is that the test in the code for lengths of col and breaks is the
wrong way round, I think - this will be corrected for the next release. I
have a feeling that if there are NAs in your data, then pretty() will be
thrown off-course too. Finally, there is no reason to set the dim
attribute of the raster layer, because all the information needed is in G.
Best wishes,
Roger
>
> any help is wellcome
>
> Agustin
>
--
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-user
mailing list