# Pay no attention to this cell # All will be revealed in due time. import pandas as pd from IPython.display import Image syllabus=pd.read_csv('syllabus.csv',header=0) syllabus=syllabus.fillna("") syllabus.index = range(1,len(syllabus)+1)
Authors: Lisa Tauxe, firstname.lastname@example.org & Hanna Asefaw, email@example.com
Computers are essential to all modern Earth Science research. We use them for compiling and analyzing data, preparing illustrations like maps or data plots, writing manuscripts, and so on. In this class, you will learn to write computer programs with special applications useful to Earth Scientists. We will learn Python, an object-oriented programming language, and use jupyter notebooks to write our Python programs.
So, why learn Python?
|1||1/8/18||Intro to the class|
|2||1/10/18||Variables and Operations|
|4||1/17/18||Dictionaries, program loops (if, while and for)|
|5||1/19/18||functions and modules||HW 1 due|
|6||1/22/18||NumPy and matplotlib||seismic record|
|8||1/26/18||file systems and paths||HW 2 due|
|9||1/29/18||Pandas, file I/O||P-S wave arrival times|
|10||1/31/18||object oriented programming||objects and classes|
|11||2/2/18||recursions and exceptions||fibonacci spiral||HW 3 due|
|12||2/5/18||lambda, map, filter reduce, list comprehension|
|13||2/7/18||data wrangling with Pandas||seismic travel time plots|
|14||2/9/18||subplots, bar charts pie charts||elemental abundances||HW 4 due|
|15||2/12/18||histograms and cumulative distribution functions||hypsometric curve|
|16||2/14/18||statistics 101||Univariate data|
|17||2/16/18||hypothesis testing t, F||HW 5 and project proposal due|
|18||2/21/18||application to grain sizes||grain sizes|
|19||2/23/18||line and curve fitting||Bivariate data & Hubble plot||HW 6 due|
|20||2/26/18||maps||spatial data; earthquake locations/ depths|
|21||2/28/18||gridding and contouring||IGRF|
|22||3/2/18||rose diagrams and equal area projections||glacial striations||HW 7 due|
|23||3/5/18||matrix math - dot and cross products||poles to planes and more|
|24||3/7/18||plotting great and small circles|
|25||3/9/18||3D plots of points and surfaces||benioff zone||HW 8 due|
|26||3/12/18||Time series - periodograms||temporal data|
|27||3/13/18||Student Presentations (Pt I)|
|28||3/14/18||Animations||Indian plate motion|
|29||3/16/18||Student Presentations (Pt II)||HW 9 due|
|30||3/23/118||Final projects due|
This class is entirely structured around a special programming environment called jupyter notebooks. A Jupyter notebook is a development environment where you can write, debug, and execute your programs. Put all the lectures and other directories associated with this class into a folder on your computer. To launch a notebook, follow the instructions on this website:
You should now be looking at this notebook.
Jupyter notebooks have two basic cells:
Markdown: for typesetting notes. This cell is an example of a markdown cell.
Code: for writing python code
You can insert a new cell by selecting Insert Cell Below in the drop-down menu:
You change the cell "flavor" with the menu that defaults to 'Code' and can be changed to "Markdown".
And you "execute" a cell (either typeset or run the code) by clicking on the run key (sideways triangle with vertical line) or select Run Cells under the Cell drop-down menu.
Insert a cell below this one. Change it to ‘Markdown’ and type some notes. You can just type most things, but special features like Section headers, bullets, numbered lists and other fun things require special formatting. For a pretty good explanation see this link: https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet
Run the cell to typeset your notes. If you want to change them, just double click on the cell, type away, then 'run' it again.
If you see plain text in one of the cells in the lecture notebooks, just double click on it and all will be revealed. Try double clicking on THIS cell to see how to make section headers - then run it.
Insert another cell, keeping it the default of Code.
type: print("Hello World") in the cell and then run that cell.
It should look like this:
print ("Hello World")
Congratulations! That was your first Python program.
In a code block, you can only type valid python statements EXCEPT
after a pound sign - everything after that will be ignored.
That is how you write "comments" in your code to remind yourself or tell others what you were thinking:
# I can type anything here but not here
File "<ipython-input-6-ae00b29ef7b9>", line 2 but not here ^ SyntaxError: invalid syntax
That was an example of a bug which oculd be fixed by commenting out the second line, or making it a valid statement:
# I can type anything here # but not here print ("but not here")
but not here
Now you know how to insert a markdown cell and write in it, you should take advantage of these notebooks to add your own comments to the lecture notebook as you go. You could even have a separate notebook open in another window in which you can type notes. For that, you need to know how to create your own notebook and save it. And it would be handy to know how to split your screen to have two side by side notebooks.
To open a new notebook, pull down the 'File' menu and select the 'New Notebook => Python 3' option. You can 'tear' the notebook off so it is in a separate window if you like seeing both together.
To rename the notebook, choose 'Rename' under the File menu.
To save it, click on the disk icon on the menu bar. Wait until the 'checkpoint created...' message disappears before you try to exit the notebook.
Click on the green button in the top left corner of your browser and drag it to the side you want your lecture in. Click your "notes" notebook and it will be placed on the other side.
We will learn much more about markdown and code blocks in the coming weeks as you begin to understand how to write programs.
Open a new notebook, rename it to, for example, 'Lecture_01_notes', split your screen if you like, make a Markdown cell, write some notes, and save the file. Now look in your folder and see your brand new notebook!
As you learn new concepts, start thinking about what you'd like to create for your final project.
There is a great deal of flexibility on the exact nature of the final project but it must be related to Earth and Space Science and, at the bare minimum, it must:
Turn the project in as a zipped directory with all the parts required to run it (the data files, figures, modules, etc.).
Here are a few ideas:
1) Make a movie:
2) Make a 2D image of the solar system with orbiting planets
3) Recreate your favorite plot from a number of examples
4) Design your own project:
In Week 6, you will be asked to turn in a proposal for the final project. In the proposal, you'll describe the final project and how it relates to Earth and Space Science. At that stage, you still may not have all the skills required to complete your project, but we can let you know if it is possible and substantial enough for the final project.