[R] exporting rast from R to GRASS
Roger Bivand
Roger.Bivand at nhh.no
Wed Dec 10 18:33:16 CET 2008
Thybério Luna Freire <thyberio <at> gmail.com> writes:
>
> Hi, everybody!
> i created a imagem by kriging using geoR package. I imported points
> from GRASS("zn", after converted to geodata "zn_geo"), the border
> "zn_border" and a raster mask. Then i interpolated the points by
> kriging and created a raster image. Now, i need export this image back
> to GRASS to use it in the module r.mapcalc. I can't do it. I tried use
> writeRAST6, but it returns a message: "tentativa de obter um slot
> "data" de um objeto cuja classe ("kriging") não é um objeto S4" or
> "attempt to obtain a slot from an object whose class ("kriging") is
> not a S4 object". what does this mean?
It means what it says, as the help page to krige.conv() says.
To make progress, you need to create a SpatialGridDataFrame matching the
GRASS location (region, resolution).
Use this to generate the prediction locations.
The output object "predict" component contains the predictions. Add it to
the SpatialGridDataFrame (or SpatialPixelsDataFrame), and proceed as
writeRAST6() suggests in the helpfile:
kc <- krige.conv(coords=coordinates(SPz2), data=SPz2$day16,
locations=coordinates(SPDF_utm), krige=krige.control(obj.model=fvg))
SPDF_utm$geoR_pred <- kc$predict
writeRAST6(SPDF_utm["geoR_pred"], "geoR_pred")
or similar (untried).
Note that either of the statgrass or R-sig-geo lists are more relevant
than this one.
Roger Bivand
> Help me, please!
>
> Thybério Luna - Brazil
>
More information about the R-help
mailing list