ORCA2 Point Cloud

On this page

ORCA2 Point Cloud#

This example demonstrates how to render a spherical point cloud.

πŸ“‹ Summary#

Creates a point cloud from 1-D latitude, longitude and z-levels.

The resulting mesh contains only points.

Based on a curvilinear ORCA2 global ocean with tri-polar model grid of sea water potential temperature data, which has been reduced to a limited area and pre-filtered for temperature gradients.

Note that, Natural Earth coastlines are also rendered along with a Natural Earth base layer with opacity.

🏷 Tags: Coastlines Globe Opacity Point Cloud Texture


from points  orca cloud
from __future__ import annotations

import geovista as gv
from geovista.pantry.data import um_orca2_gradient
from geovista.pantry.meshes import ZLEVEL_SCALE_CLOUD
import geovista.theme


def main() -> None:
    """Plot a spherical point cloud.

    Notes
    -----
    .. versionadded:: 0.2.0

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

    # Create the point cloud from the sample data.
    cloud = gv.Transform.from_points(
        sample.lons,
        sample.lats,
        data=sample.zlevel,
        name=sample.name,
        zlevel=-sample.zlevel,
        zscale=ZLEVEL_SCALE_CLOUD,
    )

    # Plot the point cloud.
    plotter = gv.GeoPlotter()
    sargs = {"title": f"{sample.name} / {sample.units}", "shadow": True}
    plotter.add_mesh(
        cloud,
        cmap="deep",
        point_size=5,
        scalar_bar_args=sargs,
        render_points_as_spheres=True,
    )
    plotter.add_coastlines(color="black")
    # Force zlevel alignment of coastlines and base layer.
    plotter.add_base_layer(texture=gv.natural_earth_1(), opacity=0.5, zlevel=0)
    plotter.add_axes()
    plotter.view_yz()
    plotter.add_text(
        "ORCA Point-Cloud (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