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.

Baroclinic Potential Vorticity Analysis, Divergence, and Winds

Classic baroclinic potential vorticity plot at 250 hPa using GFS analysis file.

This example uses example data from the GFS analysis for 12 UTC 31 October 2016 and uses xarray as the main read source with using MetPy to calculate the baroclinic potential vorticity, divergence and wind speed with geographic plotting using Cartopy for a CONUS view of the 250-hPa surface with divergence and wind barbs.

By: Kevin Goebbert

The following code reads the example data using the xarray open_dataset function and prints the coordinate values that are associated with the various variables contained within the file.

This code uses the metpy accessor to parse file to make it easy to pull data using common coordinate names (e.g., vertical) and attach units.

Could not find variable corresponding to the value of grid_mapping: LatLon_Projection
Could not find variable corresponding to the value of grid_mapping: LatLon_Projection
Could not find variable corresponding to the value of grid_mapping: LatLon_Projection
Could not find variable corresponding to the value of grid_mapping: LatLon_Projection
Could not find variable corresponding to the value of grid_mapping: LatLon_Projection
Could not find variable corresponding to the value of grid_mapping: LatLon_Projection
Could not find variable corresponding to the value of grid_mapping: LatLon_Projection
Could not find variable corresponding to the value of grid_mapping: LatLon_Projection
Could not find variable corresponding to the value of grid_mapping: LatLon_Projection

Data Retrieval

This code retrieves the necessary data from the file and completes some smoothing of the temperature, and wind fields using the MetPy function smooth_n_point. A nicely formated valid time (vtime) variable is also created.

Use MetPy to compute the baroclinic potential vorticity on all isobaric levels and other variables

Map Creation

This next set of code creates the plot and draws contours on a Lambert Conformal map centered on -100 E longitude. The main view is over the CONUS with isobaric PV map with PV contoured every 1 PVU and divergence colorshaded.

<Figure size 1400x1200 with 2 Axes>