Freezing Cycle of Lake Mendota

1 minute read


BattleViz December 2018

r/dataisbeautiful

import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline

Data preparation:


For small datasets I prefer to work with MS-Excel as it gives a visual cue. I’ve taken the following steps to prepare the data:

  1. Remove closing and opening dates
  2. Winter year was in the format “1885-86”, I considered it to be the winter of 1885
  3. Since we still are in the winter of 2018 I’ve excluded that row from the analysis
  4. “DAYS” columns contains the total number of days the Lake was frozen in the season
  5. I’ve calculated a standard moving averages for 5 and 10 years
  6. The Weighted moving average is calculated as follows: $5year+4(year-1)+3(year-2)+2(year-3)+(year-4)/15$
data = pd.read_csv("./freezing_2.csv")
data = data.iloc[:,0:7]
data.head()
WINTER DAYS Moving_Average_5 Moving_Average_10 weighted_moving_average_5 Ratio Trend
0 1855 118 NaN NaN NaN NaN NaN
1 1856 151 NaN NaN NaN NaN NaN
2 1857 121 NaN NaN NaN NaN NaN
3 1858 96 NaN NaN NaN NaN NaN
4 1859 110 119.2 NaN 114.466667 1.040606 116.824659

Visualizing the data:


I’ve used standard python library matplotlib but the same visualization can be replicated using any available tool.

fig, ax = plt.subplots(figsize = (20,18), nrows=4)
i = 0
ys = ['DAYS', 'Moving_Average_10', 'weighted_moving_average_5','Trend']
for row in ax:
    row.plot(data.WINTER, data[ys[i]])
    row.set_title(ys[i])
    i += 1
plt.show()

png

Insights


In the plots above i’ve tried to visualize the total duration of freezing period in each year. Since the year over year fluctations are quite high I’ve smoothed it using 3 different smoothing techniques.

  1. Moving average of last 10 years
  2. Weighted Moving average of 5 years, where the latest year gets the highest weight
  3. Linear smoothing of 5 years weighted moving average using regression

The apparent trend in data is duration of freezing period is decreasing at an alarming rate. In just ~150 years we’ve lost a month’s worth of winter.

Don’t believe “The President”. Global Warming is real.