Overview
Here you will find the set of Python scripts I have written for use with the text, along with instructions for installation and a guide to usage. These scripts are used in the Workbook problems, they allow the reader to reproduce essentially all the calculations and figures in the text, and they provide a basic toolkit for original research. Before delving into this material, you should first take care of a basic Python installation and obtain some familiarity with the language
For an quick summary of what you need, see Quick Start. For experts, Quick Start may be sufficient. The material below covers the same territory in more detail. A tarfile of the complete collection of courseware is here. Eventually I will also provide access to a cvs repository on sourceforge or some similar server.
The most recent courseware update was July 11, 2011.
Courseware Modules
These are utilities used throughout the courseware. They should be put in a search path where Python can find them regardless of which directory you are working from. See the Quick Start page for some notes on how to do that, or the Python portal page for a somewhat more extensive discussion of where Python looks for modules. These courseweare modules are not really meant to be modified by the student, but one can always make a personal copy and customize if desired. Wherever they are put, the student will be able to read them and see how they work. Freedom to Tinker Rules!
Example scripts illustrating the use of the courseware modules are found here.
- ClimateUtilities.py : This is the universally needed handy collection of utilities used throughout the courseware. It provides support for reading and writing files, data manipulation, plotting, and numerical analysis.
- ClimateGraphics.py : This is imported by ClimateUtilities.py. It contains the actual plot functions, which in this version is set up to use PyNgl. If you are using a different graphics package to make plots, this is the only module you need to customize. MatPlotLib graphics is supported by the version below. See the Python Python Graphics page for details.
- ClimateGraphicsMPL.py : This version of ClimateGraphics uses MatPlotLib instead of PyNgl to produce graphics. It is imported automatically if PyNgl is not found on your system, and the rest of your scripts will work without any modifications. If you have both PyNgl and MatPlotLib on your system, but prefer to use MatPlotLib, just delete ClimateGraphics.py from your installation (or edit the import statement at the top of ClimateUtilities). See the Python Graphics page for details.
- DummyGraphics.py : This allows the Chapter scripts to be run without modification on systems for which no graphics implementation can be found.
- phys.py : Contains physical constants, properties of gases, and functions needed to compute physical properties (e.g. saturation vapor pressure or moist adiabats)
- planets.py : Contains characteristics of Solar System objects, including all planets and selected satellites. (the Sun isn't yet in there, but I will put it there eventually).
- CliMT_lite: This is the Python interface to the NCAR CCM radiation module. This link is to an entire directory, and if you want this, it is more convenient to just get it from the tarfile of courseware linked above. This is the only utility that needs to be compiled. You will need a Fortran compiler (gfortran works fine) and PyFort (which comes with the numpy distribution). Follow the instructions in the directory for building this. It builds easily on Linux or Mac OSX. CliMT is not currently supported on Windows, but it would probably be possible to get it working there (please let me know if you do). CliMT and CliMT_lite were developed by Rodrigo Caballero. His own site for this project is here . The main project site describes the comprehensive version of CliMT; CliMT_lite is a stripped-down simplifed version providing access to just the radiation model. General hints on the installation of CliMT_lite, including gfortran tips, are found [**HERE**]. A pre-built 32 bit version of CliMT_lite for Intel Macs under OS 10.5 and higher is found here. All you need to do is download the file, untar it, and then drag two folders to the appropriate places, as described in the README.txt file .
Chapter Scripts
Each student should have a personal copy of these, in their own home directory. They are meant to be run and modified, to reproduce figures in the text, for further explorations, and for aid in doing the Workbook problems. There are a few Chapter Scripts that are used by chapter scripts in other chapter directories, and you will need to do something to make those available (see the Quick Start page for now). Some chapter scripts access data in the Workbook Datasets. The datapath variable in such scripts needs to be customized to specify where the datasets reside on the system you are using.
Documentation of what each script does is found in the comments embedded in the scripts, and the use of many of these scripts is described in the Workbook problems that need them. Eventually I will provide a comprehensive list of the scripts, their usage, and the figures (and other results) in the text which they were used to produce, as a complement to information of this sort that is already embedded in the individual scripts.