Differences between revisions 1 and 23 (spanning 22 versions)
Revision 1 as of 2008-10-30 09:41:12
Size: 1439
Editor: anonymous
Comment:
Revision 23 as of 2009-11-14 19:36:06
Size: 4194
Editor: anonymous
Comment:
Deletions are marked like this. Additions are marked like this.
Line 6: Line 6:
[[Python|Scientific Programming with Python]]
Line 9: Line 11:
 * [[http://37mm.no/mpy/idl-numpy.html|NumPy for IDL users]]  * [[http://www.cfa.harvard.edu/~jbattat/computer/python/science/idl-numpy.html|NumPy for IDL users]]
Line 13: Line 15:
== Modules == == Modules for Scientific Computing and Visualization ==
Line 20: Line 22:
 * [[http://matplotlib.sourceforge.net/basemap/doc/html/]] Matplotlib Basemap

To enable Basemap (on ZMAW Linux ia32/x64 and solaris10) you have to type before starting Python2.4.4:
{{{
module load Python/2.4.4
}}}
or to start Python2.6.2 (recommended):
{{{
module load R/2.7.0
module load Python/2.6.2
}}}

In Python you can import the Basemap module by
{{{
from mpl_toolkits.basemap import Basemap
}}}
Line 23: Line 41:
=== PyNGL === To enable GDAL use
{{{
module load gdal
}}}

{{{
from osgeo import gdal
}}}


=== PyNGL PyNio ===
Line 32: Line 60:
Please note, that Nio should be on the top of the list, e.g.

{{{
import Nio
from osgeo import gdal
import pylab as pl
}}}


=== Python Interface to GrADS ===
 * http://opengrads.org/wiki/index.php?title=Python_Interface_to_GrADS
Line 35: Line 74:
=== F2PY: Fortran to Python interface generator ===

Calling Fortran code from python is easy! Create a file {{{hello.f}}}:
{{{
C File hello.f
      subroutine foo (a)
      integer a
      print*, "Hello from Fortran!"
      print*, "a=",a
      end
}}}

Run
{{{f2py -c -m hello hello.f}}}

Now in IPython try:
{{{
In [1]: import hello
In [2]: hello.foo(4)
 Hello from Fortran!
 a= 4
}}}

Example taken from

 * [[http://cens.ioc.ee/projects/f2py2e/|F2PY: Fortran to Python interface generator]]

== Topical Modules ==

 * [[http://www.imr.no/~bjorn/python/seawater/index.html|Seawater]] is a package for computing properties of seawater (UNESCO 1981 and UNESCO 1983).
 * [[https://launchpad.net/escript-finley/|Escript/Finley: Fast Finite Elements for Partial Differential Equations]]


More topical software can be found at http://scipy.org/Topical_Software


=== Installation in the home directory ===
The seawater module is installed on the ZMAW machines for Python 2.6. Use
{{{
module load Python/2.6.2
}}}
to set up the environment. In the following it is explained how to install the module for the case if it would be not available or if a different version of python has to be used.

Installation of module {{{seawater}}} in directory {{{~/modules}}}
{{{
python setup.py install --prefix=~/modules/
}}}

Usage
{{{
import sys,os
home=os.getenv('HOME')
genpath=home+'/modules/lib/python2.4/site-packages/'
if not sys.path.__contains__(genpath):
    sys.path.append(genpath)
from seawater import *
}}}
Line 36: Line 133:

A basic system for scientific computing consists of Python, ipython, numpy/scipy, pylab, and an editor of your choice
Line 40: Line 139:
 * [[http://sourceforge.net/projects/matplotlib|Matplotlib]]
 * [[http://www.crimsoneditor.com/| Editor]]
 * [[http://matplotlib.sourceforge.net/|Matplotlib/pylab]]
 * [[http://www.crimsoneditor.com/| Editor]] (a nice editor for Windows user, if you don't like to install xemacs)

The [[http://www.pythonxy.com/foreword.php|python(x,y)]] distribution contains all that above.

Scientific Programming with Python

Documentation

Modules for Scientific Computing and Visualization

SciPy/NumPy

pylab

To enable Basemap (on ZMAW Linux ia32/x64 and solaris10) you have to type before starting Python2.4.4:

module load Python/2.4.4

or to start Python2.6.2 (recommended):

module load R/2.7.0
module load Python/2.6.2

In Python you can import the Basemap module by

from mpl_toolkits.basemap import Basemap

GDAL

To enable GDAL use

module load gdal

from osgeo import gdal

PyNGL PyNio

To enable PyNGL (on ZMAW Linux ia32/x64 and solaris10) you have to type

module load PyNGL/1.2.0

Please note, that Nio should be on the top of the list, e.g.

import Nio
from osgeo import gdal
import pylab as pl

Python Interface to GrADS

RPy

F2PY: Fortran to Python interface generator

Calling Fortran code from python is easy! Create a file hello.f:

C File hello.f
      subroutine foo (a)
      integer a
      print*, "Hello from Fortran!"
      print*, "a=",a
      end

Run f2py -c -m hello hello.f

Now in IPython try:

In [1]: import hello
In [2]: hello.foo(4)
 Hello from Fortran!
 a=           4

Example taken from

Topical Modules

More topical software can be found at http://scipy.org/Topical_Software

Installation in the home directory

The seawater module is installed on the ZMAW machines for Python 2.6. Use

module load Python/2.6.2

to set up the environment. In the following it is explained how to install the module for the case if it would be not available or if a different version of python has to be used.

Installation of module seawater in directory ~/modules

python setup.py install --prefix=~/modules/

Usage

import sys,os
home=os.getenv('HOME')
genpath=home+'/modules/lib/python2.4/site-packages/'
if not sys.path.__contains__(genpath):
    sys.path.append(genpath)
from seawater import *

Download

A basic system for scientific computing consists of Python, ipython, numpy/scipy, pylab, and an editor of your choice

The python(x,y) distribution contains all that above.

LehreWiki: Python/Links (last edited 2009-11-25 14:07:56 by anonymous)