
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "auto_examples/01-simulation_and_visualization/1.1-visualize_one_crater.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. note::
        :class: sphx-glr-download-link-note

        :ref:`Go to the end <sphx_glr_download_auto_examples_01-simulation_and_visualization_1.1-visualize_one_crater.py>`
        to download the full example code.

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_auto_examples_01-simulation_and_visualization_1.1-visualize_one_crater.py:


Manually emplace a single crater on the Moon and visualize it with PyVista
==========================================================================

.. rubric:: By David Minton

This example shows how to emplace a single large crater on the Moon using Cratermaker's `Simulation.emplace()` method. The crater is defined with a specific diameter and location. The final surface is exported and visualized using PyVista.

.. GENERATED FROM PYTHON SOURCE LINES 10-21







.. tab-set::



   .. tab-item:: Static Scene



            
     .. image-sg:: /auto_examples/01-simulation_and_visualization/images/sphx_glr_1.1-visualize_one_crater_001.png
        :alt: 1.1 visualize one crater
        :srcset: /auto_examples/01-simulation_and_visualization/images/sphx_glr_1.1-visualize_one_crater_001.png
        :class: sphx-glr-single-img
     


   .. tab-item:: Interactive Scene



       .. offlineviewer:: /home/docs/checkouts/readthedocs.org/user_builds/cratermaker/checkouts/latest/docs/auto_examples/01-simulation_and_visualization/images/sphx_glr_1.1-visualize_one_crater_001.vtksz



.. rst-class:: sphx-glr-script-out

 .. code-block:: none

    Creating a new grid
    Generating a mesh with icosphere level 6.
    Queueing craters for emplacement:   0%|          | 0/1 [00:00<?, ?crater/s]    Queueing craters for emplacement: 100%|██████████| 1/1 [00:04<00:00,  4.94s/crater]                                                                                   
    Counting craters:   0%|          | 0/1 [00:00<?, ?craters/s]
                                                                    Converting xarray Dataset to Crater objects:   0%|          | 0/1 [00:00<?, ?crater/s]                                                                                          Converting xarray Dataset to Crater objects:   0%|          | 0/1 [00:00<?, ?crater/s]                                                                                      





|

.. code-block:: Python


    import cratermaker as cm

    simdir = "simdata-1_1"

    # Note, that for these examples we pass ask_overwrite=False and reset=True to the Simulation constructor. This will suppress
    # prompts that ask the user if they want to overwrite existing files, which would would prevent these examples from running on their
    # own when building the documentation pages. Alternatively, calling cm.cleanup(simdir) will remove all pre-existing output files.
    sim = cm.Simulation(gridlevel=6, simdir=simdir, ask_overwrite=False, reset=True)
    sim.emplace(diameter=500e3, location=(45, 60))
    sim.show3d(variable_name="face_elevation", cmap="cividis")


.. rst-class:: sphx-glr-timing

   **Total running time of the script:** (0 minutes 29.845 seconds)


.. _sphx_glr_download_auto_examples_01-simulation_and_visualization_1.1-visualize_one_crater.py:

.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-example

    .. container:: sphx-glr-download sphx-glr-download-jupyter

      :download:`Download Jupyter notebook: 1.1-visualize_one_crater.ipynb <1.1-visualize_one_crater.ipynb>`

    .. container:: sphx-glr-download sphx-glr-download-python

      :download:`Download Python source code: 1.1-visualize_one_crater.py <1.1-visualize_one_crater.py>`

    .. container:: sphx-glr-download sphx-glr-download-zip

      :download:`Download zipped: 1.1-visualize_one_crater.zip <1.1-visualize_one_crater.zip>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
