LFRic LAM Mesh

On this page

LFRic LAM Mesh#

This example demonstrates how to render an unstructured quadrilateral mesh.

📋 Summary#

Creates a mesh from 1-D latitude and longitude unstructured points and connectivity.

The resulting mesh contains quad cells. The connectivity is required to construct the cells by indexing into the CF UGRID unstructured points.

It uses a high-resolution Local Area Model (LAM) mesh of air potential temperature data located on the mesh faces/cells.

Note that, a Natural Earth base layer is rendered along with Natural Earth coastlines.

Tags: Coastlines Globe Texture Unstructured


lam pacific
from __future__ import annotations

import geovista as gv
from geovista.pantry.data import lam_pacific
import geovista.theme


def main() -> None:
    """Plot an LFRic LAM unstructured mesh.

    Notes
    -----
    .. versionadded:: 0.1.0

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

    # Create the mesh from the sample data.
    mesh = gv.Transform.from_unstructured(
        sample.lons,
        sample.lats,
        connectivity=sample.connectivity,
        data=sample.data,
    )

    # Plot the unstructured mesh.
    plotter = gv.GeoPlotter()
    sargs = {"title": f"{sample.name} / {sample.units}", "shadow": True}
    plotter.add_mesh(mesh, scalar_bar_args=sargs)
    plotter.add_base_layer(texture=gv.natural_earth_hypsometric())
    plotter.add_coastlines()
    plotter.add_axes()
    plotter.view_yz(negative=True)
    plotter.add_text(
        "CF UGRID LAM (10m Coastlines)",
        position="upper_left",
        font_size=10,
        shadow=True,
    )
    plotter.camera.zoom(1.3)
    plotter.show()


if __name__ == "__main__":
    main()

Gallery generated by Sphinx-Gallery