Lab – Intro to Python
With this lab, we will make our first foray into programming with Python. This will require you to either:
- log into the Room 1411 computers under the Linux operating system, OR
- install the free Miniconda distribution of Python on your own laptop. Be sure to get version 2.7, not 3.5!
I strongly recommend installing a Python distribution on your own laptop for two reasons:
(1) it will allow you to work with Python anywhere, not just in 1411, and
(2) it will free up computers in 1411 for those who cannot install Python on their own laptop for any reason (e.g., they don’t have one).
Pete or I can help, if needed, with installing Miniconda on your laptop.
Depending on the size of the class and how many use their own laptops, we may have to pair students up on the computers. If so, 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 be necessary or useful for this lab.
- A handout on getting started using Linux and Jupyter notebook on lab computers.
- A ‘template’ IPYNB file that you will fill in with executable code in jupyter notebook.
- September 27, 2013 rooftop sounding (please download to your working directory)
- .– OPTIONAL RESOURCES —
- Alex DeCaria’s book Python Programming and Visualization for Scientists. See me if you want to buy a copy for approximately $30.85 (incl. tax).
- Getting started with jupyter notebook
- Python 2.7 quick reference sheet
- Nice intro to simple plotting
- Alex DeCaria’s course notes for Python
- Python tutorial (2.7)
- Python language reference (2.7)
I or the TA will walk through the following steps in class
- View the structure of the sounding file using a suitable a text editor such as emacs or gedit.
- Start jupyter notebook in a browser.
- Load and rename the template notebook file
- Insert executable python code following the commented instructions in the notebook file.
- Print out and turn in two plots.