This Cookbook is a comprehensive showcase of workflows & techniques for visualizing Unstructured Grids using UXarray.
The ability to natively visualize unstructured grids is a much-needed ability within the Scientific Python Ecosystem, which poses multiple challenges and needs to:
- Not regrid the source unstructured grid to structure
- Take advantage of grid information, such as connectivity variables
- Limit the amount of pre-processing needed to prepare the data for Python visualization tools
UXarray enables such visualization methods that operate directly on unstructured grid data, providing Xarray-styled functionality to better read in and use unstructured grid datasets that follow standard conventions. UXarray supports a variety of unstructured grid formats including UGRID, MPAS, SCRIP, and Exodus, and is extendable for other formats.
This cookbook covers an introduction to unstructured grids and UXarray, provides an overview of the visualization methods and libraries, and showcases several UXarray visualization functions.
Rajeev Jain (Argonne National Laboratory)
Ian Franda (University of Wisconsin-Madison)
This cookbook is split up into a few chapters that provide a detailed overview of how to use UXarray to work with and visualize unstructured grid datasets:
1. Introduction to UXarray & Unstructured Grids
Here we cover what unstructured grids are and how they are different than structured grids as well as whay UXarray could play a significant role in unstructured grid visualization.
2. Methods & Libraries for Unstructured Grid Visualization
In this chapter, we briefly introduce plotting libraries and their specific technologies as well as rendering techniques that could be used for unstructured grid plotting and are used as part of UXarray.
3. UXarray Visualization
Several visualization cases and examples that can be realized using UXarray are provided in this chapter; grid topology plots, polygons, points, to name a few. Also in this section, the usage of UXarray plotting API and a discussion of visualization at scale are also provided.
You can either run the notebook using Binder or on your local machine.
The simplest way to interact with a Jupyter Notebook is through
Binder, which enables the execution of a
Jupyter Book in the cloud. The details of how this works are not
important for now. All you need to know is how to launch a Pythia
Cookbooks chapter via Binder. Simply navigate your mouse to
the top right corner of the book chapter you are viewing and click
on the rocket ship icon, (see figure below), and be sure to select
“launch Binder”. After a moment you should be presented with a
notebook that you can interact with. I.e. you’ll be able to execute
and even change the example programs. You’ll see that the code cells
have no output at first, until you execute them by pressing
{kbd}Shift
+{kbd}Enter
. Complete details on how to interact with
a live Jupyter notebook are described in Getting Started with
Jupyter.
If you are interested in running this material locally on your computer, you will need to follow this workflow:
-
Clone the
https://github.com/ProjectPythia/unstructured-grid-viz-cookbook
repository:git clone https://github.com/ProjectPythia/unstructured-grid-viz-cookbook.git
-
Move into the
unstructured-grid-viz-cookbook
directorycd unstructured-grid-viz-cookbook
-
Create and activate your conda environment from the
environment.yml
fileconda env create -f environment.yml conda activate unstructured-grid-viz-cookbook-dev
-
Move into the
notebooks
directory and start up Jupyterlabcd notebooks/ jupyter lab