[R] Batch open netcdf files and get variables

2013-04-12 Thread Enhao Du
Hi, I'm new to R. I have some daily soil moisture data for the year 1979 in netcdf format such as these sm19790101.1.nc sm19790102.1.nc . . . sm19791231.1.nc I need to average a variable called "sm" to monthly resolution. I've done these days = formatC(1:31, width=2, flag="0") ncfiles = lapply(d

[R] Batch read netcdf files and average one variable

2013-04-11 Thread Enhao Du
Hi all, I'm a new R user. I now have daily netcdf data for year 1979 such as these: sm19790101.1.nc sm19790102.1.nc . . . sm19791231.1.nc I need to average a variable called "sm" to monthly resolution. I can now do this: glob2rx("sm197901*.1.nc") jan<-list.files(pattern=glob2rx("sm197901*.1.n