This Project Pythia Cookbook demonstrates how to use UXarray to read an MPAS unstructured-grid NetCDF dataset, compute relative vorticity from the 10-meter zonal and meridional wind components, and visualize the results as shaded polygon plots on global and regional maps.
TEST CLAUDE TEST CLAUDE Keep on testing
MPAS (Model for Prediction Across Scales) uses an unstructured Voronoi mesh that cannot be handled by conventional grid-aware tools. UXarray provides an xarray-compatible interface for unstructured grids, making it straightforward to load MPAS output, apply differential operators such as curl and divergence, and create publication-quality visualizations — all without interpolating to a regular lat/lon grid.
By the end of this cookbook you will know how to:
- Open an MPAS grid topology file and a diagnostic output file together with
ux.open_dataset - Select individual time steps from face-centered variables
- Compute relative vorticity (∂v/∂x − ∂u/∂y) with a single call to
UxDataArray.curl - Render the result as a shaded polygon plot with
plot.polygons - Extract a regional subdomain with
subset.bounding_box
This cookbook contains a single notebook that walks through the full workflow from data loading to visualization.
The notebook covers:
- Loading the dataset — opening a 40,962-cell MPAS-Atmosphere 120 km mesh with
ux.open_dataset - Extracting wind components — selecting
u10(zonal) andv10(meridional) 10-meter winds for a single time step - Computing vorticity — calling
u10.curl(v10)to obtain the vertical component of relative vorticity - Plotting — global shaded polygon map, side-by-side comparison of u10/v10/vorticity, and a North Atlantic regional zoom
You can 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. Simply navigate to
the top right corner of the book chapter you are viewing and click
on the rocket ship icon, then select "launch Binder". After a moment you
will be presented with a notebook you can interact with. Code cells
have no output until you execute them by pressing {kbd}Shift+{kbd}Enter.
-
Clone the repository:
git clone https://github.com/ProjectPythia/uxarray-vorticity-cookbook.git
-
Move into the directory:
cd uxarray-vorticity-cookbook -
Create and activate the conda environment:
conda env create -f environment.yml conda activate uxarray-vorticity-cookbook-dev
-
Start JupyterLab:
cd notebooks/ jupyter lab