O'Reilly logo

NumPy Cookbook - Second Edition by Ivan Idris

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Studying annual atmospheric pressure averages

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) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required