Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dynamico sphinx-gallery unstructured example #588

Merged
merged 2 commits into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/src/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@
"filename_pattern": "/.*",
"ignore_pattern": (
"(__init__)|(clouds)|(earthquakes)|(from_1d__synthetic)|(from_2d__synthetic)"
"|(/unstructured/)"
"|(fesom)|(icon)|(lam)|(lfric_sst)|(smc)|(tri)"
),
"examples_dirs": "../../src/geovista/examples",
"gallery_dirs": "generated/gallery",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@


def main() -> None:
"""Plot the synthetic rectilinear grid.
"""Plot a projected synthetic rectilinear grid.

Notes
-----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@


def main() -> None:
"""Plot the synthetic rectilinear grid.
"""Plot a projected synthetic rectilinear grid.

Notes
-----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@


def main() -> None:
"""Plot the synthetic rectilinear grid.
"""Plot a projected synthetic rectilinear grid.

Notes
-----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@


def main() -> None:
"""Plot the synthetic rectilinear grid.
"""Plot a projected synthetic rectilinear grid.

Notes
-----
Expand Down
6 changes: 3 additions & 3 deletions src/geovista/examples/spatial_index/uber_h3.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,9 @@ def callback(actor: Actor, flag: bool) -> None:

# %%
# .. note::
# The checkboxes will **not** be rendered when viewing the documentation
# on ``ReadTheDocs``, as the appropriate VTK widget is not available
# in this headless environment.
# The checkboxes will **not** be rendered when viewing the documentation on
# ``ReadtheDocs``, as the appropriate VTK widget is not supported in this
# headless environment.

# %%
# Finally, we create the :class:`~geovista.geoplotter.GeoPlotter` and add the
Expand Down
54 changes: 35 additions & 19 deletions src/geovista/examples/unstructured/dynamico.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,28 @@
# 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.

"""Importable and runnable geovista example.
"""
DYNAMICO Mesh
-------------

Notes
-----
.. versionadded:: 0.3.0
This example demonstrates how to render an unstructured hexagon/pentagon mesh.

"""
📋 Summary
^^^^^^^^^^

Creates a mesh from 2-D latitude and longitude unstructured cell bounds.

The resulting mesh contains hexagonal cells tessellated around 12 pentagon cells,
which are centered over the 12 vertices of a base icosahedron.

It uses surface air pressure data from the DYNAMICO project, a new dynamical core
for the Laboratoire de Météorologie Dynamique (LMD-Z), the atmospheric General
Circulation Model (GCM) part of Institut Pierre-Simon Laplace (IPSL-CM) Earth
System Model. The data targets the mesh faces/cells.

Note that, a graticule and Natural Earth coastlines are also rendered.

""" # noqa: D205,D212,D400
from __future__ import annotations

import geovista as gv
Expand All @@ -19,28 +34,24 @@


def main() -> None:
"""Create a mesh from 2-D latitude and longitude unstructured cell bounds.

The resulting mesh contains both hexagonal and pentagonal cells.

It uses surface air pressure data from the DYNAMICO project, a new dynamical core
for the Laboratoire de Météorologie Dynamique (LMD-Z), the atmospheric General
Circulation Model (GCM) part of Institut Pierre-Simon Laplace (IPSL-CM) Earth
System Model. The data targets the mesh faces/cells.
"""Plot a DYNAMICO unstructured mesh.

Note that, a graticule and Natural Earth coastlines are also rendered.
Notes
-----
.. versionadded:: 0.1.0

"""
# load the sample data
# Load the sample data.
sample = dynamico()

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

# provide mesh diagnostics via logging
# sphinx_gallery_start_ignore
# Provide mesh diagnostics via logging.
gv.logger.info("%s", mesh)
# sphinx_gallery_end_ignore

# plot the mesh
# Plot the unstructured mesh.
plotter = gv.GeoPlotter()
sargs = {"title": f"{sample.name} / {sample.units}", "shadow": True}
plotter.add_mesh(mesh, scalar_bar_args=sargs)
Expand All @@ -59,3 +70,8 @@ def main() -> None:

if __name__ == "__main__":
main()

# %%
# .. note::
# Graticule labels will **not** be rendered when viewing the documentation on
# ``ReadtheDocs``, as labels are not supported in this headless environment.
56 changes: 36 additions & 20 deletions src/geovista/examples/unstructured/dynamico_poly.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,29 @@
# 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.

"""Importable and runnable geovista example.
"""
DYNAMICO Mesh (Projected)
-------------------------

Notes
-----
.. versionadded:: 0.1.0
This example demonstrates how to render a projected unstructured hexagon/pentagon mesh.

"""
📋 Summary
^^^^^^^^^^

Creates a mesh from 2-D latitude and longitude unstructured cell bounds.

The resulting mesh contains hexagonal cells tessellated around 12 pentagon cells,
which are centered over the 12 vertices of a base icosahedron.

It uses surface air pressure data from the DYNAMICO project, a new dynamical core
for the Laboratoire de Météorologie Dynamique (LMD-Z), the atmospheric General
Circulation Model (GCM) part of Institut Pierre-Simon Laplace (IPSL-CM) Earth
System Model. The data targets the mesh faces/cells.

Note that, a graticule and Natural Earth coastlines are rendered, and the
mesh is also transformed to the Polyconic pseudo-conical projection.

""" # noqa: D205,D212,D400
from __future__ import annotations

import geovista as gv
Expand All @@ -19,29 +35,24 @@


def main() -> None:
"""Create a mesh from 2-D latitude and longitude unstructured cell bounds.

The resulting mesh contains both hexagonal and pentagonal cells.

It uses surface air pressure data from the DYNAMICO project, a new dynamical core
for the Laboratoire de Météorologie Dynamique (LMD-Z), the atmospheric General
Circulation Model (GCM) part of Institut Pierre-Simon Laplace (IPSL-CM) Earth
System Model. The data targets the mesh faces/cells.
"""Plot a projected DYNAMICO unstructured mesh.

Note that, a graticule and Natural Earth coastlines are rendered, and the
mesh is also transformed to the Polyconic pseudo-conical projection.
Notes
-----
.. versionadded:: 0.1.0

"""
# load the sample data
# Load the sample data.
sample = dynamico()

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

# provide mesh diagnostics via logging
# sphinx_gallery_start_ignore
# Provide mesh diagnostics via logging.
gv.logger.info("%s", mesh)
# sphinx_gallery_end_ignore

# plot the mesh
# Plot the unstructured mesh.
crs = "+proj=poly"
plotter = gv.GeoPlotter(crs=crs)
sargs = {"title": f"{sample.name} / {sample.units}", "shadow": True}
Expand All @@ -61,3 +72,8 @@ def main() -> None:

if __name__ == "__main__":
main()

# %%
# .. note::
# Graticule labels will **not** be rendered when viewing the documentation on
# ``ReadtheDocs``, as labels are not supported in this headless environment.