Python-for-Earth-Science-Students

Python for Earth Science Students

Authors: Lisa Tauxe, ltauxe@ucsd.edu & Hanna Asefaw, hasefaw@ucsd.edu

Computers in Earth Science

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 of manuscripts and so on. In this class you will learn computer programming with special applications useful to Earth Sciences. We will learn Python, an object-oriented programming language.

Python

So why Python?

  • Flexible, freely available, cross platform
  • Easier to learn than many other languages
  • It has many numerical, statistical and visualization packages
  • It is well supported and has lots of online documentation
  • The name 'Python' refers to 'Monty Python' - not the snake and many examples in Python documentation use jokes from the old Monty Python skits. If you have never heard of Monty Python, look it up on youtube; you are in for a treat.

Which Python?

  • Python is undergoing a transition from 2.7 to 3. The notebooks in this course, apart from a few exceptions, are compatible with both.
  • If you are not using the university computers for this class, we recommend that you install the most recent version of Anaconda python for your operating system : https://www.anaconda.com/download/

Notebooks

syllabus[['Topic','Application']]
<style> .dataframe thead tr:only-child th { text-align: right; }
.dataframe thead th {
    text-align: left;
}

.dataframe tbody tr th {
    vertical-align: top;
}
</style>
Number Topic Application
1 Intro to the course
2 Variables and Operations
3 Data structures
4 Dictionaries, program loops (if, while and for)
5 functions and modules
6 NumPy and matplotlib seismic records
7 NumPy arrays
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

Jupyter notebooks

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 package into a directory on your computer. To launch a notebook, follow the instructions on this website:

jupyter-notebook-beginner-guide.readthedocs.io/en/latest/execute.html

Launch Lecture_01_syllabus.ipynb

You should now be looking at the first notebook - read through it and do the practices. Then, you can try the other notebooks. They are meant to be read in order.