Python for Geoscience

Course Overview

Python for Geophysicists

This course follows the structure of our popular Python for Scientists and Engineers course, but all materials are targeted towards geophysicists and petrophysicists who would like to use Python in their day-to-day work. The course material handles the use of Python for geomechanics, engineering, and modeling. Specific exercises include reading well logs into NumPy arrays and doing calculations on them, writing a module to calculate bulk density from P-wave velocity, working with well logs, identifying areas of bad data in well logs, and selecting a horizon from a seismic cube.

Day 1

Introduction to Python

The first day is devoted to understanding how to think in Python. We start by demonstrating the IPython interactive environment and how it can be used for rapid application development. The pace of this day is determined by previous exposure to Python. Even experienced Python programmers report learning new ideas from the experts that teach this course.

  • Data-types (strings, lists, dictionaries and more).
  • Syntax and language structure (if-then statements, looping).
  • Defining functions.
  • Creating and importing modules.
  • Reading and writing files.

Day 2

Python, continued

  • Introduction to Python classes and object oriented programming.
  • Handling errors.

Introduction to NumPy

The NumPy extension module to Python is exposed as a tool for rapidly manipulating and processing large data-sets.

  • Detour: plotting with matplotlib.
  • Basic operations and manipulations on N-dimensional arrays.
  • Using vectorization to process arrays with implicit loops.
  • Reading and writing arrays.
  • Indexing arrays by slicing or with more general indices or masks.
  • Understanding the N-dimensional data structure.

Day 3

NumPy, continued

  • Broadcasting of array operations.
  • Working with "structured" arrays.

Overview of SciPy

  • 3D plotting with mayavi.mlab.
  • Introduction to C extension modules.
  • Additional topics in geophysics/geostatistics, including computing variograms and kriging.

Day 4

Interfacing with C / C++ and Fortran

One of Python's greatest features is its ability to integrate seamlessly with C, C++, and Fortran. In this module you will learn how to use a variety of tools that have emerged for efficiently integrating with legacy code as well as optimizing new code with compiled modules. This module extends the material covered on the third day of the Python for Geophysicists course. Topics to be covered can be modified to suit participants interest but can include:

  • Integrating with Fortran using f2py
  • Integrating legacy C / C++ code using SWIG
  • In-lining C/C++ in a Python application using Weave
  • Calling arbitrary shared-libraries with ctypes
  • Creating new extension modules with Cython

Python for Geoscience
Course Schedule

For inquiries or to register call 512.536.1057


A 20% discount is available for academics currently at a degree-granting institution. Contact us at 512.536.1057 to register.

Prerequisites

Programming experience in some language (C, VB, Fortran, Matlab) is expected. Experience with C, C++, and/or Fortran is useful for some topics. Object oriented programming skills are not necessary but will be helpful. Knowledge of calculus, statistics, signal and image processing, optimization, are all valuable but not absolutely required.

Python Training on Demand

Participants will receive 30 days of Enthought Training on Demand Python Foundations Series access following the course