raphael.felber at agroscope.admin.ch
2017-Sep-07 12:49 UTC
[R] extend limited dimension in netcdf
Dear all I have to combine 3D netCDF files (lon, lat, time). The files contain data of one month and I need a year file containing all the data. Because the attributes of all files are the same, I copied the first file and appended the data of the other months. This went well until the provider of the data changed the time-dimension from UNLIMITED to LIMITED. Is there a way to change the time dimension to UNLIMITED? I tried ncnew$dim[[3]]$unlim <- TRUE but this has no effect. Thanks for any help. Kind regards Raphi ------------------------------------------------------------------------------------ Raphael Felber, Dr. sc. Wissenschaftlicher Mitarbeiter, Klima und Lufthygiene Eidgen?ssisches Departement f?r Wirtschaft, Bildung und Forschung WBF Agroscope Forschungsbereich Agrar?kologie und Umwelt Reckenholzstrasse 191, 8046 Z?rich Tel. 058 468 75 11 Fax 058 468 72 01 raphael.felber at agroscope.admin.ch<mailto:raphael.felber at agroscope.admin.ch> www.agroscope.ch<http://www.agroscope.ch/> [[alternative HTML version deleted]]
On Thu, Sep 7, 2017 at 5:49 AM, <raphael.felber at agroscope.admin.ch> wrote:> Dear all > > I have to combine 3D netCDF files (lon, lat, time). The files contain data > of one month and I need a year file containing all the data. Because the > attributes of all files are the same, I copied the first file and appended > the data of the other months. This went well until the provider of the data > changed the time-dimension from UNLIMITED to LIMITED. Is there a way to > change the time dimension to UNLIMITED? >?Hi Raphi, I suggest using the netcdf operators (nco) for this function (? http://nco.sourceforge.net/). The relevant command would involve "ncks --mk_rec_dmn", which converts a fixed dimension to an unlimited one. ?If you have no option but to do it with the netcdf package in R, the approach would be to remake the original file in a completely new file, one that is the same as the original file except that the time dimension is defined to be unlimited. Personally I would also drop a polite email to the data provider asking them to go back to unlimited time dimensions. Perhaps they had some good reason for the change, but it's at least as likely that it was simply a mistake.? ?Regards, --Dave? -- David W. Pierce Division of Climate, Atmospheric Science, and Physical Oceanography Scripps Institution of Oceanography, La Jolla, California, USA (858) 534-8276 (voice) / (858) 534-8561 (fax) dpierce at ucsd.edu [[alternative HTML version deleted]]