extend limited dimension in netcdf

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

extend limited dimension in netcdf

raphael.felber-2
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
[hidden email]<mailto:[hidden email]>
www.agroscope.ch<http://www.agroscope.ch/>


        [[alternative HTML version deleted]]


______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: extend limited dimension in netcdf

David W. Pierce
On Thu, Sep 7, 2017 at 5:49 AM, <[hidden email]> 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)    [hidden email]

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.