Giter VIP home page Giter VIP logo

agrogeo24's Introduction

SimPEG tutorial for Agrogeo24

Instructors: Devin C. Cowan1 and Santiago Soler1

Authors of the material: Devin C. Cowan1, Santiago Soler1 and Lindsey Heagy1

Contributors: Mariana G.2 and Rowan Cockett3

1 Geophysical Inversion Facility. Earth Ocean and Atmospheric Sciences. University of British Columbia.
2 Centro de Investigación Científica y de Educación Superior de Ensenada (CICESE), Baja California
3 Curvenote

Information
Where ETH Zürich, Switzerland
When Feb 1 and Feb 2, 2024
Organizer Agrogeophysics Organizing Committee
Website of the event agrogeophy.github.io/agrogeo24

Abstract

In this workshop we'll showcase how we can use the tools available in SimPEG, a Python library for Simulations and Parameter Estimations in Geophysics, to simulate ERT (a.k.a. DC resistivity) data from a synthetic model and then to run a deterministic inversion to recover the original model. You'll learn how to set up a DC survey, define a mesh, build a synthetic model, create a simulation that implements all the physics, and run a forward model to generate synthetic data. Lastly you'll learn how to set up an inversion to recover the resistivity of the subsurface. By the end of the tutorial you'll be able to use SimPEG to invert your own data.

About

We were invited by Agrogeo24 to give a workshop about SimPEG, to show the agrogeophysical community how we can use SimPEG to run forward simulations of DC resistivity data (ERT), and how we can invert that type of data.

During this workshop we'll go through two Jupyter notebooks that showcase examples on how we can run forward and inverse problems for ERT data:

Setup

During this workshop we'll use Juptyer notebooks to run the forward and inverse modelling of DC resistivity data.

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

By default we'll use Google Colab. But we'll consider installing Python locally in case something goes wrong with the former.

Here will provide instructions to:

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. Create a new notebook.
  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: Create a new notebook

  1. Access to Google Colab by going to: https://colab.research.google.com
  2. Find the top menu and choose File > New notebook. A new tab should open with a blank notebook in it.

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 (if it's not empty, then 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 pymatsolver==0.2.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.

Important

Every time you open a notebook in Colab or create a new one, you'll have to reinstall these packages (Google Colab don'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 ... line at the top (add it otherwise), and run it.

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 Miniforge 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-agrogeo24 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: Activate the simpeg-agrogeo24 environment and start JupyterLab

Tip

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

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

  1. Open a terminal (Anaconda Prompt or Miniforge Prompt if you are running Windows).
  2. Activate the simpeg-agrogeo24 environment by running mamba activate simpeg-agrogeo24. If you installed Anaconda, then replace mamba for conda in the previous line.
  3. With the simpeg-agrogeo24 environment activated, we can start JupyterLab by running jupyterlab in the terminal. A new tab in our web browser should open showing JupyterLab's interface.

License

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

agrogeo24's People

Contributors

dccowan avatar mgomezn avatar rowanc1 avatar santisoler avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

agrogeo24's Issues

Upload new inversion data to work with

@dccowan you mention that you have new data you want to work with on the inversion notebook. Feel free to replace the files in data. You'll also have to update the hash value for each one of them. But that's easy, you can run those cells with known_hash=None and the retrieve function will print it out for you: https://www.fatiando.org/pooch/latest/retrieve.html .

If you happen to change their names, then remember to update them also in the notebook while downloading it.

Create Zenodo repository for the tutorial

Would be nice to have the repo for the tutorial uploaded to Zenodo, so we can cite it through a DOI.

TODO

  • Draft a new Zenodo repo (don't publish it)
  • Book a DOI
  • Include the DOI in the README.md. We could also include a ## Citing section with instructions on how to cite.
  • Create a release
  • Download zip from the release
  • Upload zip to Zenodo
  • Publish the Zenodo repo

Add small description of the workshop in the README.md

It would be nice if we add a small description about the workshop in the README.md. There already place for it under the ## About heading.

It would also be nice to include a link to the two notebooks, so people can easily find those even if they are not familiar with GitHub repos.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.