raphael.felber at agroscope.admin.ch
2017-Aug-02 10:03 UTC
[R] Remove attribute from netcdf4 object
Dear all For a model I need to combine several netCDF files into one (which works fine). For better overview I'd like to delete/remove some of the attributes. Is there a simple way doing this? I'm using the package netcdf4, which creates an object of class(nc) = "ncdf4". It seems that for earlier versions of netcdf objects, there was the function att.delete.nc{RNetCDF}. But this functions returns the following error, when applied to ncdf4-classes: Error: class(ncfile) == "NetCDF" is not TRUE Thanks a lot for any help. Kind regards Raphael Felber ------------------------------------------------------------------------------------ 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]]
Le 02/08/2017 ? 12:03, raphael.felber at agroscope.admin.ch a ?crit :> Dear all > > For a model I need to combine several netCDF files into one (which works fine). For better overview I'd like to delete/remove some of the attributes. Is there a simple way doing this? > > I'm using the package netcdf4, which creates an object of class(nc) = "ncdf4". It seems that for earlier versions of netcdf objects, there was the function att.delete.nc{RNetCDF}. But this functions returns the following error, when applied to ncdf4-classes: > Error: class(ncfile) == "NetCDF" is not TRUEYou should use package ncdf4 or package RNetCDF, but not mixed both. Marc> > Thanks a lot for any help. > > Kind regards > > Raphael Felber > > ------------------------------------------------------------------------------------ > 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]] > > > > ______________________________________________ > R-help at r-project.org 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.-- __________________________________________________________ Marc Girondot, Pr Laboratoire Ecologie, Syst?matique et Evolution Equipe de Conservation des Populations et des Communaut?s CNRS, AgroParisTech et Universit? Paris-Sud 11 , UMR 8079 B?timent 362 91405 Orsay Cedex, France Tel: 33 1 (0)1.69.15.72.30 Fax: 33 1 (0)1.69.15.73.53 e-mail: marc.girondot at u-psud.fr Web: http://www.ese.u-psud.fr/epc/conservation/Marc.html Skype: girondot [[alternative HTML version deleted]]
raphael.felber at agroscope.admin.ch
2017-Aug-02 13:02 UTC
[R] Remove attribute from netcdf4 object
Dear Marc Thanks for your remark. I don't want to use both packages. I mentioned the package RNetCDF to show that there is a similar function I' d like to use. Raphael Von: Marc Girondot [mailto:marc.girondot at u-psud.fr] Gesendet: Mittwoch, 2. August 2017 14:51 An: Felber Raphael Agroscope <raphael.felber at agroscope.admin.ch>; r-help at r-project.org Betreff: Re: [R] Remove attribute from netcdf4 object Le 02/08/2017 ? 12:03, raphael.felber at agroscope.admin.ch<mailto:raphael.felber at agroscope.admin.ch> a ?crit : Dear all For a model I need to combine several netCDF files into one (which works fine). For better overview I'd like to delete/remove some of the attributes. Is there a simple way doing this? I'm using the package netcdf4, which creates an object of class(nc) = "ncdf4". It seems that for earlier versions of netcdf objects, there was the function att.delete.nc{RNetCDF}. But this functions returns the following error, when applied to ncdf4-classes: Error: class(ncfile) == "NetCDF" is not TRUE You should use package ncdf4 or package RNetCDF, but not mixed both. Marc Thanks a lot for any help. Kind regards Raphael Felber ------------------------------------------------------------------------------------ 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><mailto:raphael.felber at agroscope.admin.ch><mailto:raphael.felber at agroscope.admin.ch> www.agroscope.ch<http://www.agroscope.ch><http://www.agroscope.ch/><http://www.agroscope.ch/> [[alternative HTML version deleted]] ______________________________________________ R-help at r-project.org<mailto:R-help at r-project.org> 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. -- __________________________________________________________ Marc Girondot, Pr Laboratoire Ecologie, Syst?matique et Evolution Equipe de Conservation des Populations et des Communaut?s CNRS, AgroParisTech et Universit? Paris-Sud 11 , UMR 8079 B?timent 362 91405 Orsay Cedex, France Tel: 33 1 (0)1.69.15.72.30 Fax: 33 1 (0)1.69.15.73.53 e-mail: marc.girondot at u-psud.fr<mailto:marc.girondot at u-psud.fr> Web: http://www.ese.u-psud.fr/epc/conservation/Marc.html Skype: girondot [[alternative HTML version deleted]]
raphael.felber at agroscope.admin.ch
2017-Aug-02 13:45 UTC
[R] Remove attribute from netcdf4 object
Hi Marc That's a workaround I can use. Thanks. I'm a newbie regarding netCDF data. Is there any information I'm losing when switching between the packages? Raphael Von: Marc Girondot [mailto:marc.girondot at u-psud.fr] Gesendet: Mittwoch, 2. August 2017 15:13 An: Felber Raphael Agroscope <raphael.felber at agroscope.admin.ch> Betreff: Re: AW: [R] Remove attribute from netcdf4 object ok. Sorry, I didn't understood good. I don't think you can do it in ncdf4 functions. The only solution would be to open it in RNetCDF, delete the attribute, save it and then open it in ncdf4. Marc Le 02/08/2017 ? 15:02, raphael.felber at agroscope.admin.ch<mailto:raphael.felber at agroscope.admin.ch> a ?crit : Dear Marc Thanks for your remark. I don't want to use both packages. I mentioned the package RNetCDF to show that there is a similar function I' d like to use. Raphael Von: Marc Girondot [mailto:marc.girondot at u-psud.fr] Gesendet: Mittwoch, 2. August 2017 14:51 An: Felber Raphael Agroscope <raphael.felber at agroscope.admin.ch><mailto:raphael.felber at agroscope.admin.ch>; r-help at r-project.org<mailto:r-help at r-project.org> Betreff: Re: [R] Remove attribute from netcdf4 object Le 02/08/2017 ? 12:03, raphael.felber at agroscope.admin.ch<mailto:raphael.felber at agroscope.admin.ch> a ?crit : Dear all For a model I need to combine several netCDF files into one (which works fine). For better overview I'd like to delete/remove some of the attributes. Is there a simple way doing this? I'm using the package netcdf4, which creates an object of class(nc) = "ncdf4". It seems that for earlier versions of netcdf objects, there was the function att.delete.nc{RNetCDF}. But this functions returns the following error, when applied to ncdf4-classes: Error: class(ncfile) == "NetCDF" is not TRUE You should use package ncdf4 or package RNetCDF, but not mixed both. Marc Thanks a lot for any help. Kind regards Raphael Felber ------------------------------------------------------------------------------------ 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><mailto:raphael.felber at agroscope.admin.ch><mailto:raphael.felber at agroscope.admin.ch> www.agroscope.ch<http://www.agroscope.ch><http://www.agroscope.ch/><http://www.agroscope.ch/> [[alternative HTML version deleted]] ______________________________________________ R-help at r-project.org<mailto:R-help at r-project.org> 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. -- __________________________________________________________ Marc Girondot, Pr Laboratoire Ecologie, Syst?matique et Evolution Equipe de Conservation des Populations et des Communaut?s CNRS, AgroParisTech et Universit? Paris-Sud 11 , UMR 8079 B?timent 362 91405 Orsay Cedex, France Tel: 33 1 (0)1.69.15.72.30 Fax: 33 1 (0)1.69.15.73.53 e-mail: marc.girondot at u-psud.fr<mailto:marc.girondot at u-psud.fr> Web: http://www.ese.u-psud.fr/epc/conservation/Marc.html Skype: girondot -- __________________________________________________________ Marc Girondot, Pr Laboratoire Ecologie, Syst?matique et Evolution Equipe de Conservation des Populations et des Communaut?s CNRS, AgroParisTech et Universit? Paris-Sud 11 , UMR 8079 B?timent 362 91405 Orsay Cedex, France Tel: 33 1 (0)1.69.15.72.30 Fax: 33 1 (0)1.69.15.73.53 e-mail: marc.girondot at u-psud.fr<mailto:marc.girondot at u-psud.fr> Web: http://www.ese.u-psud.fr/epc/conservation/Marc.html Skype: girondot [[alternative HTML version deleted]]