Skip to content

ProjectPythia/uxarray-vorticity-cookbook

UXarray Vorticity Cookbook

thumbnail

nightly-build Binder DOI

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.

Motivation

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

Authors

John Clyne

Contributors

Structure

This cookbook contains a single notebook that walks through the full workflow from data loading to visualization.

Vorticity from MPAS Data

The notebook covers:

  1. Loading the dataset — opening a 40,962-cell MPAS-Atmosphere 120 km mesh with ux.open_dataset
  2. Extracting wind components — selecting u10 (zonal) and v10 (meridional) 10-meter winds for a single time step
  3. Computing vorticity — calling u10.curl(v10) to obtain the vertical component of relative vorticity
  4. Plotting — global shaded polygon map, side-by-side comparison of u10/v10/vorticity, and a North Atlantic regional zoom

Running the Notebooks

You can run the notebook using Binder or on your local machine.

Running on Binder

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.

Running on Your Own Machine

  1. Clone the repository:

    git clone https://github.com/ProjectPythia/uxarray-vorticity-cookbook.git
  2. Move into the directory:

    cd uxarray-vorticity-cookbook
  3. Create and activate the conda environment:

    conda env create -f environment.yml
    conda activate uxarray-vorticity-cookbook-dev
  4. Start JupyterLab:

    cd notebooks/
    jupyter lab

About

UXarray cookbook: computing vorticity from MPAS data

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors