Despite the continued prevalence of Fortran, C, IDL, and MatLab in our field, the Python language is rapidly gaining in popularity
as a general purpose scientific programming and plotting language. It is easy to learn, it is modern, it is powerful (especially with the huge variety of add-on modules available), and best of all, it is free!
Here’s a detailed overview
of many of the strengths of Python.
Macintosh or Linux
Python comes stock on just about any Unix/Linux/Mac OS X system. BUT that bare bones version won’t be all that useful without the add-on modules matplotlib, numpy, and similar packages. To get these and many other extremely useful modules, it’s easiest to do ONE of the following:
- Install the complete Enthought python distribution (EPD) called Canopy, which is free to academic users. You’ll need to click on the blue “Request your license” button the right to register as an academic user. OR,
- Install the completely free (including to non-academic users) Anaconda distribution.
Once the latter is installed, you’ll need to make sure your PATH variable is set up in you .cshrc, .tcshrc, .bashrc, or .profile file to find the correct (newly installed) version before it finds the stock /usr/bin version. To check whether this fix is necessary, type
The output from the ‘which’ command will probably look like one of the following:
|Linux or Mac OS X
|Linux (1411 labs)
|Mac OS X
(the above has not yet been updated for the Anaconda distribution!)
If you don’t see something like the correct result for your system, please let me know. I can either help you configure your computer to “see” the right version of Python, or I can update the above information, if needed.
Windows doesn’t come with a stock version of Python, so all you need to do is install the Enthought/Canopy distribution, and you should be set.
Python language and library REFERENCES
Apps (iPad, iPhone, iPod)
PYTHON Modules and packages
- Scientific tools for Python (SciPy)
- Download complete Enthought distribution (numerous modules) for scientific programming/plotting from (free for academic users)
- Badly outdated, but large and interesting, list of links to a variety of scientific/mathematical modules. Googling package names of interest might yield up-to-date information.
- A package that handles dimensions and units.
PyNGL and PyNIO
A package developed at NCAR for scientific data analysis and visualization. Read more here
Need more speed out of your numerically intensive Python routines? Consider using cython to automatically convert selected portions of a module to compiled C code with very little effort. Speedup can be enormous (factor of 100 or more in some cases). Read more:
Fortran to Python Interface
(PDF) explains how you can “wrap” Fortran routines so as to access them from a Python program.