[R-sig-Geo] properly using function aggregate(raster)

Guillaume Blanchet gblanchet.list at gmail.com
Mon May 17 21:22:57 CEST 2010


Dear Robert !

Thank you very much for your quick answer !

I just ran the bits of code you gave me and it worked perfectly !

Have a good day !

Guillaume

Le 10-05-17 11:50, Robert J. Hijmans a écrit :
> Dear Guillaume,
>
> This probably happened because the aggregate function tests if the
> output raster can be stored in memory. This is a mistake as it should
> do the test for the input raster (which is, in this case, 16 times
> larger). I have just fixed that. For now, you can use this (otherwise
> *not* recommended (or necessary), as it slows things down) option, to
> force processing the file in chunks :
>
> setOptions(todisk=TRUE)
> wam<-aggregate(wam, fact=4, fun=mean, expand=FALSE,
> filename="wam_ag4", progress='tcltk')
> setOptions(todisk=FALSE)
>
> Robert
>
> On Mon, May 17, 2010 at 10:15 AM, Guillaume Blanchet
> <gblanchet.list at gmail.com>  wrote:
>    
>> Hi !
>>
>> I recently started to use the raster package to play with a file that I
>> consider fairly big. Since file size is subjective, following is the
>> summary output R gives of the data I am working with :
>>
>>   >  wam
>> class       : RasterLayer
>> filename    : w001001.adf
>> nrow        : 14143
>> ncol        : 11733
>> ncell       : 165939819
>> min value   : 0
>> max value   : 36.3769
>> projection  : +proj=utm +zone=11 +ellps=GRS80 +datum=NAD83 +units=m
>> +no_defs +towgs84=0,0,0
>> xmin        : 410133
>> xmax        : 421866
>> ymin        : 6287971
>> ymax        : 6302114
>> xres        : 1
>> yres        : 1
>>
>> I would like to aggregate the information of that RasterLayer. I tried
>> to use the function aggregate() without any real success. Following is
>> the code line I use to perform that procedure and the error message I get:
>>
>>   >  wam<-aggregate(wam, fact=4, fun=mean, expand=FALSE, filename="wam_ag4")
>>
>> Erreur : impossible d'allouer un vecteur de taille 633.0 Mo (A loose
>> translation would be : "Error: allocating a vector of 633.0 Mb in size
>> is impossible")
>> De plus : Messages d'avis :
>> 1: In .local(x, ...) :
>>    Reached total allocation of 3061Mb: see help(memory.size)
>> 2: In .local(x, ...) :
>>    Reached total allocation of 3061Mb: see help(memory.size)
>> 3: In .local(x, ...) :
>>    Reached total allocation of 3061Mb: see help(memory.size)
>> 4: In .local(x, ...) :
>>    Reached total allocation of 3061Mb: see help(memory.size)
>>
>> I understood while reading help files and various posting that the
>> raster package can handle files larger than the RAM memory of the
>> computer. The computer I am using has 3Gb of RAM and the file I want to
>> read is only 633 Mb. I suppose there something I am not doing right.
>>
>> Any help would be much appreciated !
>>
>> Thank you in advance !
>>
>> Guillaume Blanchet
>>
>>         [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at stat.math.ethz.ch
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>>      
>



More information about the R-sig-Geo mailing list