[GRASSLIST:2038] (no subject)

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

any help is wellcome

Agustin
--
José Agustín García
Departamento de Física, Universidad de Extremadura
06071 Badajoz, Spain
Tfn. +34-924-289536, Fax. +34-924-289651, email agustin@unex.es

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@nhh.no