Book Image

NumPy Cookbook - Second Edition

By : Ivan Idris
Book Image

NumPy Cookbook - Second Edition

By: Ivan Idris

Overview of this book

<p>NumPy has the ability to give you speed and high productivity. High performance calculations can be done easily with clean and efficient code, and it allows you to execute complex algebraic and mathematical computations in no time.</p> <p>This book will give you a solid foundation in NumPy arrays and universal functions. Starting with the installation and configuration of IPython, you'll learn about advanced indexing and array concepts along with commonly used yet effective functions. You will then cover practical concepts such as image processing, special arrays, and universal functions. You will also learn about plotting with Matplotlib and the related SciPy project with the help of examples. At the end of the book, you will study how to explore atmospheric pressure and its related techniques. By the time you finish this book, you'll be able to write clean and fast code with NumPy.</p>
Table of Contents (19 chapters)
NumPy Cookbook Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Analyzing maximum visibility


If you've gone through all the recipes in this chapter so far, you might need a break from atmospheric pressure. So let's look into visibility instead. The data file has a column for a maximum visibility, which the KNMI describes as follows:

"Maximum visibility; 0: <100 m, 1:100-200 m, 2:200-300 m,..., 49:4900-5000 m, 50:5-6 km, 56:6-7 km, 57:7-8 km,..., 79:29-30 km, 80:30-35 km, 81:35-40 km,..., 89: >70 km)"

Visibility here is a discrete variable, so averaging values may not make sense. Also, it seems that we have a lot of 0 values for the period between 1901 and 1950 for almost every day. I don't believe that De Bilt was extra foggy in that period. For the purpose of this recipe, we define mist as visibility between 1 and 2 km, which corresponds to the values of 10 and 20 in the data file. Let's also define haze as visibility between 2 and 5 km. This in turn corresponds to 20 and 50 in our data file.

Air pollution could reduce visibility, especially on clear...