.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "glr_examples/applications/plot_res_z_phases_tensors.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code or to run this example in your browser via Binder .. rst-class:: sphx-glr-example-title .. _sphx_glr_glr_examples_applications_plot_res_z_phases_tensors.py: =============================== Plot Res, Z and phase tensors =============================== Plot impedances/resistivity and phase tensors from AMT data after applying essential corrections. .. GENERATED FROM PYTHON SOURCE LINES 10-13 .. code-block:: Python # Author: L.Kouadio # Licence: BSD-3-clause .. GENERATED FROM PYTHON SOURCE LINES 14-24 :func:`~watex.utils.plot_tensors` plots the impendances/resistivity and phase tensors. In the following example, we called a sample of :term:`EDI` collected in Huayuan locality, Hunan province, China, stored as inner datasets then we apply the three basic corrections such as: - `removing noises`: Drop a possible existences of factories noises, power lines effects , ... - `static shift`: Shift the TE and TM tensors at each station. - `drop frequencies`: Drop frequencies is usefull to control the safety of the EM data collected in an area with severe interferences. .. GENERATED FROM PYTHON SOURCE LINES 26-27 We start by importing the required modules as: .. GENERATED FROM PYTHON SOURCE LINES 27-35 .. code-block:: Python import os from watex.datasets import fetch_data from watex.utils.plotutils import plot_strike from watex.datasets.io import get_data # get edidata stored in cache from watex.methods import EM, MT from watex.utils.plotutils import plot_tensors import matplotlib.pyplot as plt plt.style.use ("seaborn") .. GENERATED FROM PYTHON SOURCE LINES 36-39 Before we'll make a collection of :term:`EDI` data and call :func:`watex.utils.plot_strike` for plotting as: .. GENERATED FROM PYTHON SOURCE LINES 39-46 .. code-block:: Python fetch_data ( 'huayuan', samples = 20) # store 20 edis in cache # # edipath = r'D:\project-Tayuan\data\1\1one' edi_fn_lst = [os.path.join(get_data(),f) for f in os.listdir(get_data()) if f.endswith('.edi')] # edi_fn_lst = [os.path.join(edipath,f) for f in os.listdir(edipath) # if f.endswith('.edi')] .. GENERATED FROM PYTHON SOURCE LINES 47-50 * Plot the raw tensors We can plot the raw tensors without applying any corrections at the first station ``S00``. .. GENERATED FROM PYTHON SOURCE LINES 50-54 .. code-block:: Python emo_r = EM().fit(edi_fn_lst) plot_tensors(emo_r.ediObjs_, station =0) .. image-sg:: /glr_examples/applications/images/sphx_glr_plot_res_z_phases_tensors_001.png :alt: Station 0 :srcset: /glr_examples/applications/images/sphx_glr_plot_res_z_phases_tensors_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 55-56 Then we can visualize the strike using the raw data as .. GENERATED FROM PYTHON SOURCE LINES 56-59 .. code-block:: Python plot_strike(edi_fn_lst ) .. image-sg:: /glr_examples/applications/images/sphx_glr_plot_res_z_phases_tensors_002.png :alt: Strike (Z), PT Azimuth :srcset: /glr_examples/applications/images/sphx_glr_plot_res_z_phases_tensors_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none GDAL_DATA environment variable is not set Please see https://trac.osgeo.org/gdal/wiki/FAQInstallationAndBuilding#HowtosetGDAL_DATAvariable Ignore GDAL as it is not working. Will use pyproj .. GENERATED FROM PYTHON SOURCE LINES 60-70 * Plot corrected tensors We applied three essential corrections to EDI objets via a chaining method supplied by the :class:`watex.methods.MT` class. We first drop the bad frequencies with a severity set to `10%` tolerance. Then removing the static shift effect. After TM and ME mode data are automatically (``nfreq=auto``) shifted by asserting all stations, the noises such as the power lines or interferences can be removed. Note that the all processing step can be applied differently, it does not need to follow a certain order. .. GENERATED FROM PYTHON SOURCE LINES 70-77 .. code-block:: Python mo = MT().fit(edi_fn_lst).drop_frequencies ( tol =0.1).remove_static_shift (nfreq='auto' ).remove_noises (method ='base') # we then visualized the new corrected tensors at the station 0 plot_tensors ( mo.ediObjs_, station =0 ) .. image-sg:: /glr_examples/applications/images/sphx_glr_plot_res_z_phases_tensors_003.png :alt: Station 0 :srcset: /glr_examples/applications/images/sphx_glr_plot_res_z_phases_tensors_003.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /home/docs/checkouts/readthedocs.org/user_builds/watex/envs/0.3.2/lib/python3.10/site-packages/pyproj/crs/crs.py:141: FutureWarning: '+init=:' syntax is deprecated. ':' is the preferred initialization method. When making the change, be mindful of axis order changes: https://pyproj4.github.io/pyproj/stable/gotchas.html#axis-order-changes-in-proj-6 .. GENERATED FROM PYTHON SOURCE LINES 78-86 .. topic:: References .. [1] Weaver J.T, Lilley F.E.M.(2003) Invariants of rotation of axes and indicators of dimensionality in magnetotellurics, Australian National University, University of Victoria; http://bib.gfz-potsdam.de/emtf/2007/pdf/lilley.pdf .. [2] T. Grant Caldwell, Hugh M. Bibby, Colin Brown, The magnetotelluric phase tensor, Geophysical Journal International, Volume 158, Issue 2, August 2004, Pages 457–469, https://doi.org/10.1111/j.1365-246X.2004.02281.x .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 10.118 seconds) .. _sphx_glr_download_glr_examples_applications_plot_res_z_phases_tensors.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: binder-badge .. image:: images/binder_badge_logo.svg :target: https://mybinder.org/v2/gh/watex/watex/0.3.X?urlpath=lab/tree/notebooks/glr_examples/applications/plot_res_z_phases_tensors.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_res_z_phases_tensors.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_res_z_phases_tensors.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_