[R-sig-Geo] change projection of large raster file
Carsten Dormann
carsten.dormann at ufz.de
Tue Jun 21 10:47:41 CEST 2011
Dear all,
I want to compute equal-area grid values for global land cover (GLC2000
data). The equal-area grid is in Mollweide projection.
I use raster to read the GLC-data. Now I want to project these
WGS84-projected GLC-data into Mollweide.
Even after 24 hours of computing, R was still milling away. I regard
this as a problem, rather than a consequence of the large data set (54
MB). Correctly so?
Any hints on how to do this correctly appreciated!
[Only in case you were wondering WHY I do this: The next steps will be
to simplify down to only one category (using data == "1") and then use
"aggregate" to actually sum the number of positive pixels in each cell.
I did the whole thing with a 1-degree grid without any problems (taking
roughly 30min for each class).]
Cheers,
Carsten
R-code:
r <- raster(grid100) # to convert the SpatialGrid into a raster
test <- raster("glc2000_v1_1") #reads the GLC data
ex <- projectExtent(test, CRS(proj4string(grid100))) # reprojects the extent
setOptions(chunksize = 1e+04, maxmemory = 1e+06)
# based on comment in:
https://r-forge.r-project.org/forum/message.php?msg_id=4025&group_id=294
test2 <- projectRaster(test, ex) # to project the actual GLC-data
sessionInfo()
R version 2.13.0 RC (2011-04-05 r55311)
Platform: i386-apple-darwin9.8.0/i386 (32-bit)
locale:
[1] de_DE.UTF-8/de_DE.UTF-8/C/C/de_DE.UTF-8/de_DE.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] maptools_0.8-6 lattice_0.19-26 foreign_0.8-44 rgdal_0.6-33
raster_1.8-12 sp_0.9-80
loaded via a namespace (and not attached):
[1] grid_2.13.0 tools_2.13.0
--
Dr. Carsten F. Dormann
Department of Computational Landscape Ecology
Helmholtz Centre for Environmental Research-UFZ
(Department Landschaftsökologie)
(Helmholtz Zentrum für Umweltforschung - UFZ)
Permoserstr. 15
04318 Leipzig
Germany
Tel: ++49(0)341 2351946
Fax: ++49(0)341 2351939
Email: carsten.dormann at ufz.de
internet: http://www.ufz.de/index.php?de=4205
Registered Office/Sitz der Gesellschaft: Leipzig
Commercial Register Number/Registergericht: Amtsgericht Leipzig,
Handelsregister Nr. B 4703
Chairman of the Supervisory Board/Vorsitzender des Aufsichtsrats: MinR
Wilfried Kraus
Scientific Managing Director/Wissenschaftlicher Geschäftsführer: Prof.
Dr. Georg Teutsch
Administrative Managing Director/Administrativer Geschäftsführer: Dr.
Andreas Schmidt
More information about the R-sig-Geo
mailing list