You may have heard of global warming, which claims that temperature is rising steadily each year. Since pressure is another thermodynamic variable, we may expect pressure also to follow a trend. The complete code for this recipe is in the annual.py
file in this book's code bundle:
import numpy as np import matplotlib.pyplot as plt data = np.load('cbk12.npy') # Multiply to get hPa values avgs = .1 * data[:,1] highs = .1 * data[:,2] lows = .1 * data[:,3] # Filter out 0 values avgs = np.ma.array(avgs, mask = avgs == 0) lows = np.ma.array(lows, mask = lows == 0) highs = np.ma.array(highs, mask = highs == 0) # Get years years = data[:,0]/10000 # Initialize annual stats arrays y_range = np.arange(1901, 2014) nyears = len(y_range) y_avgs = np.zeros(nyears) y_highs = np.zeros(nyears) y_lows = np.zeros(nyears) # Compute stats for year in y_range: indices = np.where(year == years) y_avgs[year - 1901] = np.mean(avgs[indices]) y_highs[year...