-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathlam_pacific_moll.py
executable file
·77 lines (59 loc) · 1.96 KB
/
lam_pacific_moll.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/env python3
# Copyright (c) 2021, GeoVista Contributors.
#
# This file is part of GeoVista and is distributed under the 3-Clause BSD license.
# See the LICENSE file in the package root directory for licensing details.
"""
LFRic LAM Mesh (Projected)
--------------------------
This example demonstrates how to render a projected unstructured quadrilateral mesh.
📋 Summary
^^^^^^^^^^
Creates a mesh from 1-D latitude and longitude unstructured cell points.
The resulting mesh contains quad cells and is constructed from CF UGRID unstructured
cell points and connectivity.
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, and the mesh is transformed to the Mollweide pseudo-cylindrical
projection.
----
""" # noqa: D205,D212,D400
from __future__ import annotations
import geovista as gv
from geovista.pantry.data import lam_pacific
import geovista.themes
def main() -> None:
"""Plot a projected 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.
crs = "+proj=moll"
plotter = gv.GeoPlotter(crs=crs)
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.add_text(
f"CF UGRID LAM ({crs})",
position="upper_left",
font_size=10,
shadow=True,
)
plotter.view_xy()
plotter.camera.zoom(1.5)
plotter.show()
if __name__ == "__main__":
main()