Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Basic MPAS Analysis & Visualization with UXarray

In this section, you’ll learn:

  • How to interact with MPAS data: retrieving, subsetting and storing data

  • How to visualize horizontal data, i.e. data from a single vertical level

Prerequisites

ConceptsImportance
UXarrayNecessary
Unstructured GridHelpful

Time to learn: 15 minutes


Import packages

We use Cartopy, GeoViews, Holoviews and Matplotlib packages for visualization. Xarray, UXarray, NumPy and GeoPandas are used for the data structures we use to represent and manipulate the data.

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[1], line 14
     10 import warnings
     11 import math
     12 
     13 import cartopy.crs as ccrs
---> 14 import geoviews as gv
     15 import geoviews.feature as gf
     16 import holoviews as hv
     17 import hvplot.xarray

ModuleNotFoundError: No module named 'geoviews'

Retrieving the state border lines and coastlines

Helper functions

The following functions are used for visualizing the data. The horizontal_contour function generates the contour map for a given slice of data.

Retrieve/load MPAS/JEDI data

The example MPAS/JEDI data are stored at jetstream2. We need to retreive those data first. There are two ways to retrieve MPAS data:

  1. Download all example data from JetStream2 to local and them load them locally. This approach allows downloading the data once per machine and reuse it in notebooks.

  2. Stream the JetStream2 S3 objects on demand. In this case, each notebook (including restarting a notebook) will retrieve the required data separately as needed.

Method 1: Download all example data once and reuse it in mulptile notebooks

Method 2: Stream the JetStream2 S3 objects on demand

Loading the data into UXarray datasets

We use the UXarray data structures to work with the data. This package supports data defined over unstructured grid and provides utilities for modifying and visualizing it. The available functionality are discussed in UxDataset documentation.

Regional temperature contour

We use the theta (potential temperature) variable from this dataset, which has a (Time, n_face, nVertLevels), i.e. Time * Number of grid faces * Number of vertical levels dimensionality to have a look at a regional, horizontal plot.

The data has multiple vertical levels, representing the values for different elevations. In this section, we are focusing on a single level. Next, we are plotting the contour of theta values in the data for this fixed level.