Canadian Climate Stripes

Its been busy around here, and summer is too nice to be blogging. But one thing I’ve been meaning to pull together for a while now is climate stripes (or bar codes) for Canadian cities.

I’ve adapted Ed Hawkins climate stripe visualizations for Canadian cities using the homogenized temperature data from Environment Canada (here) and a few lines of Python code. Each bar represents a mean annual temperature anomaly, or the departure from the overall mean, with dark blue being the coldest and dark red being the warmest.

I’ve also plotted the temperatures versus year and scaled the colour of the points the same way, and given an example for the Vancouver data. To me, this is actually more intuitive. But chacun son gout!

Vancouver, BC (-1.9 to +1.6 C, 1896 to 2017):

ClimateStripes-Vancouver

Same Vancouver data shown as a scatterplot:

ClimateScatter-Vancouver

Prince George, BC (-2.9 to 2.2 C):

ClimateStripes-PrinceGeorge

Calgary, AB (-2.7 to +3.2 C, 1885 to 2017):

ClimateStripes-Calgary

Toronto, ON (-3.3 to +3.3 C, 1840 to 2017):

ClimateStripes-Toronto

Hay River, NT (-4.3 to +3.3 C, 1893 to 2017):

ClimateStripes-HayRiver

Sidney, NS (-2.3 to +2.0 C, 1870 to 2017):

ClimateStripes-Sydney

3 thoughts on “Canadian Climate Stripes

  1. Hi Joseph I will be glad if you could share your python code. Thanks

    Like

    • Once you’ve imported your annual temperature series and assigned it to the variable z, you can do this:
      ## preamble
      import numpy as np
      import matplotlib.pyplot as plt
      import matplotlib as mpl

      ## calculate anomalies
      meanz = np.nanmean(z)
      zanoms = z – meanz

      ##call figure
      fig1 = plt.figure(figsize=(8,6),frameon=False)

      ## normalized anomalies
      norm = mpl.colors.Normalize(vmin=np.nanmin(zanoms),vmax=np.nanmax(zanoms))
      ax = plt.subplot(111)
      ax.spines[“top”].set_visible(False)
      ax.spines[“bottom”].set_visible(False)
      ax.spines[“right”].set_visible(False)
      ax.spines[“left”].set_visible(False)

      ## loop through data and plot vertical line for each year
      ## linewidth will need to be customized depending on length of dataset…
      for i in range(0,len(z)):
      if np.isnan(z[i]) == 0:
      plt.axvline(i,color = plt.cm.RdBu_r(norm(zanoms[i])),linewidth=5.5)

      ## remove axes and labels
      cur_axes = fig1.gca()
      cur_axes.axes.get_xaxis().set_visible(False)
      cur_axes.axes.get_yaxis().set_visible(False)
      plt.margins(x=0)

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s