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.

Scipy

Authors
Affiliations
University at Albany (SUNY)
Univerity of California, Berkeley
University of Miami
University of California, San Diego
University at Albany (SUNY)
Tuskegee University
University at Albany (SUNY)

Overview

Previously, you have learned how to detect precipitation and sea level pressure (SLP) features seperately. However, what if you wanted to plot the sea level pressure and precipitation features together, and plot them together in one plot? In this notebook, we will apply the previous algorithms to create plots analyzing SLP and preicpitation features using Scipy’s label function.

Prerequisites

ConceptsImportanceNotes
xarrayNecessary
matplotlibNecessary
CartopyNecessaryNeeded to plot geospatial data
Scipy Precip Detection and Tracking AlgorithmNecessary
Scipy SLP Detection and Tracking AlgorithmNecessary
scipy-imageUsefulUseful reference for Scipy’s label function
IPythonUsefulFor inline animation

Import Packages

Let’s create a function that handles events that cross over the international dateline.

Basic Set-Up

We have two previous algorithms that are useful to detect precipitation and SLP features. Let’s create a plot that plots both of these features together, which should hopefully reveal some characteritsics about extratropical cyclones (ETCs).

Before we do that though, we need to implement both the precipitation detection function and the SLP detection function.

Load in both datasets using xarray:

The data contained within slp_data is in pascals, however atmospheric scientists commonly use hectopascals. We will therefore need to convert the array from pascals into hectopascals by dividing by 100.

Recall that although we have global data for slp_data, we only have northern hemisphere (specifically between 20°N and 80°N) data for precip_data. Therefore, we need to filter out the slp_data so that it only includes the same data points that are contained within the precip_data.

Let’s create a 2-d grid for each of our datasets. Unfortunately, the two datasets do not have similar resolutions. The resolution of slp_data is 1° x 1°, while the resolution for precip_data is 0.25° x 0.25°. This therefore requires us to create two different grids for each of our datasets.

Scipy Precipitation and SLP Detection Algorithm

In order to identify slp minima, we need to set a threshold. We’ll say that any feature with a pressure below 1000hPa is a feature that we are interested in tracking for the SLP dataset.

Similarly, we’ll set up a threshold for minimum precipitation as well of 0.25 mm/hr.

Let’s now run our algorithm to detect features that we have previously built in the Scipy SLP Detection and Tracking Algorithm notebook. We will first focus on a single time step.

Now that we have our function, let’s run this function on both preicp_data and slp_data for the first time index.

Let’s go ahead and plot both the precip_features and slp_features.

<cartopy.mpl.gridliner.Gridliner at 0x7fab6bf95be0>
<Figure size 1500x800 with 1 Axes>

In this map, slp features are contoured and precipitation features are in filled contours. We can see in general that most slp features are associated with some precipitation features. However, in the northern latitudes such as near the Hudson Bay and off the coast of Alaska there are some exceptions. The reverse is not true. Not every precipitation feature is associated with a low slp feature, especially in regions closer to the equator. This indicates that most of the slp regions identified are associated with some sort of ETC, while the same is not true for precipitation regions.

Let’s create an animation showing the evolution of this.

Loading...
<Figure size 640x480 with 1 Axes>

Getting Precipitation Rate and Minimum SLP for Each Feature

Like we did in previous notebooks, let’s take the functions that were previously defined for minimum slp and precipitation rate to make a plot.

Now let’s go ahead and make an animation of this time series!

Loading...
<Figure size 1500x800 with 2 Axes>

It’s important to note that in this diagram, any minima in sea level pressure is shown via the dots, not just those below 1000hPa. Therefore, there are a lot more dots on this map than features identified in the last image. Precipitation rate is in filled contours underneath the dots. These are filtered to only include areas where the precipitation rate is above 0mm/hr.

We can see a consistent pattern here. Anywhere there is precipitation, there is at least some local minima in SLP. We previously saw in the last example that the low pressure system doesn’t have to be below 1000hPa, but in every precipitation anomaly is at the very least associated with a local minima in SLP.

Let’s now add in the SLP features that we previously identified to this plot!

Loading...
<Figure size 1500x800 with 2 Axes>

We can see now that although each contoured SLP system varies in size, each is typically associated with only one local minima in SLP, which means that our algorithm is working correctly! The one exception to this rule is over Greenland, where we can see multiple local minima within the very large contoured region. As this contoured region is very large, it is entirely possible that these are just mini low pressure systems within a much broader area of low SLP found within this region.

Additionally, we can see that every low pressure system is associated with at least some precipitation, consistent with our previous example. The opposite is not true however, as there are some precipitation contours that don’t have a corresponding SLP contour.

Creating a Tracking Algorithm

Now that we have explored a detection algorithm, we can apply it to a tracking algorithm, just like we did in previous notebooks. We’ll be re-using a lot of code from other notebooks, so please look back at the references if there is any confusion.

First, we will implement the precip_data tracking algorithm.

Now that we have precipitation features tracked, let’s go ahead and track features to track the slp_data.

Now that we have tracked both precipitation and SLP features, let’s go ahead and plot them!

Loading...
<Figure size 640x480 with 1 Axes>