[R-sig-Geo] RE rgdal: Memory error!
Yong Li
yong.li at unimelb.edu.au
Wed Jul 16 02:06:47 CEST 2008
Hi Paul,
It is windows xp. Each grid has 1993 rows and 1990 cols. The error
occurred almost in the end of code at:
> predictors$SLOPE = readGDAL("Terrain/ht_slope.mpr")$band1
Yong
-----Original Message-----
From: Paul Hiemstra [mailto:p.hiemstra at geo.uu.nl]
Sent: Wednesday, 16 July 2008 12:30 AM
To: Yong Li
Cc: r-sig-geo at stat.math.ethz.ch
Subject: Re: [R-sig-Geo] RE rgdal: Memory error!
Hi Yong,
What operating system are you using (probably windows) and is it 32 bit
of 64 bit and after what command did your computer crash. Without this
kind of information it is hard to judge what would be a solution for
your problem.
cheers,
Paul
Yong Li wrote:
> Hi All,
>
> I ran the following code and got the below error:
> "Error: cannot allocate vector of size 30.3 Mb".
>
> Actually my laptop has 4096 MB ram, and I increased the limit already.
> Pls advise any tips to let me pass through.
> I guess Dr Hengl experienced this before.
>
> Regards
>
> Yong
>
>
#-----------------------------------------------------------------------
> ----
> memory.size()
> memory.size(TRUE)
> memory.limit(size=4000)
> round(memory.limit()/1024, 2)
> options(scipen=3)
>
> options(digits=15)
> rm(list=ls())
> require(sp)
> require(gstat)
> require(maptools)
>
> cellsize <- 25
>
> # 1 2 3 4 5
>
>
VarName=c("logit(SOM)","logit(TN)","logit(AVN)","logit(OLSENP)","logit(A
> VK)")
>
out=paste("Variable","No","Model","C0","C","Spatial","Range","R2","p","S
> SE",sep=",")
> setwd("C:/Rcode/EJSS/Hongtong/county")
> data <- read.csv("htfs_19N_2005_A.csv", header = TRUE, sep = ",")
> names(data)
> class(data)
> coordinates(data) <- ~X+Y
> proj4string(data) <- CRS("+proj=tmerc +lat_0=0 +lon_0=111 +k=1.0
> +x_0=500000 +y_0=0 +ellps=krass +units=m +no_defs
> +towgs84=22,-118,30.5,0,0,0,0")
>
> library(rgdal)
> predictors = readGDAL("VIs/GSI.mpr")
> predictors$CI = readGDAL("VIs/CI.mpr")$band1
> predictors$WRNDVI = readGDAL("VIs/WRNDVI.mpr")$band1
> predictors$ARVI = readGDAL("VIs/ARVI.mpr")$band1
> predictors$NDWI = readGDAL("VIs/NDWI.mpr")$band1
> predictors$EVI = readGDAL("VIs/EVI.mpr")$band1
> predictors$DEM = readGDAL("Terrain/ht_dem.mpr")$band1
> predictors$CONVERG = readGDAL("Terrain/ht_converg.mpr")$band1
> predictors$PLANC = readGDAL("Terrain/ht_planc.mpr")$band1
> predictors$PROFC = readGDAL("Terrain/ht_profc.mpr")$band1
> predictors$SLOPE = readGDAL("Terrain/ht_slope.mpr")$band1
> predictors$TWI = readGDAL("Terrain/ht_twi.mpr")$band1
>
> predictors$GSI = predictors$band1
> predictors$band1 = NULL
> proj4string(predictors) <- CRS("+proj=tmerc +lat_0=0 +lon_0=111 +k=1.0
> +x_0=500000 +y_0=0 +ellps=krass +units=m +no_defs
> +towgs84=22,-118,30.5,0,0,0,0")
>
#-----------------------------------------------------------------------
> ----
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
--
Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone: +31302535773
Fax: +31302531145
http://intamap.geo.uu.nl/~paul
More information about the R-sig-Geo
mailing list