[R] extend limited dimension in netcdf

David W. Pierce dpierce at ucsd.edu
Thu Sep 7 17:33:40 CEST 2017

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



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]]

More information about the R-help mailing list