Skip to content

ltauxe/Python-for-Earth-Science-Students

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Programming for Earth Science Students

Authors: Lisa Tauxe, ltauxe@ucsd.edu, Hanna Asefaw, hasefaw@ucs.dedu, & Brendan Cych, bcych@ucsd.edu

Licensing:

Shield: CC BY 4.0

This work is licensed under a Creative Commons Attribution 4.0 International License.

CC BY 4.0

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 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.

Python

So, why learn Python? Because it is:

  • 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 the 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 underwent a transition from 2.7 to 3. The notebooks in this class, apart from a few exceptions, are compatible with both but they have only been tested on Python 3, so that is what you should be using.
  • If you decide to use a personal computer, we recommend that you install the most recent version of Anaconda python for your operating system: https://www.anaconda.com/download/ you will also need a few extra packages (cartopy, version 0.17.0, geoplots, geopandas and a few others) which can be installed with little hassle.

Jupyter notebooks

This course 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.

Clone or download this repository and launch the Jupyter notebook environment.

To do this, you will need to discover the hidden secret of your computer, the Terminal window (or Anaconda Prompt on a PC). This little window provides a command line interface in which you can type commands to the operating system. You can find the terminal window through the program Terminal on a Mac by typing terminal.app into the search icon. If you double click on it, it will open a terminal window. To find it on a PC search for the program anaconda

Once you have launched the jupyter notebook browser, navigate to your course directory and open Lecture_01.ipynb

Lecture 1

  • Learn to find your command line interface.
  • Learn how to launch a Jupyter notebooks from the command line interface
  • Learn basic notebook anatomy.
  • Learn some basic UNIX commands
  • Learn about the concept of PATH
  • Turn in your first practice problem notebook.

Lecture 2

  • Learn about variables
  • Learn about operations

Lecture 3

  • Learn about collections of variables: data structures

  • Learn about objects - Learn about methods which allow you to do things to objects

Lecture 4:

  • Learn more about another useful data structure, dictionaries and some of their methods
  • Introduce special Python code blocks
  • Learn about "for" loops, "while" loops and "if" blocks

Lecture 5:

  • Learn about functions
  • Discover the joys of modules

Lecture 6:

  • get a first peek at the very useful Python packages called NumPy and matplotlib

Lecture 7:

  • Learn more about NumPy and matplotlib
  • Learn more about NumPy arrays.

Lecture 8:

  • more about matplotlib: adding notes and saving images
  • about DataFrames and Series, two new data structures, that are part of the Pandas package
  • some basic filtering tricks with Pandas
  • how to read in and save data files with Pandas

Lecture 9

  • Learn how to filter data with Pandas
  • Write a program to calculate the great circle distances between two known points.
  • Learn how to generate formatted strings for output.

Lecture 10:

  • Learn about "object oriented programming" (OOP)
  • Learn how to create a "class"
  • Learn more about namespaces
  • Learn more about copies

Lecture 11:

  • Learn about lambda functions
  • How to use map( ), filter( ), and reduce( )
  • Explore the joys of List, Set and dictionary comprehension

Lecture 12:

  • Tricks with pandas
  • Filtering
  • concatentating and merging dataframes

Lecture 13:

  • Learn a few more Pandas tricks
  • Learn how to make more complicated plots with matplotlib
  • Learn about the composition of the sun, solar system and Earth.
  • Learn about exceptions in python

Lecture 14:

  • Learn how to plot histograms and cumulative distributions
  • Learn how to get lists of random numbers
  • Learn about the topography of the Earth (hypsometric curve)

Lecture 15:

  • Learn some basic statisics - samples versus populations and empirical versus theorectical distributions.
  • Learn to calculate central tendencies, spreads.
  • Learn about significant figures and more about formatting output.
  • Learn some useful functions in NumPy and SciPy for simulating distributions and calculating statistics.

Lecture 16:

  • Learn how to deal with bivariate data (fitting lines, curves).
  • Apply line fitting to determine the age of the Universe. Cool.

