[R-sig-Geo] change projection of large raster file
Breitbach, Nils
breitbach at uni-mainz.de
Tue Jun 21 11:03:04 CEST 2011
Dear Carsten,
I rarely work with rasta data sets but I would suggest that this is a memory problem. In R (and in ArcGIS as well) unfortunately all the data of an operation are held in the working memory which sometimes made it necessary for me to split bigger data sets into many small ones. This seems to be not only true for GIS data but also for other operations with huge data sets; it is getting even worse in loops. Have you tried to test your script with a smaller data set (i.e. a small fraction of the total area to be projected) on another computer, while the big operation is still running?
Regards,
Nils
________________________________________
Von: r-sig-geo-bounces at r-project.org [r-sig-geo-bounces at r-project.org]" im Auftrag von "Carsten Dormann [carsten.dormann at ufz.de]
Gesendet: Dienstag, 21. Juni 2011 10:47
Bis: r-sig-geo at stat.math.ethz.ch
Betreff: [R-sig-Geo] change projection of large raster file
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
_______________________________________________
R-sig-Geo mailing list
R-sig-Geo at r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
More information about the R-sig-Geo
mailing list