Getting you and your laptop ready for ATM 623

For this class we need several different bits and pieces of software. Everything we need is free and should run on Mac, Windows and Linux. Your task is to go through all the following steps and familiarize yourself with all these different tools.

Installing Python software

  • Install Anaconda Python with Python version 3.7
  • Familiarize yourself with the conda package and environment manager that comes with Anaconda Python. Here is a great quick tutorial.
  • Use conda to install other packages we will need:
    • netcdf4 (low-level support for reading data files)
    • xarray (package for working with gridded labeled data)
    • metpy (tools for visualizing meteorological data)
    • cartopy (for drawing maps)
    • climlab (a climate modeling toolkit originally developed especially for this course!)
  • The best way to get all this stuff installed is to use the conda-forge channel:
conda install -c conda-forge climlab

and let conda handle all the dependencies for you.

git version control software

We will be using git to manage changes in our source code. Do the following:

  • Make sure that git is installed on your computer. If you are using Mac or Linux it is probably already there. You can download the software here.
  • What is version control, what is git, and how do you use it? Teach yourself a few basics. There are many tutorials and learning resources on the web. Here is one simple tutorial.

If you encounter problems with any of the above, please first do your best to resolve the problem on your own using online help. Then, when you are stumped, please email me with a detailed description of your problem.

The jupyter notebook

Most of our interactive Python work will happen inside of the so-called Jupyter notebook. The notebook lets you write and execute Python scripts inside a web browser, in a document that combines Python code, graphics, and nicely formatted text. It is a very useful tool for organizing a scientific workflow because the code remains tied to the text descriptions and the actual results.

You can easily create a new notebook by doing this on your command line:

jupyter notebook

Your browser will open with the jupyter console window. Click on the New button and select Python from the drop-down menu. A new empty notebook will open. Play around with entering and running some Python code, such as

num = 1
print 'This is Python program number {}'.format(num)

In the next cell try entering this code:

num += 1
print 'This is Python program number {}'.format(num)

A quick demonstration that variables you define in one cell remain in memory when you execute another cell.

Now select your second cell, hit shift+enter to run it again. What result do you get? Does that make sense?

If you want, you can choose a file name for your new notebook by clicking where it says 'Untitled' at the top of the window.

Lecture notes in jupyter notebook format

For ATM 623 I distribute a complete set of lecture notes in the Jupyter format. We are going to use git to download a complete copy of the notes, and also manage all the changes that will occur during the semester. Do the following from a command line:

  • Move to a directory where you want to keep the notes.
  • type the following:
git clone https://github.com/brian-rose/ClimateModeling_courseware.git
  • This will create a new git repository called ClimateModeling_courseware on your file system. Inside you will find a complete copy of all my notes.
  • Change directories to move inside the ClimateModeling_courseware directory.
  • Create a new branch of the notes! You want to do this so that the master branch of your notes will not be modified from my version. This will make it easy to keep your master branch in sync with all the changes that I will be making to the notes during the semester.
  • On your new branch you'll be able to make changes while you play with the code, and then easily switch back to the original version without losing any information.
  • To do this (should look familiar if you went over a git tutorial):
git branch [whatever name you like]
git checkout [the name you just chose]
  • On your new branch, start up the notes by entering
jupyter notebook