Ubuntu comes with Python already installed, but there are a number of packages that need to be added in order to make Python a power tool for atmospheric and oceanic sciences (AOS) users.
The Easy Way
The easiest way is to install the Enthought Python Distribution (EPD), which bundles Python with over 75 modules and packages in an easy to install package. The distribution is free to employees and students of academic institutions, as is the trial version which is fully functional for 30 days. Commercial users have to pay money.
The Almost as Easy Way
Although EPD is one-stop shopping, you might find it preferable to use a package manager like apt-get, Synaptic, or aptitude to install Python and your desired packages. This way, you can use your Ubuntu package manager to access updates and manage your software. Also, since you won’t be downloading packages you aren’t interested in, it may install faster.
Your Core Installation
So what packages should you have? Of course, this depends upon what your needs are. Most AOS users will be fine starting out with a core set of numerical packages, a visualization suite, a input/output routines with core scientific data formats, and the ability to interface with Fortran. There are many packages (see the Packages pages for a more complete list) one can use to accomplish all these tasks, but here’s one set that works pretty well:
- The Python 2.5 interpreter: You can also use Python 2.6, but my own experience is that more of the packages I’m interested in are available for 2.5
- Matplotlib: A powerful 2-D plotting package
- Basemap: Map projection routines that work with matplotlib
- NumPy: The standards array processing package for Python
- SciPy: A robust suite of numerical functions
- PyTables: A very powerful dataset manager that includes routines for HDF access
- Scientific: One of the earlier scientific computing packages, but I like its netCDF interface
- f2py: Enables you to access Fortran routines and memory space, from Python
The following command-line sequence will install the packages needed for nearly all those functions (the first line updates the entries in the package manager’s listing files):
sudo aptitude update
sudo aptitude install python25
sudo aptitude install python-matplotlib
sudo aptitude install python-scipy
sudo aptitude install python-tables
sudo aptitude install python-scientific
Installing SciPy automatically gives you NumPy. And NumPy automatically includes f2py. The only package missing is the Basemap toolkit; unfortunately, you have to install that manually. You can download Basemap from the list of matplotlib toolkits. See the instructions in the User’s Guide as to how to install the package.
Here are some other packages which, while not required to do the tasks described above, nonetheless help complete my scientific computing environment:
- build-essential: An informational list to help when building packages
- gfortran: A Fortran compiler
- GNU Make: The standard make utility
- ntp: A network time protocol manager (I like my system time to be correct)
- texlive: A TeX/LaTeX distribution
And here is the command-line sequence using aptitude that installed them:
sudo aptitude update
sudo aptitude install build-essential
sudo aptitude install gfortran
sudo aptitude install gmake
sudo aptitude install ntp
sudo aptitude install texlive
Fine-Tuning Your Installation
Very quickly, you will find you will want the ability to access a number of AOS-focused routines that are not available in SciPy. We provide a list of these AOS-focused packages, with links, in the Packages section. None of these packages, however, are installable using the standard Ubuntu package managers; you will have to go to the site for each package, download the tarball (or other file that the package comes in), and follow the installation instructions. Here are a few general considerations:
- Climate Data Analysis Tools (CDAT): For AOS users, this is an extremely powerful package of routines tailored for climate analysis. Need anomalies? Bang! No sweat. The package, however, is quite large, and in its recommended form, is installed into its own copy of Python. This makes it more difficult for you to use CDAT along with packages you may have installed into other copies of Python. CdatLite is one way around this issue: Being a subset of CDAT, it is smaller and easier to integrate into an existing Python setup.
- PyNGL: Matplotlib is a great plotting package, but you may find you need the AOS-specialized routines found in the NCAR Graphics Language. PyNGL then is for you.
- PyNIO: Have to read/write a GRIB file? PyNIO is what you need. It also handles netCDF and HDF.