.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "content/examples/01-maps/plot_block_in_layer.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_content_examples_01-maps_plot_block_in_layer.py: Maps: Parametric Block in a Layer =================================== Parametric description of a block confined to a layer in a wholespace. The mapping can be applied in 2D or 3D. Here we show a 2D example. The model is given by .. code:: m = np.r_[ 'value of the background', 'value in the layer', 'value in the block', 'center of the layer (depth)', 'thickness of the layer', 'x-center of block', 'width of the block' ] .. GENERATED FROM PYTHON SOURCE LINES 24-58 .. image-sg:: /content/examples/01-maps/images/sphx_glr_plot_block_in_layer_001.png :alt: plot block in layer :srcset: /content/examples/01-maps/images/sphx_glr_plot_block_in_layer_001.png :class: sphx-glr-single-img .. code-block:: default import discretize from SimPEG import maps import numpy as np import matplotlib.pyplot as plt def run(plotIt=True): mesh = discretize.TensorMesh([50, 50], x0="CC") # 2D Tensor Mesh mapping = maps.ParametricBlockInLayer(mesh) # mapping m = np.hstack( np.r_[ 1.0, # value of the background 2.0, # value in the layer 3.0, # value in the block -0.1, # center of the layer (depth) 0.2, # thickness of the layer 0.3, # x-center of block 0.2, # width of the block ] ) # apply the mapping to define the physical property on the mesh rho = mapping * m if plotIt is True: fig, ax = plt.subplots(1, 1, figsize=(4, 6)) mesh.plot_image(rho, ax=ax) if __name__ == "__main__": run() plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.190 seconds) **Estimated memory usage:** 18 MB .. _sphx_glr_download_content_examples_01-maps_plot_block_in_layer.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_block_in_layer.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_block_in_layer.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_