Skip to content

brmather/Python-for-Geoscientists

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python for Geoscientists

A notebook-based introduction to python, jupyter notebooks and programming workflows with examples from python packages for the Earth Sciences.

The material is broken down into a number of sections of, approximately, increasing difficulty.

  1. Introduction to python / jupyter
  2. Introduction to version control with git
  3. Getting Started with Numpy / Scipy
  4. Introduction to Matplotlib
  5. Stripy for meshing / mapping the Sphere
  6. Making beautiful and useful maps with Cartopy
  7. Finite Differences with numpy

Description

Python has become a popular language for scientific computing, boasting a rich set of libraries relevant to geoscientists working with data. It has all the friendly features and conveniences you would expect of a modern programming language. The Python programming language offers adaptability and versatility to the types of analyses, modelling, and workflows that geoscientists utilise. The tools and workflows you will explore in this course are presented as Jupyter notebooks and can easily be adapted to your own research.

We are also going to focus on problem-solving approaches to computation - developing a systematic approach to programming, testing, debugging and documentation. We will make use of git for version control which is a tool / strategy that you will definitely find helpful in future. We will do all of our work within the literate programming environment of jupyter notebooks / jupyter lab.

We will introduce/review the 'standard' scientific python toolkits such as numpy, scipy, matplotlib, pandas. We will teach you how to manipulate and transform data in simple ways, plotting, mapping, visualisation, interpolation, gridding, function fitting, and exporting data / images into common, interchangeable data formats such as hdf5 and netcdf, geotiff.

We will learn how to orchestrate common earth science python software applications, seismic data set acquisition and analysis (obspy), meshing and interpolation (stripy). We will learn how to solve very simple differential equations with application to geothermal energy and ground water flow, statistical analysis of data sets.

Dependencies

  • numpy
  • scipy
  • matplotlib
  • cartopy
  • pandas
  • scikit-learn
  • jupyter
  • pygplates
  • gplately

Installation

You can install the all of the above dependencies using conda:

conda install -c conda-forge gplately scikit-learn jupyter

If you don't already have conda installed, we recommend miniforge.

Creating a new conda environment

We recommend creating a new conda environment inside which to install these dependencies. This avoids any potential conflicts in your base Python environment. In the example below we create a new environment called "my-env":

conda create -n my-env
conda activate my-env
conda install -c conda-forge gplately scikit-learn jupyter

my-env needs to be activated whenever you use GPlately: i.e. conda activate my-env.

Docker

Alternatively a Docker image can be sourced from: https://hub.docker.com/repository/docker/nickywright/geo-python/general

Acknowledgements

This coursework was created by a number of collaborators whom we want to acknowledge:

  • Louis Moresi (for the course structure and the majority of the notebooks)
  • Sara Moron (for some updates to the notebooks)
  • Nathanial Butterworth (machine learning and introductionary notebooks)
  • Rohitash Chandra (machine learning and data wrangling)
  • Ben Mather (advanced finite difference notebooks)
  • Nicky Wright (for the docker image)

About

Honours coursework material

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •