NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

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


  • 1996 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: