Skip to content

A tutorial for using SimPEG to forward model and invert SkyTEM data.

License

Notifications You must be signed in to change notification settings

simpeg/segns-2024-tutorial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Geophysical inversions with SimPEG: an example with airborne electromagnetic data

A SimPEG tutorial for the SEG Near Surface Webinar series.

Instructors: Joseph Capriotti1 Lindsey Heagy2 and Seogi Kang3

1 Center for Gravity, Electrical, and Magnetic Studies, Department of Geophysics, Colorado School of Mines.
2 Geophysical Inversion Facility. Earth, Ocean and Atmospheric Sciences. University of British Columbia.
3 Environmental Geophysics Research Group, Department of Geophysics, Stanford University

Information
When Feb 14, 2024 11 am CST
Materials Intro Slides

About

We were invited by the SEG Near-Surface Geophysics Student Subcommittee to give a tutorial as part of their Open-Source Software webinar series.

Discover the powerful open-source SimPEG framework. You will learn how to simulate and invert airborne electromagnetic (AEM) data using a real-world dataset.

During this tutorial we will go through a notebook describing how to invert AEM data collected in the Salinas Valley of California using the SkyTEM system to monitor salt water intrusion. For details about the dataset please checkout Gottschalk et. al. 2017. We will focus on how to simulate and invert the data by representing the parameters of the SkyTEM system using SimPEG components.

This notebook is what we will use and modify during the live tutorial:

Alternatively there is also a filled version of this notebook available if you do not want to follow along with the coding.

Setup

During this workshop we'll use Juptyer notebooks to simulate and invert SkyTEM data.

To be able to follow the tutorial and run the notebook, you'll need to have access to a Python environment. This could be done through a local Python installation like Anaconda or Miniforge, or through online services like Google Colab.

We recommend installing locally so you can save your progress. In google colab, your progress is not saved between sessions, but if you are struggling getting the correct environment setup locally it should work as a backup option.

Here will provide instructions to:

Install Python locally

To be able to run the Jupyter notebooks for this tutorial in our own machines, we'll have to follow these steps:

  1. Install a Python distribution (like Anaconda or miniforge).
  2. Create a conda environment with all the Python packages needed (for example, SimPEG).
  3. Activate this conda environment and run JupyterLab to start coding.

Step 1: Install a Python distribution

We recommend installing a Python distribution like miniforge or Anaconda.

Both of them will install Python and a package manager that allows us to install new Python libraries (like SimPEG for example), and also create environments.

Anaconda uses the conda package manager, while Miniconda uses the new mamba, which works faster than conda.

If you have either of both installed, you can skip this step. Otherwise, please follow their installation instructions:

Step 2: Create the simpeg-segns2024 conda environment

Important

In the following steps we'll make use of the mamba package manager. In case you installed Anaconda, use conda instead. You can simply replace mamba for conda on every command we ask to use it and it'll work fine.

  1. Download the environment.yml file from (right-click and select "Save page as" or similar).
  2. Make sure that the file is called environment.yml. Windows sometimes adds a .txt to the end, which you should remove.
  3. Open a terminal (Anaconda Prompt or Miniforge Prompt if you are running Windows). The following steps should be done in the terminal.
  4. Navigate to the folder that has the downloaded environment file (if you don't know how to do this, take a moment to read the Software Carpentry lesson on the Unix shell).
  5. Create the conda environment by running
    mamba env create --file environment.yml
    
    (this will download and install all of the packages used in the tutorial). If you installed Anaconda, then replace mamba for conda in the previous line.

Step 3: Get the repository's utility code and data.

If you are not comfortable using git, you will need to at a bare minimum you will need to download:

If you are comfortable using git, you have likely already cloned this repository and received all of the files you will need.

Tip

You don't need to explicitly download the data file from github, we will be able to use pandas.read_csv to retrieve the file for us.

Step 4: Activate the simpeg-segns2024 environment and start JupyterLab

Tip

You'll need a browser that is able to run JupyterLab (basically anyone except Internet Explorer). If you are in Windows, make sure you change your default browser to a different one.

Now we can activate the newly created simpeg-segns2024 environment.

  1. Open a terminal (Anaconda Prompt or Miniforge Prompt if you are running Windows).
  2. Activate the simpeg-segns2024 environment by running:
    conda activate simpeg-segns2024
    
  3. With the simpeg-segns2024 environment activated, we can start JupyterLab by running
    jupyter-lab
    
    in the terminal. A new tab in our web browser should open showing JupyterLab's interface.
  4. Navigate to the live-skytem-inversion.ipynb notebook.

Configure Google Colab

To be able to run the Jupyter notebooks for this tutorial in Google Colab, we'll need to follow these steps:

  1. Login to our Google Colab account.
  2. Copy the live notebook from GitHub.
  3. Install some Python libraries that we'll need to use, such as SimPEG.

Step 1: Login to our Google Colab account

If you don't have a Google account, create one and log in. If you do, you just need to log in.

Step 2: Open the Live notebook in Colab

  1. Access to Google Colab by going to: https://colab.research.google.com
  2. Find the top menu and choose File > Open Notebook.
  3. Select the GitHub option
  4. Paste the URL of this repository into the space: https://github.com/simpeg/segns-2024-tutorial
  5. Select the live-skytem-inversion.ipynb notebook.

Step 3: Install some Python libraries

To be able to follow this workshop we need to install some Python libraries that aren't preinstalled in the default Google Colab environment.

  1. Click on the first cell of the notebook (Create a new Code cell and move it to the first position with the arrows icons that appear on its top-right).
  2. Type the following line in the selected cell:
    !pip install simpeg==0.20.0 discretize==0.10.0
    
    Note the ! sign at the beginning of the line, don't remove it.
  3. Run that cell by clicking the Play button on its left or by pressing Shift+Enter in your keyboard. pip should install all the packaged listed in that line. If installation goes smoothly, you should see a line that reads Successfully installed ... and lists all the new packages that had been installed.

Step 4: Copy the repository's utility code and data to Colab.

To be able to follow along with the tutorial, you will need to copy at least two files directly to Google Colab: the configuration file and the parser script. You can download them directly from github to Google Colab by typing in another cell (and then executing it):

!wget https://raw.githubusercontent.com/simpeg/segns-2024-tutorial/main/data/20170606_337m2_Cal_DualWaveform_60Hz_414_412_418.gex
!wget https://raw.githubusercontent.com/simpeg/segns-2024-tutorial/main/notebooks/utilities/gex_parser.py

This will download the SkyTEM configuration file and a parser to easily read it into python.

Important

Every time you open a notebook in Colab or create a new one, you'll have to reinstall these packages and download the data again (Google Colab doesn't save installed states across notebooks).

If it's a new notebook, just follow the previous instructions from the top.

If it's an existing notebook, make sure that it has the !pip install ... and the !wget ... lines at the top (add it otherwise), and run it.

Acknowledgement

AEM data used in this tutorial were acquired with funding from MCWRA (Monterey County Water Resources Agency) with the SkyTEM system; acquisition oversight, planning, and processing by Aqua Geo Framework.

License

This work is licensed under the MIT License.

About

A tutorial for using SimPEG to forward model and invert SkyTEM data.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published