# 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)
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||Intro to the class|
|2||Variables and Operations|
|4||Dictionaries, program loops (if, while and for)|
|5||functions and modules|
|6||NumPy and matplotlib||seismic record|
|8||file systems and paths|
|9||Pandas, file I/O||P-S wave arrival times|
|10||object oriented programming||objects and classes|
|11||recursions and exceptions||fibonacci spiral|
|12||lambda, map, filter reduce, list comprehension|
|13||data wrangling with Pandas||seismic travel time plots|
|14||subplots, bar charts pie charts||elemental abundances|
|15||histograms and cumulative distribution functions||hypsometric curve|
|16||statistics 101||Univariate data|
|17||hypothesis testing t, F|
|18||application to grain sizes||grain sizes|
|19||line and curve fitting||Bivariate data & Hubble plot|
|20||maps||spatial data; earthquake locations/ depths|
|21||gridding and contouring||IGRF|
|22||rose diagrams and equal area projections||glacial striations|
|23||matrix math - dot and cross products||poles to planes and more|
|24||plotting great and small circles|
|25||3D plots of points and surfaces||benioff zone|
|26||Time series - periodograms||temporal data|
|27||Animations||Indian plate motion|
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.