#!/usr/bin/env python # coding: utf-8 # # Inversion with topography # In this notebook, we will learn how to add topography and perform 2D inversion with rectangular and triangular meshes. The files needed can be found in `examples/dc-2d-topo/`. # In[1]: get_ipython().run_line_magic('matplotlib', 'inline') import warnings warnings.filterwarnings('ignore') # just to make it cleaner in the notebook import os import sys sys.path.append((os.path.relpath('../src'))) # add here the relative path of the API folder testdir = '../src/examples/dc-2d-topo/' import numpy as np # this will be used to read the topography file from resipy import Project # First, let's create an `Project` object and import the survey as usual. # In[2]: k = Project(typ='R2') # create new Project object and use default working directory k.createSurvey(os.path.join(testdir, 'syscal.csv')) # We can also plot the pseudo-section. Note that this one remains flat event when there is topogragraphy involved. # In[3]: k.showPseudo() # If we take a look at the electrodes position by plotting `R2.elec` we can see that there is no topography yet (all the values in the third column (=z) are 0.0). # In[4]: k.elec # Then we can load a csv file that will add topography for each electrode. The csv file should be of the form X,Y,Z and no headers are needed. # In[5]: k.importElec(os.path.join(testdir + 'elec.csv')) print(k.elec) # We can now create a mesh either triangular or rectangular. # In[6]: k.createMesh(typ='trian') # or trian for triangular mesh k.showMesh() # We can finally invert the data on this mesh. Note that it might take a while so be patient. # In[7]: k.invert() # In[8]: k.showResults(contour=True, sens=True, zlim=[28,29.6]) # with contour # ## In a nutshell # In[10]: k = Project(typ='R2') k.createSurvey(testdir + 'syscal.csv') k.importElec(testdir + 'elec.csv') k.invert() k.showResults(contour=True, sens=True, zlim=[28,29.6]) # In[ ]: