[R] function "rast.put" in package(GRASS)

Roger Bivand Roger.Bivand at nhh.no
Tue Jul 23 20:34:37 CEST 2002


Dear Celine,

On Tue, 23 Jul 2002, CELINE RONDEY wrote:

> I would like to use the "rast.put" function under R ( in package
> GRASS):"rast.put" moves a single numeric vector to Grass. This vector is
> the result of my kriging.  In fact, i created a grid :  
> grid<-data.frame(cbind(c(matrix(H$xseq,length(H$xseq),length(H$yseq))),
>   c(matrix(H$yseq,length(H$xseq),length(H$yseq),byrow=T))))
> grid_as.matrix(grid) 
> colnames(grid)_c("x","y")  #(with H <- gmeta(interp=TRUE))
> Loci_grid
> 
> and use "krige.conv" ( kc_krige.conv(......)) to obtain this value.
> So, my vector is kc$predict .
> (This numeric vector for export with length of H$Ncells in GRASS order).
> 
> But i have a problem with "rast.put" function. Indeed, when i draw my
> raster under GRASS, Xlamb and ylamb are inverted (lambert coordonnees).
> I write :
> rast.put(H,lname="var_residu",layer=kc$predict,cat=FALSE,interp=TRUE,
>   DCELL=TRUE)
> 
> How to use this function?
> 

First, it is always easier to try to help if the query states which 
platform, version of R, and in this case contributed package version, you 
are using. Since you are using krige.conv(), you seem to be using geoR and 
the GRASS interface (in interpreted mode).

You are passing a matrix of prediction locations to krige.conv() that you 
have constructed yourself. In the analogous krige.G() function in the 
GRASS interface package (using sgeostat and spatial), the same matrix of 
prediction loactions is constructed as:

s <- cbind(east(G), north(G))

where G <- gmeta(), equivalent to your H. The reason for using the helper 
functions east() and north() is to get the cells in the correct order for 
GRASS, ie. top left first, rather than bottom left first. Could you try 
this, next try plot(H, kc$predict) to see if the GRASS interface can plot 
"the right way up" in R, then rast.put() as before. Please feel free to 
use the GRASS statistics list too - 
http://grass.itc.it/mailman/listinfo/statsgrass, or to contact me 
off-list.

Roger

-- 
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
and: Department of Geography and Regional Development, University of
Gdansk, al. Mar. J. Pilsudskiego 46, PL-81 378 Gdynia, Poland.

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list