.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/howto_preprocessing/plot_shapefile_meshing.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. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_howto_preprocessing_plot_shapefile_meshing.py: Meshing a shapefile =================== .. sectionauthor:: Julian Heinze (Helmholtz Centre for Environmental Research GmbH - UFZ) In this example we present how to create a unstructured grid in vtk format (\*.vtu) from a shapefile. .. GENERATED FROM PYTHON SOURCE LINES 11-12 Necessary imports .. GENERATED FROM PYTHON SOURCE LINES 12-15 .. code-block:: Python import ogstools.meshlib as ml from ogstools.examples import test_shapefile .. GENERATED FROM PYTHON SOURCE LINES 16-17 A shapefile can be directly read with meshlib to create a mesh. .. GENERATED FROM PYTHON SOURCE LINES 17-19 .. code-block:: Python mesh = ml.Mesh.read(test_shapefile) mesh.plot(show_edges=True) .. tab-set:: .. tab-item:: Static Scene .. image-sg:: /auto_examples/howto_preprocessing/images/sphx_glr_plot_shapefile_meshing_001.png :alt: plot shapefile meshing :srcset: /auto_examples/howto_preprocessing/images/sphx_glr_plot_shapefile_meshing_001.png :class: sphx-glr-single-img .. tab-item:: Interactive Scene .. offlineviewer:: /builds/ogs/tools/ogstools/docs/auto_examples/howto_preprocessing/images/sphx_glr_plot_shapefile_meshing_001.vtksz .. rst-class:: sphx-glr-script-out .. code-block:: none /builds/ogs/tools/ogstools/.venv-devcontainer/lib/python3.10/site-packages/pandamesh/common.py:283: RuntimeWarning: invalid value encountered in sqrt area = np.sqrt(s * (s - a) * (s - b) * (s - c)) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 6.251 seconds) .. _sphx_glr_download_auto_examples_howto_preprocessing_plot_shapefile_meshing.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_shapefile_meshing.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_shapefile_meshing.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_shapefile_meshing.zip `