Python for Geoscientists

  • An understanding of the Python programming syntax

  • Importing and exporting common data formats

  • Visualising graph data with matplotlib

  • Mapping geoscientific data with Cartopy

  • Using common Python libraries (e.g. numpy and scipy) to solve simple geospatial problems

https://github.com/brmather/Python-for-Geoscientists

Follow along...

Python environment

Our preferred installation Python installation is via conda, which uses separate environment to minimise dependency conflicts

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

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 image

Access docker image from Kitematic

Search for "brmather/python-honours-course"

Attached volume to a folder on your computer

Open the web interface

Docker image

$ docker pull brmather/python-honours-course:latest
$ docker images
REPOSITORY                            TAG                 IMAGE ID            CREATED             SIZE
brmather/python-honours-course        latest              0f196ceade6d        5 hours ago         3.17GB
brmather/pybadlands-workshop          18.04-ubuntu        0f196cesdfde        5 hours ago         2.17GB
brmather/pybadlands-workshop-base     18.04-ubuntu        17a94e4b836a        2 days ago          1.7GB
$
$ docker run --name honspy -p 8888:8888 brmather/docker-hons-pye:2019.04.13

Pull the docker image to your computer and run it within a container

Command line instructions

Assessment

Two Jupyter notebooks

Exercise 1

  • Mapping bathymetry and age of ocean floor
  • Image processing (interpolation + smoothing)
  • Curve fitting

Exercise 2

  • Build a map of your field area
  • Plot geospatial data
  • Multi-pane maps

Each of these exercises will build on notebooks that we will cover during the course.

Submission

  • Use your GitHub account to version control your work on the exercises.
    • On your own GitHub account e.g. github.com/username/honours
  • Email me a link to your completed exercises to me by Friday the 24th of May.