Note: These instructions assume that you are going to install the courseware for use on your own computer. If you are using the courseware as part of a course using Principles of Planetary Climate, your instructor has the option of setting up all the courseware and datasets on a shared server which can be accessed via any web browser, in which case the following information is optional. Instructions for how to set up a server to provide Python for students via a network connection can be found here.
Data Sets
Many of the problems make use of data sets arising from various kinds of observations. These are all in plain text format, and can be read in and used with virtually any graphical or analysis software, though depending on the versatility of your program you might need to make some minor changes with a text editor (e.g. removing header information) before reading in the data.
A tar file of the complete collection of datasets is here. Alternately, you can browse and download individual data files from your web browser here.
Python
If you are going to use the Python courseware instead of rolling your own in some other language (e.g. MATLAB), you will first need a suitable Python installation. A Python installation consists of a Python language interpreter (which translates the Python language commands into instructions telling your computer what to do), plus various add-on packages that give Python the functionality needed for your particular purpose. The main add-on packages needed to run the Planetary Climate courseware are a package for efficiently handling mathematical operations on arrays and matrices (called numpy
), and some means of displaying graphics. The courseware can work with a number of different graphics packages (currently MatPlotLib
and Ngl
) , but if it doesn't find a suitable graphics package it will still run, and you can always write your results out to a file and plot them up using your favorite software. In addition, it is useful to have an editor which is customized to work with the Python language, and which allows you to run your script of Python commands from within the editor. All Mac OSX and almost all Linux operating systems come with a basic Python installation that at least includes numpy
, though generally not graphics. However, it is strongly recommended that you install your own version of Python so that it is up-to-date, and also so that it can be customized without affecting whatever version of Python your operating system may be using to perform its tasks. Python can be installed on Mac OS X, any version of Linux, and on most versions of the Windows operating system, and will work the same way on all platforms, so far as the user is concerned. The courseware was originally designed to work with Python 2.7, but will work with some earlier versions as well. There is a newer version of Python under development, Python 3.x , which is not entirely backward compatible with Python 2.x , but apart from a minor change in the use of the print statement, the incompatibilities will not be evident to most users. An effort has been made to assure that the courseware will work under Python 3 as well as under Python 2.7, but there may still be a few lines that need updating.
It is possible to create your own installation by first installing Python, and then adding in the packages you need one-by-one. However, there is at present no reason to do that, since both Anaconda and Enthought provide free Python distributions which includes all the functionality needed to run the courseware. They include both numpy,
and the MatPlotLib
graphics package, and install on Mac or Windows with a single click, and can be installed with similar ease on any Linux system.
Enthought comes packaged with a very nice integrated editor and development system, known as Canopy, but most users of the courseware will interact with Python either via the iPython command line or (more likely) the web-browser based notebook interface. Integrated development environments are of most use to developers of complex software.
So, the first thing you need to do is to download Anaconda or Canopy Express for your operating system and install it. Canopy Express is free for all users, as is Anaconda. Academic users can get a free download of a more extensive Enthought Python distribution under their Academic License program, but Canopy Express has everything you need to run the courseware. The Enthought distributions are all limited to Python 2.7 at present, but Anaconda supports both Python 2.7 and Python 3. The distribution comes in both 32-bit and 64-bit versions. As far as the courseware is concerned, it doesn't matter which you pick. You only need to be aware of which version you are using when installing additional add-on packages on top of the distribution, since any add-on packages must have a compatible version (i.e. if you have a 64-bit installation, you need to install 64-bit add-ons). Unless you have a strong reason for using the 32-bit version, it is recommended that you install the 64-bit version.
Once you have installed one of the Python distributions, you are ready to go on to the installation of the courseware, but first you should pause, start up Python, and play around with the language for a bit. Some suggestions for getting started with learning Python are found here. In particular, before going further, you should read the sections telling you about the various ways to start up Python and enter commands.
Courseware in Python
Although I recommend using Python as the basis of the course, virtually all of the Workbook problems requiring computation can be done using any programming language of your choice, once the basic skills in the Computational Toolkit problems in the Chapter 1 Workbook are mastered in the language you are using. In fact, many of the problems can be done using a good graphing calculator, or perhaps a spreadsheet, though of course serious students should learn a real programming language. The main things that would take a fair amount of work to duplicate in other languages are the homebrew real-gas radiation code introduced in Chapter 4, and the user-friendly Python interface to the compiled NCAR CCM radiation code (climt_lite
) .
A tarfile of the complete set of courseware in Python is available here, or you can access files individually via the Courseware portal.
Here's where you should put things:
- CoursewareModules contains scripts supporting general physical, numerical and data access functions of general use. These are straight Python scripts, and do not require any compilation; they will run in any Python interpreter. These are not meant to be modified. They are used by the ChapterScripts, and serve as building blocks for calculations done in the course of solving the Workbook problems. The contents of this directory should be put in a place which is in the search path Python uses to look for modules to import. The courseware modules include a utility,
setpath.py
, for automating the process of setting the search paths so that the contents of your courseware module dirctory can be found. The use of this utility is explained here . - climt_lite provides access to the NCAR CCM radiation code from Python. This one is a bit tricker, since it involves compiled Fortran code rather than just straight Python. Currently, you will need to build it yourself if you want to use it, though in the future I hope to provide pre-compiled binaries, at least for Mac OSX. Most of the problems can be done without climt_lite, but it is nice to have, especially if you want to recreate all the CCM radiation calculations in the book.
Instructions for building climt_lite are given here. Once built, the directory containing the climt module should be moved to the same directory where you put the courseware modules. Like the courseware modules, it needs to be in the search path used by Python to find modules to import.
- ChapterScripts Each student should have their own personal copies of these. They are meant to be customized and modified. They get put in the users home directory. There are a few chapter scripts (notably ccmradFunctions.py and the homebrew radiation models miniClimt.py and miniClimtFancy.py) that are used in several chapters, and to make them available you will either need to put a copy in each directory that uses them, or put an extra copy in the same directory that the contents of CoursewareModules lives in.