[R-sig-Geo] large SpatialGridDataFrame 2 SpatialPixelsDataFrame

Emilio A. Laca ealaca at ucdavis.edu
Thu Aug 9 23:50:10 CEST 2012


I want to create a SpatialPixelsDataFrame from a large SpatialGridDataFrame called spbay.

> system.time(sspbay<-summary(spbay)); sspbay
   user  system elapsed 
  4.850   1.041   5.890 
Object of class SpatialGridDataFrame
Coordinates:
         min       max
[1,]  543399  552878.5
[2,] 4218224 4223463.0
Is projected: TRUE 
proj4string :
[+proj=utm +no_defs +zone=10 +a=6378137 +rf=298.257222101
+towgs84=0.000,0.000,0.000 +to_meter=1]
Grid attributes:
  cellcentre.offset cellsize cells.dim
1            543400 1.999906      4740
2           4218225 1.999658      2620
Data attributes:
  agricfxCropd      annualgrassfxCropd baresoilfxCropd   
 Min.   :  0        Min.   :  0        Min.   :  0       
 1st Qu.:  0        1st Qu.:  0        1st Qu.:  0       
 Median :  0        Median :  0        Median :  0       
 Mean   : 12        Mean   : 32        Mean   : 49       
 3rd Qu.:  0        3rd Qu.:  0        3rd Qu.:  0       
 Max.   :996        Max.   :996        Max.   :996       
 NA's   :10290347   NA's   :10290347   NA's   :10290347  
 bulrushfxCropd     channelDensityCropd cordgrassfxCropd  
 Min.   :  0        Min.   :  0         Min.   :  0       
 1st Qu.:  0        1st Qu.:  0         1st Qu.:  0       
 Median :  0        Median :  0         Median :  0       
 Mean   : 46        Mean   :  6         Mean   : 58       
 3rd Qu.:  0        3rd Qu.:  8         3rd Qu.:  0       
 Max.   :996        Max.   :132         Max.   :996       
 NA's   :10290347   NA's   :10290121    NA's   :10290347  
 dist2bayCropd      dist2channelCropd  lela2005fxCropd   
 Min.   :   0       Min.   :   0       Min.   :    0     
 1st Qu.: 180       1st Qu.: 100       1st Qu.:    0     
 Median : 454       Median : 100       Median :    0     
 Mean   : 668       Mean   : 354       Mean   :  558     
 3rd Qu.: 888       3rd Qu.: 504       3rd Qu.:    0     
 Max.   :3270       Max.   :1000       Max.   :77520     
 NA's   :10289345   NA's   :11255037   NA's   :10399863  
 lela2010Cropd      lela2005Cropd       leveefxCropd       lidar2mCropd    
 Min.   : 0         Min.   : 0         Min.   :   0       Min.   :-6       
 1st Qu.: 0         1st Qu.: 0         1st Qu.:   0       1st Qu.: 1       
 Median : 0         Median : 0         Median :   0       Median : 2       
 Mean   : 0         Mean   : 1         Mean   :  24       Mean   : 2       
 3rd Qu.: 0         3rd Qu.: 0         3rd Qu.:   0       3rd Qu.: 2       
 Max.   :17         Max.   :80         Max.   :1011       Max.   :67       
 NA's   :10290121   NA's   :10290121   NA's   :10399863   NA's   :9986331  
 pickleweedfxCropd  saltgrassfxCropd   topoindxCropd      urbanfxCropd     
 Min.   :  0        Min.   :  0        Min.   :-10       Min.   :  0       
 1st Qu.:  0        1st Qu.:  0        1st Qu.:  4       1st Qu.:  0       
 Median :209        Median :  0        Median :  5       Median :  0       
 Mean   :445        Mean   :  4        Mean   :  5       Mean   :  1       
 3rd Qu.:996        3rd Qu.:  0        3rd Qu.:  6       3rd Qu.:  0       
 Max.   :996        Max.   :996        Max.   : 18       Max.   :996       
 NA's   :10290347   NA's   :10290347   NA's   :9986190   NA's   :10290347  
  waterfxCropd     
 Min.   :  0       
 1st Qu.:  0       
 Median :  0       
 Mean   :331       
 3rd Qu.:995       
 Max.   :996       
 NA's   :10290347  

> spbay.spxldf <- as(spbay, "SpatialPixelsDataFrame")  #ran overnight; OS almost non-responsive, had to Force quit.


As indicated in my comment, my computer was not able to effect the conversion after 8 hours running (hung up?).
 Model Name:	MacBook Pro
  Model Identifier:	MacBookPro8,2
  Processor Name:	Intel Core i7
  Processor Speed:	2.4 GHz
  Number of Processors:	1
  Total Number of Cores:	4
  L2 Cache (per Core):	256 KB
  L3 Cache:	6 MB
  Memory:	16 GB

I would appreciate suggestions on how to proceed with this data set. I want to use it for geostatistical and spatial regression analyses. I hope that the size will be significantly reduced by converting to spxdf.
Many thanks,


Emilio A. Laca



More information about the R-sig-Geo mailing list