Note
Go to the end to download the full example code.
ICON Mesh (Projected)#
This example demonstrates how to render a projected unstructured triangular mesh.
📋 Summary#
Creates a mesh from 2-D latitude and longitude unstructured cell bounds.
The resulting mesh contains triangular cells.
It uses Icosahedral Nonhydrostatic Weather and Climate Model (ICON) global 160km resolution soil type data, as developed by the Deutscher Wetterdienst (DWD) and the Max-Planck-Institut für Meteorologie (MPI-M). The data targets the mesh faces/cells.
Note that, Natural Earth coastlines are also rendered, and the mesh is transformed to the Equidistant Cylindrical (Plate Carrée) conformal cylindrical projection.
from __future__ import annotations
import matplotlib as mpl
import geovista as gv
from geovista.pantry.data import icon_soil
import geovista.theme
def main() -> None:
"""Plot a projected ICON unstructured mesh.
Notes
-----
.. versionadded:: 0.1.0
"""
# Load the sample data.
sample = icon_soil()
# Create the mesh from the sample data.
mesh = gv.Transform.from_unstructured(sample.lons, sample.lats, data=sample.data)
# Plot the unstructured mesh.
crs = "+proj=eqc"
p = gv.GeoPlotter(crs=crs)
sargs = {"title": f"{sample.name} / {sample.units}", "shadow": True}
cmap = mpl.colormaps.get_cmap("cet_CET_L17").resampled(lutsize=9)
p.add_mesh(mesh, cmap=cmap, scalar_bar_args=sargs)
p.add_coastlines()
p.add_axes()
p.add_text(
f"ICON 160km Resolution Triangular Mesh ({crs})",
position="upper_left",
font_size=10,
shadow=True,
)
p.view_xy()
p.camera.zoom(1.5)
p.show()
if __name__ == "__main__":
main()