[R-sig-eco] memory issues using Tps (package fields)

Robert J. Hijmans r.hijmans at gmail.com
Thu Jun 17 22:49:44 CEST 2010


Jorge,
You could use the function 'interpolate' in 'raster'. It makes
predictions for smaller chunks of data and puts these back together.
There is an example for Tps. You would need to provide elevation data
(as a RasterLayer) as the first argument.
Robert

On Thu, Jun 17, 2010 at 1:25 PM, Jorge Velasquez
<jorge at life.bio.sunysb.edu> wrote:
> Hi there,
>
> I'm trying to run a interpolation of climate using the functionTps
> (Thin plated splines) from the package fields, but keep running into
> the following error:
>
> Error: cannot allocate vector of size 488 Kb
> In addition: Warning messages:
> 1: In names(y) <- make.unique(cols) :
>  Reached total allocation of 3583Mb: see help(memory.size)
> 2: In names(y) <- make.unique(cols) :
>  Reached total allocation of 3583Mb: see help(memory.size)
> 3: In names(y) <- make.unique(cols) :
>  Reached total allocation of 3583Mb: see help(memory.size)
> 4: In names(y) <- make.unique(cols) :
>  Reached total allocation of 3583Mb: see help(memory.size)
> Error in as.matrix(expand.grid(grid.list)) :
>  error in evaluating the argument 'x' in selecting a method for
> function 'as.matrix'
>
> The code I'm running is:
>
> predGrid<-read.table("demaspoint_id8.csv" ,sep="," ,header=TRUE)
> data<-read.table("precp00-09ContSampleDem.csv",sep="," ,header=TRUE)
> fit<-Tps(data[,c("x","y")],data[,"Ene"],Z=data$dem)
> result<-predict.surface(fit,grid.list=list(x=predGrid[,c("Longitude","Latitude")],Z=predGrid[,"GRID_CODE"]))
>
> The file predGrid has ~65000 rows. The error is persistent even using
> a machine with 8GB Ram, double xeon processor, and the 64bit version
> of R, although the error pasted above is for the 32 bit version.
>
> Is there any solution to this? Am I missing something?
>
> Thanks,
>
> Jorge
> --
> ---
> Jorge Velasquez
> Department of Ecology and Evolution
> Stony Brook University
> Stony Brook, NY 11974
> Phone:(631) 632-1445
> http://life.bio.sunysb.edu/~jorge/
>
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>



More information about the R-sig-ecology mailing list