Lecture 17:

  • Learn how to use the seaborn package to produce beautiful plots
  • Learn about kernel density estimates
  • Learn appropriate ways of representing different types of data

Lecture 18:

  • start to make some basic maps using Cartopy. Yippee (we love maps).

Lecture 19:

  • Learn about gridding and contouring with cartopy
  • Learn to find your command line interface.
  • Learn how to launch a Jupyter notebook from the command line interface
  • Learn basic notebook anatomy.
  • Learn some basic python operating system commands
  • Learn about the concept of PATH
  • Turn in your first practice problem notebook.
  • Learn about variables
  • Learn about operations
  • Learn about collections of variables: data structures

  • Learn about objects

  • Learn about methods which allow you to do things to objects

  • Learn more about another useful data structure, dictionaries and some of their methods
  • Introduce special Python code blocks
  • Learn about "for" loops, "while" loops and "if" blocks
  • Learn about functions
  • Discover the joys of modules
  • get a first peek at the very useful Python packages called NumPy and matplotlib
  • Learn more about NumPy and matplotlib
  • Learn more about NumPy arrays.
  • more about matplotlib: adding notes and saving images
  • about DataFrames and Series, two new data structures, that are part of the Pandas package
  • some basic filtering tricks with Pandas
  • how to read in and save data files with Pandas
  • Learn how to filter data with Pandas
  • Write a program to calculate the great circle distances between two known points.
  • Learn how to generate formatted strings for output.
  • Learn about "object oriented programming" (OOP)
  • Learn how to create a "class"
  • Learn more about namespaces
  • Learn more about copies
  • Learn about lambda functions
  • How to use map( ), filter( ), and reduce( )
  • Explore the joys of List, Set and dictionary comprehension
  • Tricks with pandas
  • Filtering
  • concatentating and merging dataframes
  • Learn a few more Pandas tricks
  • Learn how to make more complicated plots with matplotlib
  • Learn about the composition of the sun, solar system and Earth.
  • Learn about exceptions in python
  • Learn how to plot histograms and cumulative distributions
  • Learn how to get lists of random numbers
  • Learn about the topography of the Earth (hypsometric curve)
  • Learn some basic statisics - samples versus populations and empirical versus theorectical distributions.
  • Learn to calculate central tendencies, spreads.
  • Learn about significant figures and more about formatting output.
  • Learn some useful functions in NumPy and SciPy for simulating distributions and calculating statistics.
  • Learn how to deal with bivariate data (fitting lines, curves).
  • Apply line fitting to determine the age of the Universe. Cool.
  • Learn how to use the seaborn package to produce beautiful plots
  • Learn about kernel density estimates
  • Learn appropriate ways of representing different types of data

NB: This lecture may not work properly in the interactive online binder environement. (it requires cartopy==0.17.0 and that is not yet available)

  • start to make some basic maps using Cartopy. Yippee (we love maps).

NB: This lecture may not work properly in the interactive online binder environement. (it requires cartopy==0.17.0 and that is not yet available)

  • Learn about gridding and contouring with cartopy
  • Learn about geoplot and geopandas
  • Learn a bit about coordinate systems (UTM versus WGS84, as examples)
  • Learn something about Hawaiian volcanism
  • We will work with directional data using rose diagrams and stereonets
  • Learn some useful tricks about matrix math.
  • Learn how to plot great and small circles on an equal area net and map projections.
  • Find out about Machine Learning
  • Learn about using the scikit-learn python package for clustering analysis.
  • Apply clustering analysis to Earth Science problems
  • Learn how to use satellite imagery to understand land usage.
  • Learn how to use patches in matplotlib.
  • Learn about using the scikit-learn python package to classify data.
  • Learn about 3D plots of points and surfaces
  • Show some examples with subduction zone earthquakes and isotopic systems
  • Take a look at data with respect to time (time series)
  • Learn a bit about time series analysis.
  • Learn how to make and display animated gifs

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published