Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Learning NumPy Array

You're reading from  Learning NumPy Array

Product type Book
Published in Jun 2014
Publisher
ISBN-13 9781783983902
Pages 164 pages
Edition 1st Edition
Languages
Author (1):
Ivan Idris Ivan Idris
Profile icon Ivan Idris

Table of Contents (14) Chapters

Learning NumPy Array
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Getting Started with NumPy NumPy Basics Basic Data Analysis with NumPy Simple Predictive Analytics with NumPy Signal Processing Techniques Profiling, Debugging, and Testing The Scientific Python Ecosystem Index

Analyzing precipitation and sunshine duration


The KNMI De Bilt data file has a column containing precipitation duration values in 0.1 hours. The sunshine duration also given in 0.1 hours is derived from global radiation values. Notice the use of the word global and not solar. Hence, there are other sources of radiation taken into account here, but details are not very important right now. We will plot a histogram of precipitation duration values. However, we will omit the days when no rain fell, because there are so many dry days that it skews the overall picture. We will also display the monthly average precipitation and sunshine durations. The following steps describe the rainfall and sunlight length study:

  1. We will load the dates converted into months, sunshine, and precipitation duration into NumPy arrays. Again, we convert missing values to NaN. The code is as follows:

    to_float = lambda x: float(x.strip() or np.nan)
    to_month = lambda x: dt.strptime(x, "%Y%m%d").month
    months, sun_hours...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}