Merging many single .nc files into one multi-file netCDF using r?

I am trying to merge many single .nc files into one multi-file netCDF. I need to merge monthly files from 1901-2006 for a few variables e.g. temp (filename is tmp_cru-ts-4.03-gridded_1.75w50.75n1.75w50.75n_19010116)

My skills are pretty basic in R but I've tried this so far:

filenames=list.files("tmp", pattern = '*.nc', full.names = TRUE)
ldf = lapply(filenames,open.nc)             #rnetcdf function
binded = rbind(ldf)

I'm not sure if this is right, or how to now write it to a .nc file?

Thanks!

I found this tutorial for you.
http://geog.uoregon.edu/bartlein/courses/geog490/week04-netCDF.html#introduction

1.1 Reading, restructuring and writing netCDF files in R
The examples provided here include
*reading a netCDF file using the ncdf4 package (netCDF4)
*reshaping a netCDF “brick” of data into a data frame
*reshaping a data frame into an array or “brick”
*writing a netCDF file using the ncdf4 package

Thanks, I'm afraid its a bit beyond my comprehension - I was hoping there was a quick way of merging existing files rather than having to write a new file from scratch..?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.