Getting familiar with the iPython Notebook environment

The aim of this exercise is to get familiar with the interactive iPython Notebook environment. First we will load some ready-made functions. You do this by executing the cell below.

In [1]:
# '%pylab inline' tells the iPython Notebook to show all the figures inline, instead off opening a pop-up window for each fig 
%pylab inline   
from some_functions import *
from IPython.core.display import Image

Populating the interactive namespace from numpy and matplotlib

Now we are going to explore the weather situation in Switzerland on the 24th of July 2014.

a) Use the function get_sounding() to read the sounding of Payerne (CH) on the 24th of July 2014 at 00 UTC. You find the file containing the sounding data in one of the subdirectories.

b) What is the type of the object returned by the function get_sounding()? You can explore any object by typing the name of it followed by a question mark and executing the cell. Insert a new cell below and find out the type of the object returned by the function get_sounding().

c) As you found out, "sounding" has type 'dictionary' (dict). You will learn more about this datatype later. The "sounding" dictionary contains the different variables of the sounding. We can pass this object to the function plot_skew_T to create a plot of our sounding. Make a plot of the sounding.

c) You are a weather forecaster during the night shift and have to make a forecast for the morning on the 24th of July. Unfortunately last nights COSMO model run crashed with a segmentation fault, so you have no model output available.

All you have is the sounding and a satellite image of 00 UTC (below) showing clear skies over Northern Switzerland. The function plot_skew_T() takes by default the surface values of temperature and specific humidity in order to calculate the CAPE. However, it is also possible to specify a certain temperature (T) and humidity (Td) for the surface parcel. This option is very useful now, because it allows you to estimate the value of CAPE after some diurnal heating. At 00 UTC the surface mixing ratio (qv_surf) was about 12 g/kg. Assume that the surface moisture increases by about 10% due to daytime heating. Try out different values for the temperature. What CAPE values do you expect around noon? What would your weather prediction be for the Northern part of Switzerland at this time?

In [4]:


d) Use the Image() function to display an image of the summed precipitation derived from radar data during the morning of the 24th of July 2014, you will find it in one of the subdirectories. How good was your forecast?

e) Now we will plot the actual Payerne sounding at the 24th of July at 12 UTC. With the function get_sounding() it is also possible to load a sounding file from the internet (University of Wyoming website). Simply pass the URL as a string to the function. Make use of the function create_sounding_url() to build the url from a given date, time and station number. Plot the actual sounding for the 24th of July 2014 at 12 UTC. What is the value of CAPE? How does this compare to your estimate made in question c ?

f) The strong rainfall led to flooding of the river Emme with lots of damage as a consequence. You want to further investigate this situation from a climatological perspective. How often do we have this unstable atmosphere with a very weak background flow? As a part of this project, you need to load all the soundings from 1970 untill now using the function get_sounding(). About how long would this take? (hint: use one of the magic functions; all the magic functions start with %)

(bonus) Plot last nights sounding of Payerne. Is there any CAPE?