
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "generated/gallery/grid/reykjanes.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

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

        :ref:`Go to the end <sphx_glr_download_generated_gallery_grid_reykjanes.py>`
        to download the full example code.

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

.. _sphx_glr_generated_gallery_grid_reykjanes.py:


Reykjanes Plume
---------------

This example demonstrates how to render a 3D structured grid.

📋 Summary
^^^^^^^^^^

The sample data is taken from a Met Office NAME Model time-series simulation
of the Icelandic Reykjanes Peninsula eruption on 29 May 2024.

A structured grid of cubic voxels is constructed for the 1D spatial coordinates
and then thresholded to reveal the underlying volcanic plume of Sulphur Dioxide
Air Concentration.

The visualization is enhanced by rendering with a log scale colormap due to the
relatively large dynamic range and non-symmetric, skewed distribution of
concentration levels within the plume.

The cited release location of the eruption on the peninsula is marked,
highlighting the volcanic plume's eastward transport and southerly dispersion.

.. warning::
    :class: dropdown, toggle-shown

    Structured grid projection transformation support is pending.

.. tags::

    experimental 🧪,
    component: coastlines, component: graticule, component: texture,
    domain: volcanology,
    filter: threshold,
    load: grid,
    plot: log-scale,
    version: 0.6.0

----

.. GENERATED FROM PYTHON SOURCE LINES 48-121







.. tab-set::



   .. tab-item:: Static Scene



            
     .. image-sg:: /generated/gallery/grid/images/sphx_glr_reykjanes_001.png
        :alt: reykjanes
        :srcset: /generated/gallery/grid/images/sphx_glr_reykjanes_001.png
        :class: sphx-glr-single-img
     


   .. tab-item:: Interactive Scene



       .. offlineviewer:: /home/docs/checkouts/readthedocs.org/user_builds/geovista-ja/checkouts/latest/geovista/docs/src/generated/gallery/grid/images/sphx_glr_reykjanes_001.vtksz






.. code-block:: Python


    from __future__ import annotations

    import pyvista as pv

    import geovista as gv
    from geovista.pantry.data import name_reykjanes


    def main() -> None:
        """Plot the volcanic plume structured grid.

        Notes
        -----
        .. versionadded:: 0.6.0

        """
        # Load the sample data.
        sample = name_reykjanes()

        # Create the structured grid.
        grid = gv.Transform.to_structured_grid(
            sample.xs,
            sample.ys,
            sample.zs,
            data=sample.data,
        )

        # Remove cells from the grid with NaN values then calculate the data range.
        grid = grid.threshold()
        clim = grid.get_data_range()

        # Now render the plotter scene.
        p = gv.GeoPlotter()
        p.add_base_layer(texture=gv.blue_marble(), zlevel=0)
        p.add_coastlines()
        p.add_graticule()
        sargs = {"title": f"{sample.name} / {sample.units}", "fmt": "%.1f"}
        p.add_mesh(
            grid,
            clim=clim,
            cmap="magma_r",
            log_scale=True,
            scalar_bar_args=sargs,
        )
        p.add_text(
            "Reykjanes Peninsula, Iceland",
            position="upper_left",
            font_size=10,
        )

        # Mark the event release location.
        p.add_points(
            xs=sample.poi.longitude,
            ys=sample.poi.latitude,
            render_points_as_spheres=True,
            color="red",
            point_size=10,
        )

        # Define a specific camera position and orientation.
        cpos = pv.CameraPosition(
            position=(0.8957959335673299, -0.47394138433018956, 0.9968046553672109),
            focal_point=(-0.10638261870474444, 0.3538637910944052, 0.715402511958916),
            viewup=(-0.17014498616109472, 0.12623579798398435, 0.977299957531764),
        )

        p.add_axes()
        p.show(cpos=cpos)


    if __name__ == "__main__":
        main()


.. _sphx_glr_download_generated_gallery_grid_reykjanes.py:

.. only:: html

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

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

      :download:`Download Jupyter notebook: reykjanes.ipynb <reykjanes.ipynb>`

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

      :download:`Download Python source code: reykjanes.py <reykjanes.py>`

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

      :download:`Download zipped: reykjanes.zip <reykjanes.zip>`


.. only:: html

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

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