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.


In [3]:
soundingfile = './data/Sounding_Payerne_20140724_00'
mysounding = get_sounding(soundingfile)

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().


In [4]:
mysounding?

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.


In [15]:
plot_skew_T(mysounding)


Out[15]:
<matplotlib.axes.AxesSubplot at 0x571d1d0>

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]:
Image(filename='./figures/sat_24_july_2014_00utc.png')


Out[4]:

In [7]:
plot_skew_T(mysounding,T_surf=24,qv_surf=13)


Out[7]:
<matplotlib.axes.AxesSubplot at 0x3bedb50>

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?


In [8]:
Image(filename='./figures/radar_sum_24_july_2014_12utc.png')


Out[8]: