Lab – Intro to Linux, Emacs, and Python

With this lab, we will make our first foray into programming with Python.  This will require you to log into the Room 1411 computers and to  develop some facility with a text editor and with the Linux command line. Please carefully read  “intro to lab computers” before class, if possible! Because of the size of the class, we will have to pair students up on the computers. I’m not particularly concerned at this point about how you divide up the labor — ideally, each of you should get some direct hands-on experience in class with editing and running the python program, but this will have to be while logged in under one student’s account.  I suggest that you work together to get a working copy of the program going; then print out a copy of the program for the other student to manually enter and run under their own account between now and next Friday. Here are additional resources that will (or may) be useful for this lab.  I will explain these in class.
  • Emacs cheat sheet (will be provided in paper form)
  • October 5, 2012 rooftop sounding (please download to your working directory).
  • Miscellaneous Python resources (for possible reference)
  • Lab exercise – I will walk through the following steps in class
    • view structure of sounding file
    • create new Python file in Emacs (“”)
    • import matplotlib and numpy
    • define input filename
    • open file for reading
    • skip first N lines
    • read in the rest of the lines
    • close the file
    • define empty lists to hold pressure, temperature, and dewpoint
    • set up a loop to extract the above variables into their respective lists
    • make and display the simplest possible plot
    • add axis labels
    • make y-axis semi-log
    • specify the axis min,max values
    • define your name
    • create a plot title
    • add isobars
    • add isotherms
    • change color and style of isobars and isotherms
    • save plot to file, print, and turn in
  • A plot implementing the above features and displaying YOUR name in the title of the plot.
  • Your Python source code.