Subsetting an Unstructured Grid: Analysis Over Chicago

Subsetting an Unstructured Grid: Analysis Over Chicago#

Authors: Philip Chmielowiec

This usage example showcases various ways of subsetting an unstructured grid using UXarray, focussing on analyzing a region around Chicago, Illinois.

import uxarray as ux
import geoviews.feature as gf
import as ccrs
import holoviews as hv

import warnings

import geocat.datafiles as geodf

plot_opts = {"width": 700, "height": 350}


Downloading file 'registry.txt' from '' to '/home/docs/.cache/geocat'.


In this example, we will be using the geocat-datafiles package to obtain our grid and data files.

The dataset used in this example is a 30km global MPAS meshes. We will be investigating the relative humidity vertically interpolated to 200hPa (relhum200hPa) data variable.

datafiles = (
Downloading file 'netcdf_files/MPAS/FalkoJudt/dyamond_1/30km/' from '' to '/home/docs/.cache/geocat'.
Downloading file 'netcdf_files/MPAS/FalkoJudt/dyamond_1/30km/' from '' to '/home/docs/.cache/geocat'.
uxds = ux.open_dataset(datafiles[1], datafiles[0])
clim = (uxds["relhum_200hPa"][0].values.min(), uxds["relhum_200hPa"][0].values.max())
features = gf.coastline(
    projection=ccrs.PlateCarree(), line_width=1, scale="50m"
) * gf.states(projection=ccrs.PlateCarree(), line_width=1, scale="50m")

Global Grid#

Many unstructured grids, such as those from global climate models, span the entire surface of a sphere (both with or without masks, such as continents).

UXarray supports working with these global grids, handling cases that arise with the spherical geometry of the earth (wrap around at the antimeridian, pole points, etc.)

    method="polygon", exclude_antimeridian=True, title="Global Grid", **plot_opts
) * features