Measurement is the cornerstone of all science. Without it, how could we test our hypotheses?
Python, as the preeminent programming language for data science, makes it easy to gather, clean, and make sense of measurement data. With Python, we can back-test predictions, validate models, and hold prognosticators accountable.
Last year, an outdated meme taunting Al Gore showed up in my LinkedIn feed, marked with the hashtag "#catastrophizing." The subject was his comments in 2007 and 2009 that the Arctic Sea would be devoid of summer ice within the span of seven years. Several fact-checking sites verified this statement as "mostly true" and referred to the following quote:
"Some of the models suggest to Dr. (Wieslav) Maslowski that there is a 75% chance that the entire north polar ice cap, during some of the summer months, could be completely ice-free within the next five to seven years."
-Al Gore, December 2009
While many individuals accept memes at face value, data scientists possess the ability to delve into the data and draw their own conclusions. In this Quick Success Data Science project, we’ll use Python’s pandas and Matplotlib libraries to scrutinize the behavior of Arctic Sea Ice over the last four decades and put the comments and memes to the test.
A Comment on Climate Change
Please note that this is neither an anti- nor pro-Climate Change article, it is a pro-data article. Regardless of how you feel about anthropogenic climate change, I hope you agree that it’s in everyone’s best interest to validate models and confirm predictions.
It’s also important that thought leaders on critical subjects refrain from making extravagant or rash claims that are easily refuted. This not only tarnishes credibility but also politicizes the subject matter, making rational discussions difficult if not impossible.
In this case, Al Gore was wise enough to hedge his comments with probabilities and words like "suggest" and "could." Unfortunately, these hedges are easily misplaced when making memes.
National Snow and Ice Data Center
To confirm or refute Gore’s "prediction," we need to know the minimum extent of sea ice over the period in question. Fortunately, we have access to a comprehensive public dataset compiled by the National Snow and Ice Data Center, a part of the Cooperative Institute for Research in Environmental Sciences (CIRES) at the University of Colorado, Boulder [1]. This dataset utilizes satellite imagery to track and monitor changes in Arctic Sea ice.
The data is provided in both monthly and daily increments. Generally, the monthly totals are recommended for looking at trends in sea ice. However, to ensure we capture the minimum measured extent for each month, we’re going to use the daily data and select the day with the lowest value to represent the whole month.
While the dataset in daily increments is accessible in CSV format through the provided link, I’ve already prepared the file and stored it in this Gist for ease of use.
To address the question at hand, we’ll use pandas to prepare the data and Matplotlib to plot it as a line chart. We’ll plot all the data, but we’ll focus mainly on the minimum values that occur each summer.
The Code
The following code was entered into JupyterLab and is described by cell.
Importing Libraries
For this project, all we need are the stalwart libraries of Matplotlib and pandas. You can install them with conda using:
conda install matplotlib pandas
and with pip using:
pip install matplotlib
pip install pandas
Matplotlib’s mdates
module will help us annotate our plot with the time span during which Gore postulated an ice-free Arctic Sea. Here are the imports:
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
Loading and Preparing the Data
The following commented code uses the pandas library to load the data from the Gist and prepare it for plotting. In addition, it generates a yearly moving average to capture long-term trends in the measurements.
# Read the data:
URL = 'https://bit.ly/3NLoDzx'
df = pd.read_csv(URL, skiprows=[1])
# Remove leading whitespace from the column names:
df.columns = df.columns.str.strip()
# Drop unnecessary columns:
df = df.drop(df.columns[[4, 5]], axis=1)
# Group by monthly MINIMUM ice extent:
df = df.groupby(['Year', 'Month']).agg({'Extent': ['min']}).reset_index()
# Create a 'date' column from the 'Year' and 'Month' columns:
cols = ['Year', 'Month']
df['date'] = df[cols].apply(lambda x: '-'.join(x.values.astype(str)),
axis="columns")
df['date'] = pd.to_datetime(df['date'])
# Set the 'date' column as the DataFrame index:
df = df.set_index(df['date'])
# Drop unnecessary year, month, and date columns:
df = df.drop(df.columns[[0, 1, 3]], axis=1)
# Calculate the yearly moving average:
df['yearly_ma'] = df.Extent.rolling(12).mean()
# Check the results:
df.tail(3)
Plotting the Data
The following commented code plots the monthly minimum extent data and the yearly moving average as a line chart. The seven-year period after Al Gore’s 2009 remarks is highlighted in red and labeled, "Gore’s Next 7 Years."
# Create the plot:
fig, ax = plt.subplots(figsize=(12, 6))
ax.set_title('Arctic Sea Ice Monthly MINIMUM Extent', size=15)
ax.plot(df['Extent'], lw=2)
ax.plot(df['yearly_ma'], color='k')
ax.set_ylim([0, 20])
ax.tick_params(axis='both',
which='major',
labelsize=12)
ax.grid()
# Add a legend:
ax.legend(['Ice Extent (10^6 sq km)', 'Yearly Moving Ave'],
frameon=True,
loc=3,
prop={'size': 14},
facecolor='#a1c9f4',
edgecolor='k',
fancybox=True,
shadow=True,
framealpha=1)
# Add a shaded span for Gore's prediction:
ax.axvspan(*mdates.datestr2num(['2009-12-14', '2016-1-1']),
color='red',
alpha=0.3)
# Annotate the 7-year span referenced by Gore in 2009:
ax.text(0.655, 0.8,
"Gore's Next 7 Years",
transform=ax.transAxes,
fontsize=14)
# Set the x and y labels:
font1 = {'family': 'arial',
'color': 'black',
'size': 15}
ax.set_xlabel('Year', fontdict=font1)
ax.set_ylabel('Arctic Sea Ice Extent (10^6 sq km)',
fontdict=font1)
plt.show()
The saw-toothed blue line in the plot tracks the minimum extent of Arctic Sea ice for each month. The peak of each oscillation represents the wintertime minimum extent (usually highest in March). The trough of each oscillation represents the summertime minimum extent (usually lowest in September). The black line is the yearly moving average, which filters out the seasonal "noise" to show the overall trend in sea ice extent over the 44-year period.
Because we’re using the minimum values recorded each month, rather than the more typical monthly mean or median values, this plot may not exactly match others that you find online.
The Outcome
In the seven years following 2009, the Arctic Sea did not become ice-free, although it did reach a new low of 3.34 million square kilometers on September 16, 2012. This was down considerably from the September 1981 low of 6.9 million square kilometers and even the 2009 low of 5.0 million square kilometers. In fact, there was a steady downward trajectory from 2009 through 2012.
After 2012, the values seemed to stabilize somewhat and by the summer of 2021, the moving average curve was actually increasing.
While Al Gore didn’t "get it right," his statement did leave room for the actual outcome. The models he referenced included a 25 percent chance that some ice would remain in the Arctic Sea over the summer.
One thing we should learn from this is that the earth’s climate is a complicated beast. Specific and short-term predictions about its behavior should be very carefully considered. While creating a sense of urgency may be important, this can easily backfire, resulting in ridicule and reduced credibility.
Citations
[1] Fetterer, F., K. Knowles, W. N. Meier, M. Savoie, and A. K. Windnagel. Sea Ice Index, Version 3. 2017, Distributed by National Snow and Ice Data Center. https://doi.org/10.7265/N5K072F8. Date Accessed 06–18–2022.
The specific source data product websites for this project were http://nsidc.org/data/nsidc-0081.html and http://nsidc.org/data/nsidc-0051.html (data range: October 1978-June 2022).
Additional details about the data are listed in the sheet below:
According to the NSIDC citation policies, photographs, imagery, or text from the NSIDC website may be downloaded and used unless limitations for its use are specifically stated. Satellite imagery may be downloaded and used free of charge with proper credit. Unless otherwise specified, photographs and imagery may be used for commercial purposes; however, they cannot be re-sold.
Many images on the site include a caption and specific credit information. Otherwise, the general credit format should be: "Image/photo courtesy of the National Snow and Ice Data Center, University of Colorado, Boulder."
Thanks!
Thanks for reading and please follow me for more Quick Success Data Science projects in the future.