[MMTK] How to create new NetCDF file from template?

Konrad Hinsen hinsen at cnrs-orleans.fr
Thu Nov 6 08:23:28 UTC 2008


On 06.11.2008, at 00:44, Jose Borreguero wrote:

> Dear MMTK users,
>
> I want to create a fresh new NetCDF file with the same structure as  
> some existing NetCDF file. I have trouble cloning the variables:
>
> def cloneNetCDF(outfile,template):
>     pin=NetCDFFile(template, 'r')   #this is the existing file
>     pout=NetCDFFile(outfile, 'w')    #this is the new file
>     for name,size in pin.dimensions: pout.createDimension(name,size)
>     for name,var in template.variables: I-have-no-clue()
>    return pout

for name, var in template.variables.items():
	...

template.variables is an ordinary Python dictionary.

Konrad.
--
---------------------------------------------------------------------
Konrad Hinsen
Centre de Biophysique Moléculaire, CNRS Orléans
Synchrotron Soleil - Division Expériences
Saint Aubin - BP 48
91192 Gif sur Yvette Cedex, France
Tel. +33-1 69 35 97 15
E-Mail: hinsen at cnrs-orleans.fr
---------------------------------------------------------------------






More information about the mmtk mailing list