Unidata - To provide the data services, tools, and cyberinfrastructure leadership that advance Earth system science, enhance educational opportunities, and broaden participation. Unidata
         
  advanced  
 

Python bindings for the netcdf library.

The python netcdf module is finally available for testing and use.

Please check the following url for information:

<http://snow.cit.cornell.edu/noon/ncmodule.html>

Quick overview:

Python is an interpreted, object oriented language that is supported on a
wide range of hardware and operating systems.  Information and sources
can be obtained from <http://www.python.org/>

The netcdf bindings allow easy creation, access and browsing of netcdf files.

The bindings also use the udunits library to do unit conversions.

An example of opening a netcdf file, reading a value, changing it and
saving the file:

>>>
# python
Python 1.3 (Oct 26 1995) [C]
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import nc
>>> file = nc.open('test.nc',nc.WRITE)
>>> file.list_dim()
[('time', 0), ('len', 10)]
>>> y = file.var('y')
>>> y[0] = range(10)
>>> y[0]
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> y[0] = [0, 1, 2, 3, 99, 5, 6, 7, 8, 9]
>>> y[0]
[0, 1, 2, 3, 99, 5, 6, 7, 8, 9]
>>> file.close()
>>> file = nc.open('test.nc')
>>> y = file.var('y')
>>> y[0]
[0, 1, 2, 3, 99, 5, 6, 7, 8, 9]
>>> file.close()

Give it a try.

--Bill Noon
noon@xxxxxxxxxxxxxxxxxxxx
Northeast Regional Climate Center
Cornell University


 
 
  Contact Us     Site Map     Search     Terms and Conditions     Privacy Policy     Participation Policy
 
National Science Foundation (NSF) UCAR Community Programs   Unidata is a member of the UCAR Community Programs, is managed by the University Corporation for Atmospheric Research, and is sponsored by the National Science Foundation.
P.O. Box 3000     Boulder, CO 80307-3000 USA     Tel: 303-497-8643     Fax: 303-497-8690