Difference between revisions of "PyCDF"

From SourceWiki
Jump to navigation Jump to search
Line 21: Line 21:
 
</pre>
 
</pre>
  
You will need to edit the file called '''setup.py''' to reflect where you installed your NetCDF libraries.
+
You will need to edit the file called '''setup.py''' to reflect where you installed your NetCDF libraries:
  
 
<pre>
 
<pre>

Revision as of 20:37, 12 August 2009

PyCDF: a handy python module you'll need

Introduction

This is a module that you will need when you come to the exercise when you add a module to GLIMMER-CISM. It's not available through the Ubuntu package manager, so you will install it yourself into your own filespace.

Compiling the Module

OK, first thing's first, let's get the source code. Open a terminal, stay in (move to) your home directory and cut and paste the following:

wget http://sourceforge.net/projects/pysclint/files/pycdf/pycdf-0.6.3b/pycdf-0.6-3b.tar.gz/download

Now, we'll unpack the tarball, and move into the appropriate directory:

tar -xzf pycdf-0.6-3b.tar.gz
cd pycdf-0.6-3b

You will need to edit the file called setup.py to reflect where you installed your NetCDF libraries:

elif USE == NUMPY:
    from numpy.distutils.misc_util import get_numpy_include_dirs
    _pycdf_ext = Extension(extName,
                           sources   = CCode,
                           #library_dirs=["non standard path where libs live"],                       
                           library_dirs=["/home/PSU/pdx05933/installs/netcdf-4.0.1/lib"],
                           include_dirs = get_numpy_include_dirs(),
                           libraries = ["netcdf"])

Setting your PYTHONPATH