Simple Climate Model

Bodeker Scientific has developed a Simple Climate Model written in Python. This Simple Climate Model takes emissions of radiatively active gases (usually referred to as greenhouse gases, GHGs) as input and converts them into concentrations. Changes in radiative forcing are then calculated from these changes in atmospheric GHG concentrations. The climate response, e.g. global mean temperature change and resulting changes in global mean sea level, can then be derived from the changes in radiative forcing. A detailed description of the Simple Climate Model can be found here:

Importing software

Running the Simple Climate Model requires the installation of Python, including several modules. You can run the Simple Climate Model from the python command line and we describe how to do that below. However, we recommend that you install an IDE (integrated development environment) for Python that will allow you to step through the code and to debug the code line by line if required. Having Eclipse (or any other IDE) installed really helps you to understand every line of the code and what the model does. It is also fun to play with, so follow the instructions below, get the Simple Climate Model running and have fun creating your own scenarios.

Python 2.7

We suggest downloading and using version 2.7 of Python.

Linux

To check if Python is already installed and, if so, what the default version is, type:

python -V

If you do not have Python installed type:

sudo apt-get install python2.7

In addition to Python, you will need numpy and matplotlib. To install these two packages type:

sudo apt-get install python-numpy python-matplotlib

Windows

If you do not have Python installed on your computer you can get the installer from:


Click on the link that says: Latest Python 2 Release-Python 2.7.6

In addition you will need numpy and matplotlib. Install these from the following links (choose the one at the top where it says: "Looking for the latest version?
Matplotlib (matplotlib-1.3.1.win32-py2.7.exe) can be found here:

Running the Simple Climate Model from the command line

Before you even think about reading further, PLEASE have a look at the documentation of the code as this will describe the required input files and format. DO NOT continue to read if you don't know what 'Parameter file' means and how it looks. So please go to the documentation web-page and have a careful read:


So now you know what input is required? Then start python (command line) and type the following:

run python
>>> import sys
>>> sys.path.append("PathWhereTheSimpleClimateModelIsLocated")
>>>  import SimpleClimateModel as SCM
# create the simple climate model and remember that all parameters and emissions will be read from file
>>> Model = SCM.SimpleClimateModel("SimpleClimateModelParameterFile.txt")
# run the Simple Climate Model - change in temperature and sea level will be saved to file by default
>>> Model.runModel()
# save optional output to file
>>> Model.saveOutput()

Python IDE

We recommend that you download an IDE so that you can step through the code and debug your code if required. There are a number of IDEs out there, e.g. Spyder, PyScripter, Eclipse etc. and it is your choice which you would like to work with. We are using Eclipse together with PyDev. If you decide to use Eclipse please follow ALL the instructions given below. You can download Eclipse here:


Note: Eclipse requires that you also have Java installed. If you do not have Java installed you can find the installation file here: http://www.java.com/en/download/manual.jsp

To get Eclipse working with Python you need to install the PyDev Plugin which is an open source project. Install PyDev via the Eclipse update manager:
 
run Eclipse
    Help > Install New Software 
    click on add and type:
        Name: PyDev
        Location: http://pydev.org/updates 
        click 'OK'
    Select what you want to install and click 'Next'
    Finally, read the license agreement and if you accept, select the accept button and click 'Finish'

A more detailed description of how to install the PyDev Plugin can be found here:


After you have installed the PyDev Plugin you have to restart Eclipse. To use the PyDev Plugin and to create a python project within Eclipse, you need to configure Eclipse which is described here (in Section 2.3):


A short introduction to Python programming in Eclipse can be found here:

Simple Climate Model - download source code

A detailed description of the source code can be found here:

Linux

The pip command is a tool for installing and managing Python packages and is a replacement for easy_install. If you do not have pip installed type:

sudo easy_install pip

To download the python code for the Simple Climate Model use pip and type:

sudo pip install pySCM

This will download the package for the Simple Climate Model and save it under:  /usr/local/lib/python2.7/dist-packages/pySCM/

Alternatively, you can download the Simple Climate Model package from:


Windows

You can download the package containing the source code and required input files from:

https://pypi.python.org/pypi/pySCM

Import Simple Climate Model package into Eclipse

To import your pySCM package into Eclipse go to:

File > Import > Existing Projects into Workspace 

Then, provide the path where the pySCM package is located and press "Finish". Now you should be in business and able to run the Simple Climate Model.

If you have any problem or questions regarding installing and running the Simple Climate Model, please contact: stefanie (at) bodekerscientific.com.