Skip to content
Prev 22748 / 29559 Next

Faster way to get raster average?

Thank you all for the responses. All of them helped me to learn new approaches.
Since I wanted to stick to R (even though I call CDO from R), I ended up adopting Michael's suggestion to reshape data as a matrix before taking the averages.
While relatively hard to read and understand, the time saved in the operation will probably make a huge difference in the final script looping through thousands of files.?Greetings,
--
Thiago V. dos Santos
PhD student
Land and Atmospheric Science
University of Minnesota
http://www.laas.umn.edu/CurrentStudents/MeettheStudents/ThiagodosSantos/index.htm
Phone: (612) 323 9898
On Wednesday, May 6, 2015 7:25 AM, Byman HIkanyona <bymanh at gmail.com> wrote:
Hi, 

My approach, in brief, is similar to what Micheal? Summer suggested, i.e using the netcdf tools (CDO, NCO, etc.). Whether in Linux, Mac,or windows. these tools run more efficiently - memory use and speed. I sometimes use R to automate the run since most are run on (DOS prompt like environment, batch). You can also 'pipe' the operation for example in CDO to avoid saving extra files. For example (CDO - windows) 'R CMD BATCH cdo?ensmean?ifile[1-100]?ofile'? computes the ensemble mean of 100 files listed and saves the result in output file, which you can read using Raster packages. I don't know if this helps.

Cheers, Byman
On Wed, May 6, 2015 at 10:02 AM, Rainer M Krug <Rainer at krugs.de> wrote:
"Thiago V. dos Santos" <thi_veloso at yahoo.com.br> writes:
The key question is: how often do you have to do the calculations and if
it would be feasible to just let them run for a few days and be done
with it - optimization takes time!

Cheers,

Rainer
--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :? ? ? ?+33 - (0)9 53 10 27 44
Cell:? ? ? ?+33 - (0)6 85 62 59 98
Fax :? ? ? ?+33 - (0)9 58 10 27 44

Fax (D):? ? +49 - (0)3 21 21 25 22 44

email:? ? ? Rainer at krugs.de

Skype:? ? ? RMkrug

PGP: 0x0F52F982

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo at r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo